Adding a Custom Page - Documentation topics on: adding an html page,customized web page,custom pages,howto,tutorials,.

This documentation is a static copy for this version. For current documentation, see:

Adding a Custom Page

The dotCMS starter site downloads with a default "Page Asset" Content Type that has all the basic required system fields to create a Page in dotCMS.  However, if a Custom Page Content Type is desired, it should first be created using the Content Type Manager, additional custom attributes should be added to the new Page Content Type, and then custom pages can be created.  

The dotCMS starter site also downloads with an example Custom Page Content Type called "Simple Content Page" which adds some custom behavior to pages created using this Page Content Type.  

The "Simple Content Page" has one additional WYSIWYG field called "Content".  The dotCMS starter site themes have been modified to automatically test for whether this "Content" field and, if set, displays the "Content" field data at the top of the body section of the Page, automatically, the moment the Page is published.  The documentation below shows how to add a "Simple Content Page" and the customized behavior, however, this is only a small example of the many Custom Page Content Types that webmasters can create, if so desired.

Adding a "Simple Content Page"

  1. From the Site Browser tab (Site → Browser), right click a folder or the Site and select +New → Page.

  2. Select the "Simple Content Page" instead of the default "Page Asset"

  3. Add a Page Title, choose a Host or Folder, Url, Cache TTL refresh rate (in seconds), choose a template, check whether the Page should "Show on Menu" in the navigation, then add messaging in the "Content" field that should display at the top of the Body section of the Page.  Next click "Save / Publish".

  4. The customized "Simple Content Page" will display the customized "Content" field, automatically, at the top of the Body section of the Page.  The Page will be locked so that no changes to the content on the page can be made.  To change the Content field on the Page, simply click on "Page Properties".  To add content to one of the Containers being called by the Template, click "Lock for Editing".

  5. After clicking "Lock for Editing" on the Page, any Content Containers being included by the Template will display so they can be used for additional content contribution to the Page.  To unlock the Page, click "Release Lock".

  6. Displaying the "Content" field on Templates automatically, when a Page is saved, is a custom behavior.  To achieve this custom behavior the template.vtl file that is used by all the dotCMS starter themes, was modified to test for the presence of the "Content" field on a Page, and display it at the top of the body area of a Page as long as it has been set.  See the custom code that was added to the Quest theme in the /application/themes/quest/template.vtl file below to allow for this custom behavior.