Master pages

Note: Master pages replace templates in RoboHelp HTML 7 and earlier.

An HTML page is made up of three elements: content, layout, and styling. For single sourcing, the best practice is to separate content from styling and layout. Although CSS files help to separate styling from the content, layout remains embedded in the HTML code. By using master pages, you can separate layout and styling from the content. A master page contains the layout information and is associated with a CSS file.

A master page is a template for HTML topics. You define the placement of headers, footers, and placeholders for the body, breadcrumbs, and mini TOC. Master pages can include snippets and user-defined variables. You can create a topic using a master page or associate an existing topic with a master page. When you create a topic using a master page, the body content is placed in the resulting topic. If you apply a master page to an existing topic, the body content is ignored.

The layout information defined in the master pages is not visible in Design view. However, you do see the CSS of the master page in Design view. You can see the layout when you generate output or a preview. The topic content is placed in the body placeholder, and the layout is inherited from the master page. All placeholders defined in the master page are also populated with relevant information when you generate output.

You can use tables to create a precise layout where each placeholder is placed in a table cell.

Body placeholder
When you create a topic from a master page, the topic includes content from the master page. Copyright information is an example. When you apply a master page to a topic, actual content of the topic replaces the body placeholder at the time of preview and generation.
Note: When you apply a master page to a topic, the header and footer of the topic are overridden by those of master pages.

Mini TOC placeholder
Shows the automatically generated mini TOC at the time of generation or preview of Help topic. Define the exact location and format of the mini TOC by designing the layout of the master page. By default, the levels allowed for a TOC layout are heading 2 to heading 6.

Breadcrumbs placeholder
Shows the automatically generated breadcrumbs at the time of generation of Help topic. The breadcrumbs are generated based on the TOC. When you preview a topic, actual breadcrumbs links are not generated and only the layout of breadcrumbs is visible.

You can apply conditional build tags to the mini TOC and breadcrumbs placeholders but not to the body placeholder. However, you can apply a conditional build tag to the content inside or outside the body placeholder.

Create a master page

  1. Do one of the following:

    • Select File > New > Master Page.

    • Select and right-click Master Pages in the Project Set-up pod.

  2. Select New Master Page.

  3. Enter a name for the new master page in the General tab.

    Note: Master pages have the filename extension .htt.
  4. Click the Appearance tab.

  5. Select a style sheet to apply to the master page.

  6. (Optional) Select the Background Sound options.

  7. Click OK.

A new master page shows the body placeholder by default. You can insert mini TOCs by clicking the Mini TOC icon and breadcrumb placeholders by clicking the Breadcrumbs icon from the toolbar in the Design editor of master pages. But this toolbar does not appear for normal pages. You can insert any number of mini TOCs or breadcrumbs at any location in the master page.

Create a master page from a topic

  1. Open a topic.

  2. Do one of the following:

    • Right-click in the Design Editor and select Add To > Master Pages.

    • Select File > Add To Master Pages

All the content in the topic is wrapped in the body placeholder. After you add a topic to a master page, any new topic created from this master page includes its body placeholder content.

When topics are associated with a master page, the style sheet, header, and footer of the master page override style properties of the topic. You can edit or change the CSS of a topic later.

Note: Use the Topic Properties option to change the master page associated with a topic.

Formatting master pages

When you generate or preview a layout, border and shading properties of the master pages override border and shading properties of topics. If the properties do not conflict, they are applied independently. For example, if you set border properties for a master page, and background color for a topic, the final output topic has both applied to it.

Edit a master page

  1. Do one of the following:

    • Right-click a master page in the Project Set-up pod and select Edit.

    • Select a master page in the Project Set-up pod and select Edit > Edit [name of the master page].htt.

    • Double click a Master Page in the Project Set-up pod.

  2. Make the desired changes.

Change the CSS associated with a master page

  1. Right-click in a master page and select Properties.

  2. Click the Appearance tab.

  3. Select a style sheet from the list of style sheets available in a project.

  4. Click OK.

Note: Select the Used In tab in the Master Page Properties dialog box to see a report of the topics associated with the master page.

Insert a placeholder

You can insert placeholders for mini TOCs, breadcrumbs, and topics in master pages. By default, a body placeholder is inserted in a new master page.

  1. Place the cursor below or after the body placeholder.

  2. Select Insert > Placeholder > Mini TOC or Breadcrumbs.

Note: You cannot insert a placeholder inside a paragraph as inline text or in headers or footers.

Format and edit placeholders

You can format styles in placeholders using the Format Placeholders option from the context menu. Open a master page in Design view and do one of the following:

  • Right-click a placeholder. Select Format Placeholder.

  • Select a placeholder and click the Format Placeholder button  in the Design Editor toolbar.

  • Double-click in the placeholder.

  • Select Format > Placeholder.

Notes:

  • If a body placeholder is deleted from the master page or does not appear, the resultant topic has its headers appear first (if at all), followed by the HTML content of the master page, the topic content, and the footer (if present).

  • You cannot apply DHTML effects on the placeholders. The content inside the body placeholder is normal HTML content, so you can apply DHTML effects to it.

  • You can preview the master pages to see how the placeholder content is displayed in the final output. If the associated master page has mini TOC and breadcrumbs placeholders, the mini TOC and breadcrumbs are generated at the time of preview or layout generation.

Importing master pages

You can import master pages from other projects and apply them to topics in your current project. When you upgrade from RoboHelp 7 or earlier, topic templates convert to master pages when you import them. Except for the header and footer, all the content in the topic template is wrapped in the body placeholder.

Applying master pages

You can apply or change the master page to one or multiple topics at a time. Use this option to change the master page of one or more, but not all topics in your project. You can apply the master page to all topics when you generate the Help output.

Apply a master page to a topic

  1. From the Topic List, right-click the topic, and select Properties.

  2. In the Topic Properties dialog box, select the General tab.

  3. All the master pages in a project are listed in the Master Page menu. Select a master page and click OK. Optionally, you can do the following:
    • To preview the selected master page, click the Preview icon.

    • To select a master page that is not in the current project, click the Browse button.

Apply a master page to multiple topics

  1. In the topic list, sort the topics by the master page associated with them.

    Note: If the Master Page column is not visible, right-click a column header, and select Master Page from the menu.
  2. Select the topics that are associated with the master page that you want to substitute. If you are applying master pages for the first time, select the topics that are not associated with a master page. You can also select multiple sets of topics with different master pages applied to them.

  3. Right-click, and select Properties.

  4. In the Topic Properties dialog box, select General tab.

  5. Select the master page from the Master Page menu, and click OK.

Applying a master page or CSS at the time of generation

Single-source layouts let you override the master page or the CSS when you generate output. For different output results, apply different master pages or a different CSS.

Each single-source layout except the Printed Documentation layout provides an option to apply master pages or CSS. You can choose to apply a master page or a CSS across all the topics in a project.
Note: For the Printed Documentation layout, you can apply only a different CSS.

To apply to all topics, select Apply To All Topics and choose either a master page or a CSS. The Master Pages and CSS menus show all the master pages and CSS available in the project.

  • If you do not select the Apply To All Topics option, the master pages associated with individual topics take effect. If no master pages are associated with individual topics, RoboHelp applies no master pages when it generates output.

  • If you choose to apply a master page, master pages associated with individual topics are overridden. The CSS associated with the master page becomes effective and overrides the CSS associated with all other individual topics.

  • If you choose to apply a CSS, master pages associated with individual topics take effect. The selected CSS is applied to all the topics whether any master page is associated with them or not.

  • If a master page is not associated with any CSS, the CSS associated with each individual topic becomes effective.