Updating page templates

Adding multiple templates to your theme

Tom Cook
Tom Cook

By default, there is one page template each for article, section, and category in a theme. You can create up to ten additional page templates each for articles, sections, and categories.

This means that you can create alternate versions of templates to use for your articles, sections, and categories. You can apply or change the page template when you create or edit an article, section, or category.

You must have Guide Enterprise and you must be a Guide Manager to create multiple templates.

Adding multiple templates using the theme editor

You can create additional page templates for articles, sections, and categories using the theme editor in Guide. If you prefer working on your themes locally, you can also add templates to your exported themes.

To add an article, section, or category template using the theme editor

  1. In Guide, click the Customize design icon (Customize icon) in the sidebar.

    Your themes appear on the Themes page.

  2. Hover your mouse over the theme you want to edit, then click View theme.
  3. Click Edit Code.

    Edit code

  4. Scroll to the bottom of your templates list, then click Add new template.

    Add new template

  5. Under Template for, select the type of template you’d like to create.

    You can create article, section, and category templates only. You can create up ten additional templates for each type.

    Add a template

    Add a new template
  6. Enter a Template name.
  7. Under Start from, select an existing template to copy and use as a starting point.

    You can select blank template if you don’t want to start from another template.

  8. Click Create template.

    The new template opens for you.

  9. Edit your template and click Save as you go.
  10. To preview your template, click Preview, then click Templates at the top of the preview and select the template you want to preview.

    View templates

    Preview a template

    For more information, see Previewing your theme while editing theme code.

When you are ready, you can apply your template to a new article or new category or section. You can also change the template on an existing article, section, or category.

Adding multiple templates in exported themes

If you export and work on themes locally, you can add multiple templates to the themes. The workflow consists of creating a predefined folder in a theme’s templates folder, then adding .hbs template files to the folder.

To learn more about working on themes locally, see Working on a theme locally.

To add a template to an exported theme

  1. Depending on the type of template you want to add (article, section, or category), create any of the following folders in the templates folder of the exported theme:

    • article_pages
    • section_pages
    • category_pages

    As in the Guide theme editor, you can only create article, section, and category templates.

  2. Add an .hbs template file in the new folder.

    You can name the file anything you want. The name must be 25 characters or less, and snake_case.

    article_pages_folder

    To save time, copy an existing .hbs file into the folder to use as a starting point for the new template.

  3. Edit and save the template.
  4. If you need to add more templates of the same type, add them to the same folder.
  5. When you’re done, zip the theme and import it into Guide.

Use Guide to preview the new template.

When you are ready, you can apply your template to a new article or new category or section. You can also change the template on an existing article, section, or category.

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.