misuzu/views/mio/_layout/meta.twig

60 lines
2.1 KiB
Twig
Raw Normal View History

2018-04-14 02:58:53 +00:00
{% spaceless %}
{% set description = description|default(globals.site_description) %}
{% set site_twitter = site_twitter|default(globals.site_twitter) %}
{% if title is defined %}
{% set title = title ~ ' :: ' ~ globals.site_name %}
{% else %}
{% set title = globals.site_name %}
{% endif %}
2018-03-22 02:56:41 +00:00
<title>{{ title }}</title>
2018-04-14 02:58:53 +00:00
<meta name="twitter:title" content="{{ title|slice(0, 70) }}">
2018-03-22 02:56:41 +00:00
<meta property="og:title" content="{{ title }}">
2018-04-14 02:58:53 +00:00
<meta property="og:site_name" content="{{ globals.site_name }}">
2018-03-22 02:56:41 +00:00
2018-04-14 02:58:53 +00:00
{% if description|length > 0 %}
2018-03-22 02:56:41 +00:00
<meta name="description" content="{{ description }}">
<meta name="twitter:description" content="{{ description }}">
<meta property="og:description" content="{{ description }}">
2018-04-14 02:58:53 +00:00
{% endif %}
2018-03-22 02:56:41 +00:00
2018-04-14 02:58:53 +00:00
{% if site_twitter|length > 0 %}
<meta name="twitter:site" content="{{ site_twitter }}">
{% endif %}
2018-03-22 02:56:41 +00:00
<meta property="og:type" content="object">
2018-04-14 02:58:53 +00:00
<meta name="twitter:card" content="summary">
{% if image is defined %}
{% if image|slice(0, 1) == '/' %}
{% if globals.site_url is not defined or globals.site_url|length < 1 %}
{% set image = '' %}
{% else %}
{% set image = globals.site_url|trim('/') ~ image %}
{% endif %}
{% endif %}
{% if image|length > 0 %}
<meta name="twitter:image:src" content="{{ image }}">
<meta property="og:image" content="{{ image }}">
{% endif %}
{% endif %}
{% if canonical_url is defined %}
{% if canonical_url|slice(0, 1) == '/' %}
{% if globals.site_url is not defined or globals.site_url|length < 1 %}
{% set canonical_url = '' %}
{% else %}
{% set canonical_url = globals.site_url|trim('/') ~ canonical_url %}
{% endif %}
{% endif %}
2018-03-22 02:56:41 +00:00
2018-04-14 02:58:53 +00:00
{% if canonical_url|length > 0 %}
<link rel="canonical" href="{{ canonical_url }}">
<link rel="og:url" href="{{ canonical_url }}">
{% endif %}
{% endif %}
{% endspaceless %}