misuzu/templates/_layout/meta.twig

49 lines
1.7 KiB
Twig
Raw Normal View History

2022-09-13 13:14:49 +00:00
{% apply spaceless %}
2023-09-08 20:40:48 +00:00
{% set description = description|default(globals.site_info.description) %}
2022-09-13 13:14:49 +00:00
{% if title is defined %}
2023-09-08 20:40:48 +00:00
{% set browser_title = title ~ ' :: ' ~ globals.site_info.name %}
2022-09-13 13:14:49 +00:00
{% else %}
2023-09-08 20:40:48 +00:00
{% set browser_title = globals.site_info.name %}
2022-09-13 13:14:49 +00:00
{% endif %}
2024-01-30 23:47:02 +00:00
<title>{{ browser_title }}</title>
2022-09-13 13:14:49 +00:00
2024-01-30 23:47:02 +00:00
<meta property="og:title" content="{{ title|default(globals.site_info.name) }}">
<meta property="og:site_name" content="{{ globals.site_info.name }}">
2022-09-13 13:14:49 +00:00
{% if description|length > 0 %}
<meta name="description" content="{{ description }}">
<meta property="og:description" content="{{ description }}">
{% endif %}
2024-01-30 23:47:02 +00:00
<meta property="og:type" content="object">
2022-09-13 13:14:49 +00:00
{% if image is defined %}
{% if image|slice(0, 1) == '/' %}
2023-09-08 20:40:48 +00:00
{% set image = globals.site_info.hasURL ? (globals.site_info.url ~ image) : '' %}
2022-09-13 13:14:49 +00:00
{% endif %}
{% if image|length > 0 %}
<meta property="og:image" content="{{ image }}">
{% endif %}
{% endif %}
{% if canonical_url is defined %}
{% if canonical_url|slice(0, 1) == '/' %}
2023-09-08 20:40:48 +00:00
{% set canonical_url = globals.site_info.hasURL ? (globals.site_info.url ~ canonical_url) : '' %}
2022-09-13 13:14:49 +00:00
{% 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 %}