Skip to main content
Logo
There is a newer version of Contensis. Click to find out more and download the latest version.

Templates overview

Templates define the layout of a page to be used by editors. There are three types of template: page templates, sub templates and structured content templates. We recommend a nested template approach (i.e. That uses sub templates) and that you have at least a Home template and a Generic template.

If using sub templates, create a sub template folder within your templates folder and place Home and Generic inside the root template folder. These templates will be used by your editors when creating and editing pages in the Contensis page editor.

Sub templates

You can drag a sub template from the Project Explorer panel into an editable region of a web page you are editing. A sub template can be used in two ways:

Reusable code snippets

You can use sub templates as reusable snippets inside of your pages. For example you might want to have an image with a caption left aligned; you could add this in as a sub template to save you time re-creating the object in each page every time you want to use it.

Template partials

You can also use a sub template as a template partial. For example, you could have a header template, footer template and a navigation template (this list isn't exhaustive.) You can use sub templates in any way you like in this context.

Creating templates

Whichever type of template you are creating, a page template or a sub template, the process is the same. There is an extra step when creating sub templates to exclude them from the list of available templates to assign to folders. 

  1. Create a new piece of content in your Templates folder.
  2. Name the template and click Save. Click the button Edit New Template.
  3. You will be presented with a What You See Is What You get (WYSIWYG) editor. If you have HTML to paste into the template you need to click on the source code editor button in the toolbar. It looks like this: <>
  4. When your HTML is in place click Save in the code editor. You then also need to click Save in the WYSIWYG editor.
  5. If your template is a sub template. Click on the Properties tab. Under Template Type check the box with the label This is a sub-template. This will exclude the template from the template list when assigning templates to a folder.

When editing the newly created template, you can assign stylesheets from within the Properties tab. In the case of a sub template the only purpose of the stylesheet assignment is so the sub-template looks right in the Contensis editor, in the case of page templates this is the stylesheets which will be attached to the page when published.

Note: There is no need to include the <head> tag in your templates as Contensis handles this for you. If you are using HTML5, you will need to see: How to use the HTML5 doctype in Contensis.

Excluding template content from search results

There may be occasions when you want to exclude some content from search results (for example, a sidebar menu). To exclude content from indexing it's a simple case of wrapping elements in <contensis:noindex></contensis:noindex> tags. This is covered in more detail in excluding content from search results.