You use ContentBaseController abstract class to construct all the out-of-the-box SEO properties for the widget in Detail view mode - when displaying a single item. When you implement a descendant of this class, you can call the InitializeMetadataDetailsViewBag method and pass the item that is currently being displayed. Based on the item and the SEO configurations of the site, Sitefinity CMS automatically creates the Open Graph and other SEO properties.
GITHUB EXAMPLE: For more information about this class, see the sample code in Sitefinity CMS GitHub repository » ContentBaseController.cs.
EXAMPLE: You have custom book widget that displays a list of books on a page. You can implement custom routing logic for filtering by a specific author that will resolve the required author from the route – for example, http://mysite/book-catalog/Index/Author. For more information, see #region IRouteMapper in the sample at the end of the article.
return this.View("ViewName", viewModel);
The following sample demonstrates how to use IContentLocatableView, IRouteMapper, HandleUnknownAction, and how to return a view from your Controller classes:
Sign up for our free beginner training. Boost your credentials through advanced courses and certification. Register for Sitefinity training and certification.
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important