Content blocks


If you want to have some content on your site which is used on more than one place (page) and if you want to manage this content just once for all its occurrences, this article is for you.

The Content blocks module allows you to enter any HTML content including macros, widgets, on-line forms, etc. to a content block and then recall this content on any page within your site.

You can simply download this package (version 8+) or this package (version 10+)* and follow the steps below:

Import the downloaded package to your Kentico project and don’t forget to check the Import files (recommended) checkbox and then the Import code files checkbox on Step 2 of the importing process.

Once the package is imported, you need to assign this module to your site (Sites -> <your site> -> Assigned objects -> Modules)

Now, please reload the administration interface to find the Content blocks module available under the Custom application section.

For using content blocks on your pages, please enter a macro with the name of your content block like:

{% ContentBlock("my_content") %}

* From version 10 on, if your content block contains a macro, you need to either retrieve the content block using {% ContentBlock("my_content")|(recursive)true %} or you need to update the ContentBlockMacroMethods.cs file and resolve macros explicitely: return MacroResolver.Resolve(cbi.ContentBlock);

Share this article on   LinkedIn

Jan Hermann

I am a support engineer in Kentico and I take care of any issue you have!