Query content


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.

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?

Next article