refactor head tag to use variables
This commit is contained in:
parent
a04d8bb1b6
commit
efe3a22f1f
@ -8,13 +8,16 @@
|
|||||||
<meta name="author" content="{{ site.author }}">
|
<meta name="author" content="{{ site.author }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if page.description %}
|
{%- capture description -%}
|
||||||
<meta name="description" content="{{ page.description }}">
|
{%- if page.description -%}
|
||||||
{% elsif page.subtitle %}
|
{{ page.description }}
|
||||||
<meta name="description" content="{{ page.subtitle }}">
|
{%- elsif page.subtitle -%}
|
||||||
{% elsif site.description %}
|
{{ page.subtitle }}
|
||||||
<meta name="description" content="{{ site.description }}">
|
{%- else -%}
|
||||||
{% endif %}
|
{{ site.description }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endcapture -%}
|
||||||
|
<meta name="description" content="{{ description }}">
|
||||||
|
|
||||||
{% if site.mobile-theme-col %}
|
{% if site.mobile-theme-col %}
|
||||||
<meta name="theme-color" content="{{ site.mobile-theme-col }}">
|
<meta name="theme-color" content="{{ site.mobile-theme-col }}">
|
||||||
@ -42,17 +45,17 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if page.ext-css %}
|
|
||||||
{% for css in page.ext-css %}
|
|
||||||
{% include ext-css.html css=css %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if site.site-css %}
|
{% if site.site-css %}
|
||||||
{% for css in site.site-css %}
|
{% for css in site.site-css %}
|
||||||
<link rel="stylesheet" href="{{ css | relative_url }}">
|
<link rel="stylesheet" href="{{ css | relative_url }}">
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{% if page.ext-css %}
|
||||||
|
{% for css in page.ext-css %}
|
||||||
|
{% include ext-css.html css=css %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if page.css %}
|
{% if page.css %}
|
||||||
{% for css in page.css %}
|
{% for css in page.css %}
|
||||||
@ -60,7 +63,6 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Facebook OpenGraph tags -->
|
|
||||||
{% if site.fb_app_id %}
|
{% if site.fb_app_id %}
|
||||||
<meta property="fb:app_id" content="{{ site.fb_app_id }}">
|
<meta property="fb:app_id" content="{{ site.fb_app_id }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -69,22 +71,49 @@
|
|||||||
<meta property="og:site_name" content="{{ site.title }}">
|
<meta property="og:site_name" content="{{ site.title }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if page.meta-title %}
|
{%- capture share-title -%}
|
||||||
<meta property="og:title" content="{{ page.meta-title }}">
|
{%- if page.meta-title -%}
|
||||||
{% elsif page.title %}
|
{{ page.meta-title }}
|
||||||
<meta property="og:title" content="{{ page.title }}">
|
{%- elsif page.title -%}
|
||||||
{% elsif site.title %}
|
{{ page.title }}
|
||||||
<meta property="og:title" content="{{ site.title }}">
|
{%- else -%}
|
||||||
{% endif %}
|
{{ site.title }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endcapture -%}
|
||||||
|
|
||||||
{% if page.meta-description %}
|
{%- capture share-description -%}
|
||||||
<meta property="og:description" content="{{ page.meta-description }}">
|
{%- if page.meta-description -%}
|
||||||
{% elsif page.subtitle %}
|
{{ page.meta-description }}
|
||||||
<meta property="og:description" content="{{ page.subtitle }}">
|
{%- elsif page.subtitle -%}
|
||||||
{% else %}
|
{{ page.subtitle }}
|
||||||
<meta property="og:description" content="{{ page.content | strip_html | xml_escape | truncatewords: 50 }}">
|
{%- else -%}
|
||||||
{% endif %}
|
{{ {{ page.content | strip_html | xml_escape | truncatewords: 50 }} }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endcapture -%}
|
||||||
|
|
||||||
|
{%- capture share-img -%}
|
||||||
|
{%- if page.share-img -%}
|
||||||
|
{{ page.share-img }}
|
||||||
|
{%- elsif page.cover-img -%}
|
||||||
|
{%- if page.cover-img.first -%}
|
||||||
|
{{ page.cover-img[0].first.first }}
|
||||||
|
{%- else -%}
|
||||||
|
{{ page.cover-img }}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- elsif page.thumbnail-img -%}
|
||||||
|
{{ page.thumbnail-img }}
|
||||||
|
{%- elsif site.avatar -%}
|
||||||
|
{{ site.avatar }}
|
||||||
|
{% endif %}
|
||||||
|
{%- endcapture -%}
|
||||||
|
{%- assign share-img=share-img | strip -%}
|
||||||
|
|
||||||
|
<meta property="og:title" content="{{ share-title }}">
|
||||||
|
<meta property="og:description" content="{{ share-description }}">
|
||||||
|
|
||||||
|
{% if share-img != "" %}
|
||||||
|
<meta property="og:image" content="{{ share-img | absolute_url }}">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% if page.id %}
|
{% if page.id %}
|
||||||
<meta property="og:type" content="article">
|
<meta property="og:type" content="article">
|
||||||
@ -102,30 +131,8 @@
|
|||||||
<link rel="canonical" href="{{ page.url | absolute_url | strip_index }}">
|
<link rel="canonical" href="{{ page.url | absolute_url | strip_index }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{%- capture shareimg -%}
|
|
||||||
{% if page.share-img %}
|
|
||||||
{{ page.share-img }}
|
|
||||||
{% elsif page.cover-img %}
|
|
||||||
{% if page.cover-img.first %}
|
|
||||||
{{ page.cover-img[0].first.first }}
|
|
||||||
{% else %}
|
|
||||||
{{ page.cover-img }}
|
|
||||||
{% endif %}
|
|
||||||
{% elsif page.thumbnail-img %}
|
|
||||||
{{ page.thumbnail-img }}
|
|
||||||
{% elsif site.avatar %}
|
|
||||||
{{ site.avatar }}
|
|
||||||
{% endif %}
|
|
||||||
{% endcapture %}
|
|
||||||
{% assign shareimg=shareimg | strip %}
|
|
||||||
|
|
||||||
{% if shareimg != "" %}
|
{% if share-img != "" and share-img != site.avatar %}
|
||||||
<meta property="og:image" content="{{ shareimg | absolute_url }}">
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
|
|
||||||
<!-- Twitter summary cards -->
|
|
||||||
{% if shareimg != "" and shareimg != site.avatar %}
|
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
<meta name="twitter:card" content="summary_large_image">
|
||||||
{% else %}
|
{% else %}
|
||||||
<meta name="twitter:card" content="summary">
|
<meta name="twitter:card" content="summary">
|
||||||
@ -133,24 +140,11 @@
|
|||||||
<meta name="twitter:site" content="@{{ site.social-network-links.twitter }}">
|
<meta name="twitter:site" content="@{{ site.social-network-links.twitter }}">
|
||||||
<meta name="twitter:creator" content="@{{ site.social-network-links.twitter }}">
|
<meta name="twitter:creator" content="@{{ site.social-network-links.twitter }}">
|
||||||
|
|
||||||
{% if page.meta-title %}
|
<meta property="twitter:title" content="{{ share-title }}">
|
||||||
<meta name="twitter:title" content="{{ page.meta-title }}">
|
<meta property="twitter:description" content="{{ share-description }}">
|
||||||
{% elsif page.title %}
|
|
||||||
<meta name="twitter:title" content="{{ page.title }}">
|
|
||||||
{% else %}
|
|
||||||
<meta name="twitter:title" content="{{ site.title }}">
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if page.meta-description %}
|
{% if share-img != "" %}
|
||||||
<meta name="twitter:description" content="{{ page.meta-description }}">
|
<meta name="twitter:image" content="{{ share-img | absolute_url }}">
|
||||||
{% elsif page.subtitle %}
|
|
||||||
<meta name="twitter:description" content="{{ page.subtitle }}">
|
|
||||||
{% else %}
|
|
||||||
<meta name="twitter:description" content="{{ page.content | strip_html | xml_escape | truncatewords: 50 }}">
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
{% if shareimg != "" %}
|
|
||||||
<meta name="twitter:image" content="{{ shareimg | absolute_url }}">
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if site.matomo %}
|
{% if site.matomo %}
|
||||||
@ -158,7 +152,6 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if page.comments and site.staticman.repository and site.staticman.branch %}
|
{% if page.comments and site.staticman.repository and site.staticman.branch %}
|
||||||
<!-- Staticman -->
|
|
||||||
<link rel="stylesheet" href="{{ "/assets/css/staticman.css" | relative_url }}">
|
<link rel="stylesheet" href="{{ "/assets/css/staticman.css" | relative_url }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
@ -21,20 +21,20 @@ common-js:
|
|||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="{{ page.language | default: site.language | default: 'en' }}">
|
<html lang="{{ page.language | default: site.language | default: 'en' }}">
|
||||||
<!-- Beautiful Jekyll | MIT license | Copyright Dean Attali 2020 -->
|
<!-- Beautiful Jekyll | Copyright Dean Attali 2020 -->
|
||||||
{% include head.html %}
|
{% include head.html %}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
{% include gtm_body.html %}
|
{% include gtm_body.html %}
|
||||||
|
|
||||||
{% include nav.html %}
|
{% include nav.html %}
|
||||||
|
|
||||||
{{ content }}
|
{{ content }}
|
||||||
|
|
||||||
{% include footer.html %}
|
{% include footer.html %}
|
||||||
|
|
||||||
{% include footer-scripts.html %}
|
{% include footer-scripts.html %}
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Loading…
Reference in New Issue
Block a user