Create a Content block widget that displays shared content

You can create and add to a page a Content block widget that displays a shared content block.

By default, content blocks are shared content and you can display one block on many pages, using the Content block widget. Sitefinity CMS automatically synchronizes the content in the content block and in the Content block widget. When you modify the content in the widget or in the module, Sitefinity CMS applies the changes everywhere where the content block is used. For more information, see For developers: Create content blocks and Content block widget.

The following code creates a content block with shared content and adds it to a page:

First, you create the content block using CreateContent method of the content manager. Then, you initialize the PageManager. You create new page data using the CreatePageData method of the PageManager. For more information on creating page data, see For developers: Create pages. You edit the page to add the Content block widget. Finally, you call SaveChanges.

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

Web Security for Sitefinity Administrators

The free standalone Web Security lesson teaches administrators how to protect your websites and Sitefinity instance from external threats. Learn to 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?