For search engine optimization there is a handy way to use the built-in Page Properties macro to define SEO data and output it in a template.

This recipe describes how to do that.

Create Page Properties on a Page

Edit the page and create a page properties macro and create the SEO properties (checkout the official documentation for more info how to create properties).

For example:

Add the Content Properties

In your custom template (Creating a template) access the page properties with the $pageProperty placeholder like this:

include-htmlhead.vm

:
<title>$pageProperty.from("seo.pagetitle")</title>
<meta name="description" content="$pageProperty.from("seo.description")">
:
CODE

If you are using the default WebHelp theme, you can add SEO to it with the steps below:

  1. Download the source of the WebHelp theme from our Bitbucket: 
  2. Unzip the archive, navigate to /src/main/resources/com/k15t/scroll/scroll-webhelp-theme/scroll-html/include
  3. Open include-htmlhead.vm with a text editor and add the code above
  4. Save the file
  5. Continue from "Installing the new Plugin" section on the page: Creating a template
  6. Upload the template to Confluence as a regular add-on

Pro Tipp: Hide Page Properties

By default the page properties will be visible to everyone, usually you want to avoid that.

To do so:

Let the page properties macro hide the properties, which will hide the page properties. Drawback of this approach is that you can only see the properties in the Confluence editor.