---
title: Creating portal engine master pages
related:
  - https://docs.kentico.com/k10/developing-websites/developing-websites-using-the-portal-engine/inheriting-portal-engine-page-content.md
  - https://docs.kentico.com/k10/developing-websites/developing-websites-using-the-portal-engine/creating-portal-engine-page-templates.md
---

> 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).

Master pages allow you to share content across all pages on the website without having to add it separately to every [page template](https://docs.kentico.com/k10/developing-websites/developing-websites-using-the-portal-engine/creating-portal-engine-page-templates.md). By using master pages, you can manage repeated elements, such as the site logo, main navigation menu, and footer content in a single location.

The following figure shows two pages that are nested inside the same master page. The system combines the content of individual pages and the master page, and displays the result as a single page.

![Master page concept](https://docs.kentico.com/docsassets/k10/creating-portal-engine-master-pages/master_page_concept.png "Master page concept")

Websites can have multiple master pages:

- The root page of the content tree is _always_ a master page.
- You can create additional master pages within the structure of your website by assigning _master page templates_ to pages.

To designate a page template as a master page, enable the **Master page** option on the **General** tab of the [page template editing interface](https://docs.kentico.com/k10/developing-websites/managing-page-templates.md).

> **Note:** **Important**
>
> Master pages do _**not**_ automatically ensure content inheritance. They are only a tool that helps organize your website and can make it easier to set up page nesting. Portal engine pages can inherit content even without master pages.
>
> See [Inheriting portal engine page content](https://docs.kentico.com/k10/developing-websites/developing-websites-using-the-portal-engine/inheriting-portal-engine-page-content.md) to learn how to implement the actual inheritance.

## Editing master pages

You can edit the [web parts](https://docs.kentico.com/k10/developing-websites/developing-websites-using-the-portal-engine/using-and-configuring-web-parts.md) and [page layout](https://docs.kentico.com/k10/developing-websites/developing-websites-using-the-portal-engine/editing-page-layouts.md) of master pages on the **Design** tab, like with any other pages.

> **Note:** **Page placeholder requirement**
>
> Master pages must always contain the **Page placeholder** web part. The page placeholder specifies where child pages are nested inside the master page.

## Adjusting the HTML output of master pages

All master pages have the **Master page** tab available in the **Pages** application. Here you can define sections of the master page's HTML code. The system also adds the code to all pages that are nested within the master page.

- **DOCTYPE** – insert any code that you need to place at the beginning of the page's HTML source, typically the page's DOCTYPE definition.
- **HEAD** – allows you to add HTML code inside the _****_ element of the master page and all nested descendant pages.
- **BODY** – you can specify custom HTML code in two fields:
  - The first field allows you to add custom attributes to the page's _****_ element.
  - The second field allows you to add custom code that will be placed directly after the opening _****_ tag. This can be useful, for example, when you need to enable [Google Tag Manager](https://developers.google.com/tag-manager/quickstart) on your site.
- **Master page layout** – the area between the _****_ tags displays the [layout code](https://docs.kentico.com/k10/developing-websites/developing-websites-using-the-portal-engine/editing-page-layouts.md) of the master page template. To modify the layout code, click _Edit layout_ in the tab header.

![Editing the HTML code of a master page](https://docs.kentico.com/docsassets/k10/creating-portal-engine-master-pages/Master_Page_Edit.png "Editing the HTML code of a master page")

> **Info:** **Note**: The code on the master page tab outside of the editable sections is only informative and may not be identical to the actual code rendered for pages.
