head.html 4.6 KB

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