{# handle meta in templates #}
{% macro meta(page, site) %}
{% if (page.meta) %}
{% set hasCannocial = false %}
{% for key, content in page.meta %}
{# check for index in robots if set page has canonical #}
{% if (key === 'robots' and content.indexOf('index') !== -1 and content.indexOf('noindex') === -1) %}
{% set hasCannocial = true %}
{% endif %}
{% endfor %}
{# check if page has canonical #}
{% if (hasCannocial) %}
{% set http = 'http' %}
{% if (site.https) %}
{% set http = site.https %}
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}