Skip to main content

Template Synchronization

MetaLocator location pages can synchronize your with your website template

Bryan Nye avatar
Written by Bryan Nye
Updated this week

MetaLocator can extract the template of your Website from the page on which our Interface installation code is installed.  Subscribers to our SEO Add-on can pull the template from their Website to automatically adapt landing pages to their Web site.

This is established as a background process which runs on a regular basis to keep the system in sync.

This process works by finding the MetaLocator interface installation code within the page, and pulling the HTML above and below that fragment for the header and footer. In order for this to work, the fragment must be added to the page *exactly* as provided. We specifically use the HTML comments above and below the code fragment to find the Interface.

To establish the background job, click the process icon in the toolbar and then New. Complete the form as shown below:

  1. itemid is the Interface ID number into which the Website Template will be saved. This is a required field.

  2. url is the full https URL of the publicly-accessible page on your Website that houses the MetaLocator installation code, exactly as provided. This is a required field.

  3. lang is the ID of the MetaLocator language for this template. This should only be provided for multi-language implementations where multiple templates will be configured per language. Available language codes for the account can be found under Languages. E.g. en-US (1) or fr-CA (2)

  4. overwrite Specify overwrite as 1 to automatically insert the required code into the head and title tags. The overwrite flag directs the Template Synchronization process to replace the values in the Website Template settings with the content obtained from the url. This is the recommended setting. If overwrite is not provided, or set to 0, the system will still update the Website Template settings with the content obtained from the url, but it will leave the head and title tags intact.

Click Save, and then toggle the Published and Scheduled switches to enable the job.

Finally, force the job to run immediately as shown below:

After the job completes, the content of the page provided in the URL will be added to the Website Template setting as shown under the Location Pages tab:

Title Tag

The following example markup shows the dynamic assembly of a title tag for both the directory pages and the location pages. Notice the condition by page_type allowing for configuration of the title and directory pages individusally

{% if template_item.page_type == 'location' %}
{{template_item.location.name}} in {{template_item.location.city}},{{template_item.location.state}}
{% else %}
All Locations {% if template_item.root == false %} in {{template_item.data[template_item.current_value].label}} {% endif %}
{% endif %}

The title tag will be inserted automatically when overwrite is set to 1. To customize the format of the page title, update the template in the SEO Page Title Tag Template setting. The title is also used to set the Open Graph title tag.

Meta Description Tag

The following example markup shows the dynamic assembly of a meta description tag for both the directory pages and the location pages.

{% if template_item.page_type == 'location' %}
{{template_item.location.name}} in {{template_item.location.city}},{{template_item.location.state}}
{% else %}
All Locations {% if template_item.root == false %} in {{template_item.data[template_item.current_value].label}} {% endif %}
{% endif %}

This tag will be inserted automatically when overwrite is set to 1. To customize the format of the page title, update the template in the SEO Page Meta Description Tag Template setting. The meta description is also used to set the Open Graph description tag.

Head Tag

When overwrite is set to 1, head and title tags will be inserted automatically. The values of the head and title tags are taken from SEO Page Head Tag Template and SEO Page Title Tag Template settings, found under the Location Pages tab.

 <!-- START: MetaLocator head tags -->
{{template_item.canonical|raw}} {{template_item.localschema|raw}} {% for meta in template_item.meta %} {{ meta|raw }} {% endfor %} {% for stylesheets in template_item.stylesheets %} {{ stylesheets|raw }} {% endfor %} {% for scripts in template_item.scripts %} {{ scripts|raw }} {% endfor %} {% for href_lang in template_item.href_langs %} {{ href_lang|raw }} {% endfor %}
<!-- END: MetaLocator head tags -->

The head tag brings in all MetaLocator required CSS and JavaScript, including CSS from the CSS setting found under Style & Color settings in the Interface Builder.

Page Body

The Interface Installation code will be replaced with this statement automatically:

{{ include(template_from_string(template_item.twig_page_template)) }}

The above placeholder will be replaced by content generated from the SEO Page Template.

Did this answer your question?