Inheritable paragraphs
Inheritable paragraphs are added on a parent page and automatically displayed by child pages. This is an example of a content reuse mechanism that saves time and effort. An editor can add an inheritable paragraph at the top of a site section and have it displayed on each child page in that hierarchy. An inheritable paragraph is typically only editable on the parent page. There are no edit bars on the child pages. This behavior is configurable.
Promos are a common example of inheritable paragraphs. They are used to promote special events or deals. Since promotional content changes often, you want to edit them once and have the change reflected on the whole site.
- How inheritance works
- Footer, metanavigation and section header
- Promos and extras
- Enabling inheritance in base area
How inheritance works
Inheritance is enabled at area level as opposed to paragraph level. Inheritance can be enabled in all page areas. In the demo websites, it is available in footer, metaNavigation, sectionHeader, promos and extras areas by default.
Classes relevant to inheritance are:
- InheritanceContentWrapper inherits content from the parent hierarchy.
- InheritedContentModel
- STKTemplateModel determines paragraph behavior together with area templates.
/templating-kit/templates/global.

Footer, metanavigation and section header
Paragraphs in footer, metanavigation and section areas behave identically. Any paragraph added to these areas on the home page can only be edited on the home page and it cascades down to all pages of the site automatically. Here is the Articles page from the demo. Metanavigation is at the top right. Section header is the blue box.

In footer, default inheritance behavior is identical to metanavigation and section header but footer paragraphs can optionally be edited also on child pages. Set the editable property to true in Templating Kit > Site Definitions to make this possible. See FooterArea class on how this feature is implemented.

Promos and extras
Paragraphs in promosArea and most paragraphs in extrasArea are optionally inheritable. The paragraph dialogs include the Show in subpage checkbox. If this box is checked, the paragraph cascades down to all child pages. The screenshot below is from the stkExtrasInternalPage dialog. The value is stored in a property named inheritable under the paragraph content node.

A Freemarker directive in extrasArea.ftl template script ensures that inheritable paragraphs in the area are rendered without edit bars. You will find a corresponding line of code in promosArea.ftl.
[#list model.extras.column[columnIndex] as extra [@cms.includeTemplate contentNode=extra.content noEditBars=extra.inherited /] [/#list]
The Show in subpage checkbox is a generic field. You can add it to any dialog as long as optional inheritance is allowed in the area template. Use the extends mechanism to get the field from Templating Kit > Dialog Definitions /generic/controls/inheritable. You don't need to recreate it in the dialog.

Enabling inheritance in base area
The base area is near the bottom of the page, above the footer. It can contain optional components that use the full width of the page such as a tag cloud or a carousel. By default, inheritance is not available in the base. Here is how to enable it.

Options for enabling inheritance in base area:
- Automatic inheritance: a paragraph added in the area cascades down to child pages automatically.
- Optional inheritance: a paragraph added in the area cascades only if the Show in subpage box is checked.
Automatic inheritance
To enable inheritance in the base area so that all paragraphs are automatically inherited:
- Edit
/templating-kit/templates/global/baseArea.ftltemplate script. - Add inheritance to the
contentNodeIteratortag. Code sample below. - Check the Enable template box to ensure that the template is served from the repository.
- Save.
[@cms.contentNodeIterator contentNodeCollectionName="base" inherit=true]
Testing: On the demo-project home page, the base area has an stkTeaserCarousel paragraph. When you add the above code in the template script, the carousel paragraph is displayed on all pages of the site since they are all children of the home page. The paragraph remains editable on all pages. Edits made to the paragraph on any page are displayed on all the other pages.
Optional inheritance
Make the paragraph available in the base area
By default, the prototype allows only stkTeaserCarousel and catCloudWide paragraphs in the base area. This is controlled through the prototype in Templating Kit > Site Definitions in /default/templates/prototype/baseArea/paragraphs.
- Add the paragraph you want available in the base area into the prototype.
- In Templating Kit > Site Definitions >
/default/templates/prototype/baseArea/paragraphs, a content node named after the paragraph definition. Look at the existing paragraphs for example. - Under the content node, add a data node
nameand set its value to the name of the paragraph definition again.
Edit base template script
Unlike extras and promos areas, the base area does not rely on STKTemplateModel. Freemarker code that enables inheritance is therefore different.
- Edit
/templating-kit/templates/global/baseArea.ftl. - Insert the code below after the
@cms.contentNodeIteratortag. - Check the Enable template box to ensure that the template is served from the repository.
- Save.
[#list stk.collectContentByUsingInheritance(content,"base") as elem] [#if elem.isInherited()] [@cms.includeTemplate contentNode=elem.content noEditBars=true /] [/#if] [/#list]
Add checkbox to dialog
- Edit the dialog definition of the paragraph you want to make optionally inheritable. For example, to make
stkTeaserCarouselinheritable, edit Templating Kit > Dialog Definitions >/paragraphs/teasers/stkTeaserCarousel. - Under
tabMain, add a new content nodeinheritable. - Under
inheritable, add a data node toextendsand set its value to/modules/standard-templating-kit/dialogs/generic/controls/inheritable. You are extending the generic Show in subpage checkbox control.
To test, insert the paragraph in the base area on any parent page. Check the Show in subpage checkbox in the dialog. Verify that the paragraph is inherited to child pages. Verify also that the paragraph does not have an edit bar on the child pages. 