Query content

Overview

Sitefinity .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 .NET Core frontend works with the OData REST services and fetches content from the CMS. By default, Sitefinity .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 .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 .NET Core standard and you can use it in both .NET Core framework and .NET Core projects.

Want to learn more?

Sign up for our free beginner training. Boost your credentials through advanced courses and certification.
Register for Sitefinity training and certification.

Was this article helpful?

Next article

Localization