head.html 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <head>
  2. <meta charset="utf-8">
  3. <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  4. {% capture title %}
  5. {%- if page.share-title -%}
  6. {{ page.share-title | strip_html | xml_escape }}
  7. {%- elsif page.title -%}
  8. {{ page.title | strip_html | xml_escape }}
  9. {%- else -%}
  10. {{ site.title | strip_html | xml_escape }}
  11. {%- endif -%}
  12. {% endcapture %}
  13. {% capture description %}
  14. {%- if page.share-description -%}
  15. {{ page.share-description | strip_html | xml_escape }}
  16. {%- elsif page.subtitle -%}
  17. {{ page.subtitle | strip_html | xml_escape }}
  18. {%- else -%}
  19. {%- assign excerpt_length = site.excerpt_length | default: 50 -%}
  20. {{ page.content | strip_html | xml_escape | truncatewords: excerpt_length | strip }}
  21. {%- endif -%}
  22. {% endcapture %}
  23. <title>{{ title }}</title>
  24. {% if site.author %}
  25. <meta name="author" content="{{ site.author }}">
  26. {% endif %}
  27. <meta name="description" content="{{ description }}">
  28. {% if site.mobile-theme-col %}
  29. <meta name="theme-color" content="{{ site.mobile-theme-col }}">
  30. {% endif %}
  31. {% if site.keywords %}
  32. <meta name="keywords" content="{{ site.keywords }}">
  33. {% endif %}
  34. {% if site.rss-description %}
  35. <link rel="alternate" type="application/rss+xml" title="{{ site.title }}" href="{{ '/feed.xml' | absolute_url }}">
  36. {% endif %}
  37. {% include gtag.html %}
  38. {% include gtm_head.html %}
  39. {% include google_analytics.html %}
  40. {% include cloudflare_analytics.html %}
  41. {% if layout.common-ext-css %}
  42. {% for css in layout.common-ext-css %}
  43. {% include ext-css.html css=css %}
  44. {% endfor %}
  45. {% endif %}
  46. {% if layout.common-css %}
  47. {% for css in layout.common-css %}
  48. <link rel="stylesheet" href="{{ css | relative_url }}">
  49. {% endfor %}
  50. {% endif %}
  51. {% if site.site-css %}
  52. {% for css in site.site-css %}
  53. <link rel="stylesheet" href="{{ css | relative_url }}">
  54. {% endfor %}
  55. {% endif %}
  56. {% if page.ext-css %}
  57. {% for css in page.ext-css %}
  58. {% include ext-css.html css=css %}
  59. {% endfor %}
  60. {% endif %}
  61. {% if page.css %}
  62. {% for css in page.css %}
  63. <link rel="stylesheet" href="{{ css | relative_url }}">
  64. {% endfor %}
  65. {% endif %}
  66. {% if site.fb_app_id %}
  67. <meta property="fb:app_id" content="{{ site.fb_app_id }}">
  68. {% endif %}
  69. {% if site.title %}
  70. <meta property="og:site_name" content="{{ site.title }}">
  71. {% endif %}
  72. {%- capture img -%}
  73. {%- if page.share-img -%}
  74. {{ page.share-img }}
  75. {%- elsif page.cover-img -%}
  76. {%- if page.cover-img.first -%}
  77. {{ page.cover-img[0].first.first }}
  78. {%- else -%}
  79. {{ page.cover-img }}
  80. {%- endif -%}
  81. {%- elsif page.thumbnail-img -%}
  82. {{ page.thumbnail-img }}
  83. {%- elsif site.avatar -%}
  84. {{ site.avatar }}
  85. {% endif %}
  86. {%- endcapture -%}
  87. {%- assign img=img | strip -%}
  88. <meta property="og:title" content="{{ title }}">
  89. <meta property="og:description" content="{{ description }}">
  90. {% if img != "" %}
  91. <meta property="og:image" content="{{ img | absolute_url }}">
  92. {% endif %}
  93. {% if page.id %}
  94. <meta property="og:type" content="article">
  95. <meta property="og:article:author" content="{{ site.author }}">
  96. <meta property="og:article:published_time" content="{{ page.date | date_to_xmlschema }}">
  97. <meta property="og:url" content="{{ page.url | absolute_url }}">
  98. <link rel="canonical" href="{{ page.url | absolute_url }}">
  99. {% else %}
  100. <meta property="og:type" content="website">
  101. <meta property="og:url" content="{{ page.url | absolute_url | strip_index }}">
  102. <link rel="canonical" href="{{ page.url | absolute_url | strip_index }}">
  103. {% endif %}
  104. {% if img != "" and img != site.avatar %}
  105. <meta name="twitter:card" content="summary_large_image">
  106. {% else %}
  107. <meta name="twitter:card" content="summary">
  108. {% endif %}
  109. <meta name="twitter:site" content="@{{ site.social-network-links.twitter }}">
  110. <meta name="twitter:creator" content="@{{ site.social-network-links.twitter }}">
  111. <meta property="twitter:title" content="{{ title }}">
  112. <meta property="twitter:description" content="{{ description }}">
  113. {% if img != "" %}
  114. <meta name="twitter:image" content="{{ img | absolute_url }}">
  115. {% endif %}
  116. {% include matomo.html %}
  117. {% if page.comments and site.staticman.repository and site.staticman.branch %}
  118. <link rel="stylesheet" href="{{ "/assets/css/staticman.css" | relative_url }}">
  119. {% endif %}
  120. {% if page.head-extra %}
  121. {% for file in page.head-extra %}
  122. {% include {{ file }} %}
  123. {% endfor %}
  124. {% endif %}
  125. </head>