---
title: Inheriting portal engine page content
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Inheritance allows you to maintain a consistent design throughout the website and manage content shared by multiple pages in a single location. Portal engine pages can use two different types of content inheritance:

- Page nesting inside ancestor documents
- Inheriting the entire page template from the parent document (shared templates)

## Using page nesting

Nested pages display their own content inside other pages. You can nest pages within ancestor documents in the content tree.

> **Info:** **What are ancestor documents?**
>
> Ancestors include all documents under which a given document is stored, from the root of the site's content tree down to the document's direct parent.
>
> For example, the _**/Company/Offices/London Office**_ document has the following ancestors:
>
> - Website root document
> - /Company
> - /Company/Offices

Nesting allows you to organize your website's content tree in the following way:

- Pages that provide shared content on the upper levels
- Individual content pages stored as subpages

On this page

Related pages

- [Creating portal engine master pages](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/creating-portal-engine-master-pages.md)
- [Using and configuring web parts](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md)

### Creating pages that support nesting

> **Note:** **Note**: The following steps are required for all documents serving as [master pages](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/creating-portal-engine-master-pages.md), but you can also set up nesting for any other pages.

To allow subpages to nest within a page:

1. Open the **Pages** application.
2. Select the page in the content tree.
3. Open the **Design** tab.
4. [Add](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md) the **Page placeholder** web part.

The page placeholder specifies the position of nested pages within the content. When displaying the nested pages, the system loads everything around the page placeholder as fixed content.

![Page placeholder web part located on a website's master page template](https://docs.kentico.com/docsassets/k8/inheriting-portal-engine-page-content/Page_Placeholder.png "Page placeholder web part located on a website's master page template")

#### Setting default content for page placeholders

By default, the placeholder does not display anything on the page where it is placed. You can configure the placeholder to show one of the website's [re-usable page templates](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/creating-portal-engine-page-templates.md#creating-re-usable-page-templates) as default content:

1. **Configure** the page placeholder web part (double-click).
2. **Select** a template in the **Default page template** property.
3. Click **OK**.

The page displays the selected template inside the area occupied by the page placeholder. Nested pages ignore the placeholder's default template and display their own content instead.

> **Info:** The **Use template on all subpages** and **Document to display** properties force the placeholder to always display the default template or a specific document. Such placeholders cannot be used for standard page nesting — all nested subpages display the specified content instead of their own.

### Configuring pages to nest within ancestors

> **Tip:** **Tip**: You can use page nesting on any number of levels. Nested pages can also contain their own page placeholders for displaying subpages.

1. Open the **Pages** application.
2. Select the subpage document in the content tree.
3. Open the **Properties -> Template** tab.
4. Choose one of the following **Page nesting** options for the document:

   | Page nesting type            | Description                                                                                                                                                                                                                                                                                                                                                                                                                              |
   | ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
   | Use page template settings   | The page nesting settings are determined by the configuration of the document's [page template](https://docs.kentico.com/k8/developing-websites/managing-page-templates.md). This option allows you to manage the settings for documents with shared templates.<br>To modify the page template's nesting settings:<br>Click **Edit template properties**.<br>Set the **Page nesting** options on the **General** tab.<br>Click **Save**. |
   | None                         | The document behaves as a standalone page without any nesting.                                                                                                                                                                                                                                                                                                                                                                           |
   | Only the nearest master page | The document nests only within the website's [master page](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/creating-portal-engine-master-pages.md). If your website uses multiple master pages, the document nests within the closest master page in the content tree hierarchy.                                                                                                             |
   | Specific ancestor pages      | Allows you to enable or disable nesting within any ancestor pages (regardless of the master page structure). Specific pages are represented by the checkboxes below.                                                                                                                                                                                                                                                                     |

   ![Configuring page nesting on the document level](https://docs.kentico.com/docsassets/k8/inheriting-portal-engine-page-content/Page_Nesting_Settings.png "Configuring page nesting on the document level")
5. Click **Save**.

When visitors view the nested page, the system loads the content of the selected ancestors and displays it around the content of the page itself (according to the positions of the page placeholder web parts).

On the **Design** tab of nested documents, the editable template section appears inside the content of ancestor pages (in the position of the page placeholder on the previous nesting level). You can edit the  [page layout](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/editing-page-layouts.md) and [web parts](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md) of the nested page's template as usual. You cannot modify the content from the ancestors where the page is nested.

![Editing a nested page on the Design tab](https://docs.kentico.com/docsassets/k8/inheriting-portal-engine-page-content/Nested_Page_Design.png "Editing a nested page on the Design tab")

> **Note:** **Important**
>
> You can only edit the page template on the **Design** tab if all documents where the given page is nested contain a _Page placeholder_.
>
> If you configure a subpage to "nest" inside a page without a page placeholder, the subpage only displays the content of the given ancestor and cannot be modified in any way.

#### Inheriting page header content for nested pages

You can add custom _****_ content to pages, such as links to external CSS or JavaScript files.

1. In the **Pages** application, open the document's **Properties -> Template** tab.
2. Click **Edit template properties**.
3. Switch to the **Header** tab.
4. Type in the required content.
5. Click **Save**.

The system inserts the content into the __ element in the output code of all pages that use the given template.

Nested pages can inherit the header content from their ancestors. The inheritance depends on the following options, which you can enable or disable on the **Header** tab of each page template:

- **Allow descendant templates to inherit the header**
- **Inherit headers from the templates of ancestor documents**

The header inheritance follows the page nesting settings — pages can only inherit head content from the ancestor pages where they are nested. Pages that do not use nesting cannot inherit head content.

## Inheriting the page template of the parent document

One way to display content from parent documents is to inherit the entire [page template](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/creating-portal-engine-page-templates.md). Documents with an inherited template are mostly identical to the parent, but you can modify them in the following ways:

- Set different content inside the document's editable web parts (**Editable text** and **Editable image**)
- Use web parts that display different content based on the document's type and location in the content tree (path)
- Hide web parts on subpages
- Add web parts that appear only on particular document types

A typical scenario where you can use page template inheritance is a page document with multiple non-page child documents. By inheriting the template, users can create the child documents without worrying about the page design. You can use one of the document viewer web parts to dynamically display a list of child documents on the parent page and detailed information when viewing specific child documents.

You can create [new pages](https://docs.kentico.com/k8/managing-website-content/working-with-documents-and-pages/creating-new-documents-and-pages.md) with an inherited template by choosing the **Use parent page template** option in the template selection dialog. Non-page document types automatically inherit the template of the parent page by default.

To configure an existing document to inherit the parent document's template:

1. In the **Pages** application, select the document content tree.
2. Open the **Properties -> Template** tab.
3. Select **Inherit from parent** in the **Template** section.
4. Click **Save**.

The child document uses the same page template as the parent. Any changes that you make to the page template's [layout](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/editing-page-layouts.md) or [web part configuration](https://docs.kentico.com/k8/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md) affect both the parent page and all documents that inherit the template.

> **Tip:** **Tip**: The page template inheritance can continue throughout the content tree — documents may inherit from parent documents that already use an inherited template (_Parent -> Child -> Descendants..._).

## Hiding web parts on subpages

You can disable content inheritance for individual instances of web parts. This allows you to add web parts to pages without affecting the design of subpages that inherit content. Applies to both types of content inheritance — [page nesting](#using-page-nesting) and documents with [inherited templates](#inheriting-the-page-template-of-the-parent-document).

1. In the **Pages** application, open the **Design** tab of the document containing the web part.
2. **Configure** the web part (double-click).
3. Expand the **Visibility** property category.
4. Check **Hide on subpages**.
5. Click **OK**.

Users now cannot see the web part on sub-documents in the content tree.

> **Tip:** **Example**
>
> You can find an example on the **News** page on the sample Corporate site. The page hides the _Header text_, _Description text_, _News filter_ and _Universal pager_ web parts on child pages. As a result, the text sections are only visible on the list of news items — not on the detail pages of individual news items, which inherit the page template from the parent News document.

## Making web parts visible only for specific document types

You can configure web part instances to appear only on specific [types of documents](https://docs.kentico.com/k8/developing-websites/defining-website-data-structure/document-types.md). This allows you to set up different content inheritance for different document types (applies to both [page nesting](#using-page-nesting) and documents with [inherited templates](#inheriting-the-page-template-of-the-parent-document)). You can also use this features for documents that simply share page templates, without any kind of inheritance.

1. In the **Pages** application, open the **Design** tab of the document containing the web part.
2. **Configure** the web part (double-click).
3. Expand the **Visibility** property category.
4. Click **Select** next to the **Show for document types** property.
5. Choose the allowed document types.
6. Click **OK** in both dialogs.

The web part is now only visible when viewing documents of the selected types.

> **Tip:** **Example**
>
> You can find an example on the **/Community/Blogs/Andrew-Jones-Blog** page on the sample Corporate site. The page displays the _Header text_, _Description text_ and _Blogs filter_ web parts only on _CMS.Blog_ and _CMS.BlogMonth_ documents. The web parts are hidden when viewing individual _CMS.BlogPost_ documents, which inherit the template.

## Sample inheritance scenario

The following example shows how the system processes a request for a nested product page: _**/Products/Notebooks/Dell-XPS-15z**_

This sample scenario demonstrates content inheritance through both page nesting (_Page placeholder_ web parts) and page template sharing. The portal engine loads the templates in the following order:

#### 1. / (root)

_**Website master template**_

![](https://docs.kentico.com/docsassets/k8/inheriting-portal-engine-page-content/2.png)

#### 2. /Products

_**Products page template**_

![](https://docs.kentico.com/docsassets/k8/inheriting-portal-engine-page-content/29.png)

#### 3. /Products/Notebooks

_**Laptops page template**_

![](https://docs.kentico.com/docsassets/k8/inheriting-portal-engine-page-content/0.png)

#### 4. /Products/Notebooks/Dell-XPS-15z

_**Laptops page template** - inherits the page template from the parent page._

![](https://docs.kentico.com/docsassets/k8/inheriting-portal-engine-page-content/9.png)

> **Info:** **Note**
>
> The document viewer web part (e.g. **Repeater**) automatically displays the detail of the selected product instead of the product list.
>
> See [Loading and displaying data on websites](https://docs.kentico.com/k8/developing-websites/loading-and-displaying-data-on-websites.md) for more information.
