Documentation Center

Step 4: Enhancing the Page Template (optional)

You now already have a working Page Template, but you can optimize it by removing the remaining hardcoded material, such as the title, meta description, the keywords, navigation and footer.

About this task

This task does not explain how to create dynamic navigation. This is left as an exercise to the reader.

Procedure

  1. In Content Manager Explorer, navigate to the Folder Building Blocks\System\Template Building Blocks\Design\ and open the Template Building Block called "Page Template Design" in this location.
  2. In the dialog that opens, select the Source tab.
  3. To make the Web page title dynamic, find the <title> tag and replace its contents with @@Page.Title@@. This makes the Page Template render whatever title is specified for the Page you happen to be rendering.
  4. To make your navigation dynamic, do the following:
    1. Create a dynamic navigation. To do this, you either need to create a Template Building Block that creates such navigation, and then include it in the Page Template, or use server-side technology such as ASP.NET Site Navigation controls (for more information, refer to this link: http://msdn.microsoft.com/en-us/library/e468hxky(v=vs.100).aspx.
    2. Find the <nav> tag and replace its contents with an item representing the navigation you created yourself, say, @@navigation@@, to remove the hardcoded navigation.
  5. To make the footer dynamic, do the following:
    1. Create a Component (and if necessary a Schema for that Component) that represents the contents of your footer. Note its Content Manager URI (a unique identifier found on the Info tab of the Component dialog).
    2. Create a Component Template that renders the footer. If you make this Component Template dynamic, you can update the footer without having to republish all the Web pages that contain the footer. Note its Content Manager URI as well.
    3. In your Page Template, find the <footer> tag and replace it with the following:
      @@RenderComponentPresentation("tcm:1-2", "tcm:1-3-32")@@
    4. Replace the first string with the Content Manager URI of the Component you created, and the second string with the Content Manager URI of the Component Template.
  6. To make the meta description and keywords dynamic, do the following:
    1. Create a Metadata Schema with two text fields, "description" and "keywords".
    2. Select this Metadata Schema as the Metadata Schema in each of your Pages.
    3. Replace the contents of the <meta name="description"> tag with @@Page.MetaData.description@@.
    4. Replace the contents of the <meta name="keywords"> tag with @@Page.MetaData.keywords@@.