Page master template

From The Smartest Wiki
Jump to: navigation, search

A page master template is a template that contains the essential elements of a page, that do not normally change from one page to another. This usually includes the HTML<head> and any metadata placed there, the opening and closing <body> tags, as well as aspects of a page such as global navigation, masthead, search box, footer, copyright notice, and analytics tags.

Example

A typical (but bare) page master template might look like this:

<!DOCTYPE html>

<html>

  <head>
     <title><?sm:$this.page.formatted_title:?></title>
     <meta charset="UTF-8" />
     <meta name="keywords" content="<?sm:$this.page.meta_keywords:?>" />
     <meta name="description" content="<?sm:$this.page.meta_description:?>" />
     <?sm:stylesheet file="global_style.css":?><!--This stylesheet will always be included on the page-->
     <?sm:placeholder name="page_specific_javascript" editbutton="false":?>
     <?sm:placeholder name="page_specific_stylesheet":?><!--The stylesheet included here can be different from page to page-->
  </head>

  <body>
    <?sm:container name="page_layout":?><!--A container template will be included here-->
  </body>

</html>

Note the container tag, to allow web pages using this page master template to have different layouts. Most containers probably have some effect on page layout, but on each website one container can be nominated as the website's primary container, meaning that its role in determining the overall layout of pages can be stored in the system, and the container can be presented to the user as page layout.