Metadata (Title, Description & Keywords)

How to manage the Meta Data in Aurora and get it working in Aurora's Front-end Templates is a common issue, and this article sets out to help you understand how this data is managed in Aurora and how to apply it to your templates.

🚧

If you are finding your Meta Titles are not correct or not being reflected accurately, e.g. on setting the "Meta Title" value for a Product Category it is not being shown on the Front-end, it is most likely that your templates are not set-up correctly and this article should be able to help you with this.

Overview

❗️

Please consider if you need to be setting Meta Titles in the Front-end Templates at all. If you do so, then any logic in place throughout Aurora to configure this for you will be lost as your overrides will take precedence.

For example, if you use the example below to set your Meta Titles to be generated from the Breadcrumbs, then setting the Meta Title values against a specific Category will have no effect at all on the site.

🚧

This is the single most common cause of Metadata issues when something that should work appears not to be working.

Please always check your Front-end Templates are not modifying your Metadata (Title, etc) before raising any such problem as a bug as it may simply be a matter of removing the code from your templates to allow Aurora to manage the data once more.

Where to manage the Meta Tags

Meta tags are managed from all over Aurora, from Products and their Categories to Filters and Blog Posts. All of these sections make use of their own set of Metadata values that can be configured for use on the Front-end.

Aurora makes an effort to select the most relevant Meta Data wherever it can, but this does not always result in the desired result, particularly when there are some specific requirements in place for said titles.

This being said, it is ultimately the Front-end Templates that have the power to decide what should be shown and when, whether that's the default Meta Data selected by Aurora or some other combination of values.

Which templates manage the Meta Tags

Ultimately the Meta Data is displayed via the "_includes/header.tpl.html" template.

This template normally just outputs the contents of the configured variables however, and so to ensure each section of your site is using the correct values, it will be necessary to:

  1. Understand how these values are often manipulated by templates.
  2. Find the right template to edit the Metadata logic in.

Managing Metadata in Templates

While it is the header template that displays the Meta Data values, the content of these values can depend on a wide range of things, from product Details to Categories and Filters.

It is not advised to add logic to the header template itself to account for all these possibilities, but rather to add logic to each of the separate templates that then include the header template instead.

This can be done as follows.

{assign var="metaTitle" value="Some Meta Title"}
{include file="_includes/header.tpl.html"}

Most templates include the header template at the top of the file and so to customise the Meta Title (the same principle is true of all Meta Tag Data) all you must do is assign the "meta Title" variable a new value before you include the header template.

If you do not do this, then Aurora will use whatever Meta Title it feels is most appropriate, whether that's an Auto-generated one or some configured value for a Product or its Category.

👍

You can use any data available to you on the page in which the template is used to generate your Meta Titles, but it is always worth simply outputting what Aurora sets by default first to see if it is acceptable as this often takes into account a great many things for you and is normally fully customisable via the Back-end.

Tags based on Filters

Sometimes you may wish to set meta data depending on the presence of filters from the Sidebar, like NoIndex or Canonical Links. You can do this using the "$header_filters" array, as described in the Sidebar Navigation Filter Data section.

The following example simply searches for the presence of the "si" (Size) filter and sets a NoIndex tag if it is found.

{if $headerFilters}
   {if $headerFilters.br}
 <META NAME="ROBOTS" CONTENT="NOINDEX, FOLLOW">
   {/if}
{/if}

Metadata Examples

This section simply provides a selection of example methods by which the Meta Title has been generated in the past for various sections of the site. None of them need to be considered 'the standard' and are provided for reference only in an effort to illustrate how it can be done.

🚧

The 'standard' behaviour is not to manage the Meta data in any of the Front-end Templates at all and to simply allow Aurora to set whatever data it sees fit based on the settings applied in the Back-end.

Meta Title from Breadcrumbs

{assign var="metaTitle" value=""}
{foreach from = $breadcrumbs item=breadcrumb name="breadcrumbs"}
  {assign var="breadcrumb_name" value=$breadcrumb.name}
  {if $smarty.foreach.breadcrumbs.first}
    {assign var="metaTitle" value=$breadcrumb.name}
  {else}
    {assign var="metaTitle" value="$metaTitle | $breadcrumb_name"}
  {/if}
{/foreach}
{include file="_includes/header.tpl.html"}

Meta Title from Category Name

The below simply illustrates how one might force the Meta Title to be the category name prefixed with some static string (The static string could of course be removed).

products/index.tpl.html

{capture assign="metaTitle"}Currently viewing - {$category_info.category_name}{/capture}
{include file="_includes/header.tpl.html"}