You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
981 B
29 lines
981 B
2 years ago
|
{# handle meta in templates #}
|
||
|
|
||
|
{% macro meta(page, site) %}
|
||
2 years ago
|
{% if (page.meta) %}
|
||
2 years ago
|
|
||
|
{% set hasCannocial = false %}
|
||
|
|
||
2 years ago
|
{% for key, content in page.meta %}
|
||
|
<meta name="{{ key }}" content="{{ content }}" />
|
||
2 years ago
|
|
||
|
{# 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 %}
|
||
2 years ago
|
{% endfor %}
|
||
2 years ago
|
|
||
|
{# check if page has canonical #}
|
||
|
{% if (hasCannocial) %}
|
||
|
{% set http = 'http' %}
|
||
|
|
||
|
{% if (site.https) %}
|
||
|
{% set http = site.https %}
|
||
|
{% endif %}
|
||
|
|
||
|
<link href="{{ http }}://{{ site.domain }}{{ page.path }}" rel="canonical">
|
||
|
<link rel="alternate" href="{{ http }}://{{ site.domain }}{{ page.path }}" hreflang="{{ site.language }}">
|
||
|
{% endif %}
|
||
2 years ago
|
{% endif %}
|
||
|
{% endmacro %}
|