misuzu/templates/_layout/meta.twig

48 lines
1.7 KiB
Twig

{% apply spaceless %}
{% set description = description|default(globals.site_info.description) %}
{% if title is defined %}
{% set browser_title = title ~ ' :: ' ~ globals.site_info.name %}
{% else %}
{% set browser_title = globals.site_info.name %}
{% endif %}
<title>{{ browser_title }}</title>
<meta property="og:title" content="{{ title|default(globals.site_info.name) }}">
<meta property="og:site_name" content="{{ globals.site_info.name }}">
{% if description|length > 0 %}
<meta name="description" content="{{ description }}">
<meta property="og:description" content="{{ description }}">
{% endif %}
<meta property="og:type" content="object">
{% if image is defined %}
{% if image|slice(0, 1) == '/' %}
{% set image = globals.site_info.url is not empty ? (globals.site_info.url ~ image) : '' %}
{% endif %}
{% if image|length > 0 %}
<meta property="og:image" content="{{ image }}">
{% endif %}
{% endif %}
{% if canonical_url is defined %}
{% if canonical_url|slice(0, 1) == '/' %}
{% set canonical_url = globals.site_info.url is not empty ? (globals.site_info.url ~ canonical_url) : '' %}
{% endif %}
{% if canonical_url|length > 0 %}
<link rel="canonical" href="{{ canonical_url }}">
<link rel="og:url" href="{{ canonical_url }}">
{% endif %}
{% endif %}
{% if feeds is defined and feeds is iterable %}
{% for feed in feeds %}
<link rel="alternate" type="application/{{ feed.type }}+xml" title="{{ feed.title|default(feed.type) }}" href="{{ feed.url }}">
{% endfor %}
{% endif %}
{% endapply %}