> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://help.metalocator.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Template Synchronization

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](https://www.metalocator.com/add-ons/) 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:

[![](https://storage.crisp.chat/users/helpdesk/website/-/4/d/8/d/4d8d1de78aa37000/6a3c2879-50b1-4a9c-b65e-9c9971_19mpant.png)](https://downloads.intercomcdn.com/i/o/yn1vvwtq/1849622412/dc5fa219f78dae1ecc2076143018/image.png?expires=1794513600&signature=670a1e954afed07cbeae79d116bf6a7ae0a32d0d2ae220963c7580cb2667c5b6&req=dSgjH898n4VeW%2FMW1HO4zek4EsPAVy5N8foJRqr3sRQe7yVEiMdEeY70al5X%0AtepZyR4TwKFLs1NsLvc%3D%0A)

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:

[![](https://storage.crisp.chat/users/helpdesk/website/-/a/f/4/3/af43f16ad4f8c000/7e8bd00f-189b-4a0c-96ea-3cfcdb_1geesqj.png)](https://downloads.intercomcdn.com/i/o/378649509/154c812c46a2358a38121c48/image.png?expires=1794513600&signature=b7508d979cca1ad1149f3045d440fea5533216202c46596beaf99c43140116d6&req=dycvEM13mIFWFb4f3HP0gPUcEGDV3883o0hmEwolhFPjI7YUO599Nk9DkBf2%0A6Z7Oi4UKTkjnKHkNjw%3D%3D%0A)

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:

[![](https://storage.crisp.chat/users/helpdesk/website/-/c/f/f/4/cff4d3140b078800/135ef826-f85f-4d14-9874-338959_azvvi3.png)](https://downloads.intercomcdn.com/i/o/378655299/a16b05be6fddc0ba46483aca/image.png?expires=1794513600&signature=a5e198e8adfdd2577e29c449e205eba14882ba1e52bcff9aa439fc10a910f98f&req=dycvEMx7n4hWFb4f3HP0gPGa4UYSpszW4KqwDVh8IeWk2OQzmKXGVi3buQHU%0Ai6zcMnsyTlmBjH8i1Q%3D%3D%0A)

## 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](https://support.metalocator.com/en/articles/4147425-seo-page-templates).