Query content
Overview
Sitefinity ASP.NET Core Rendered queries content from Sitefinity CMS via OData REST services.
You can fetch content and display it on the frontend in one of the following ways:
- Use the
ContentList
widget
- Use the content selectors in the widget designers
- Use the
IRestClient
interface to fetch and query items from Sitefinity CMS
Use the ContentList widget
The built-in Content list widget implementation enables you to display the content from Sitefinity CMS, such as News, Blog posts, dynamic modules.
For more information, see Content list widget.
For more information about customizing the widget, see Create custom views for the Content list widget.
EXAMPLE: For various samples about implementing your own custom fields, see the Fields section on Sitefinity GitHub repository.
Use the content selectors in the widget designers
You can take advantage of the content selectors in the widget designers. They enable you to select different types of content from Sitefinity CMS, such as News, Blog posts, taxa, or dynamic modules.
For more information, see Autogenerated field types » MixedContentContext.
EXAMPLE: For an example of how to use content selectors, see SelectorDemoUsageModel.cs on Sitefinity’s GitHub repository
The MixedContentContext
class stores information about the selected items – the type, the IDs, the provider, or the order of items. The items inside it can be fetched using Sitefinity’s REST SDK. It provides an extension method that automatically fetches the contents of this method.
For more information, see REST SDK on Sitefinity’s GitHub repository.
EXAMPLE: For a sample usage, see line 46 of SelectorDemoUsageModel.cs on Sitefinity’s GitHub repository.
Use the IRestClient interface
The ASP.NET Core frontend works with the OData REST services and fetches content from the CMS. By default, Sitefinity ASP.NET Core Renderer uses the api/default
service to fetch content from Sitefinity CMS. You can change this in the appsettings.json
file of the ASP.NET Core Renderer.
You can configure the service in Sitefinity CMS backend.
For more information, see Create a RESTful API service.
The IRestClient
interface is part of Sitefinity REST SDK, which you can download from Sitefinity NuGet Repository. The Progress.Sitefinity.RestSdk
library is written in ASP.NET Core standard and you can use it in both ASP.NET Core framework and ASP.NET Core projects.