1
0
mirror of https://github.com/ipdb/website.git synced 2024-12-28 15:47:44 +01:00

Twitter cards & open graph

* closes #9
This commit is contained in:
Matthias Kretschmann 2017-09-04 14:29:04 +02:00
parent 1306d5c421
commit df120dfeac
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 68 additions and 6 deletions

View File

@ -4,9 +4,9 @@
<!-- Dynamic meta title -->
<title>
{% if page.title %}
{{ page.title }} {{ site.title }}
{{ page.title }} · {{ site.title }}
{% else %}
{{ site.title }} {{ site.description }}
{{ site.title }} · {{ site.description }}
{% endif %}
</title>
@ -14,7 +14,7 @@
{% if page.description %}
<meta name="description" content="{{ page.description }}">
{% elsif page.front_page %}
<meta name="description" content="{{ site.description }}">
<meta name="description" content="{{ site.data.content-front.hero.description | strip_html | strip_newlines }}">
{% else %}
<meta name="description" content="{{ page.excerpt | strip_html | strip_newlines }}" />
{% endif %}
@ -56,14 +56,14 @@
<link rel="icon" type="image/png" href="/assets/img/touch-icon.png" sizes="192x192">
<link rel="icon" type="image/png" href="/assets/img/favicon.png" sizes="32x32">
<link rel="icon" type="image/png" href="/assets/img/favicon.png" sizes="16x16">
<link rel="mask-icon" href="/assets/img/favicon-glyph.svg" color="#ec008c">
<link rel="mask-icon" href="/assets/img/favicon-glyph.svg" color="#093749">
<!-- Win 8/8.1 -->
<meta name="msapplication-TileImage" content="{{ site.url }}/assets/img/touch-icon.png"/>
<meta name="msapplication-TileColor" content="#161d21"/>
<meta name="msapplication-TileColor" content="#093749"/>
<!-- Android Lollipop theme color -->
<meta name="theme-color" content="#ec008c">
<meta name="theme-color" content="#093749">
<!-- Prevent search indexing for some pages or non-production builds -->
{% if jekyll.environment != 'production' or page.sitemap == false %}
@ -71,4 +71,6 @@
{% endif %}
<meta name="robots" content="noindex, nofollow">
{% include sharing.html %}
</head>

View File

@ -0,0 +1,60 @@
<!-- Twitter Cards -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@ipdbfoundation">
{% if page.front_page %}
<meta name="twitter:title" content="{{ site.title }}">
{% else %}
<meta name="twitter:title" content="{{ page.title }} · {{ site.title }}">
{% endif %}
{% if page.url %}
<meta name="twitter:url" content="{{ site.url}}{{ page.url | replace:'index.html','' }}">
{% endif %}
{% if page.description %}
<meta name="twitter:description" content="{{ page.description }}">
{% elsif page.front_page %}
<meta name="twitter:description" content="{{ site.data.content-front.hero.description | strip_html | strip_newlines }}">
{% else %}
<meta name="twitter:description" content="{{ page.excerpt | strip_html }}">
{% endif %}
{% if page.image %}
<meta name="twitter:image:src" content="{{ site.url }}/assets/img/{{ page.image }}">
{% else %}
<meta name="twitter:image:src" content="{{ site.url }}/assets/img/share-image.jpg">
{% endif %}
<!-- Open Graph -->
<meta property="og:type" content="website">
<meta property="og:site_name" content="{{ site.title }}">
{% if page.front_page %}
<meta property="og:title" content="{{ site.title }}">
{% else %}
<meta property="og:title" content="{{ page.title }} · {{ site.title }}">
{% endif %}
{% if page.description %}
<meta property="og:description" content="{{ page.description }}">
{% elsif page.front_page %}
<meta property="og:description" content="{{ site.data.content-front.hero.description | strip_html | strip_newlines }}">
{% else %}
<meta property="og:description" content="{{ page.excerpt | strip_html | strip_newlines }}">
{% endif %}
{% if page.url %}
<meta property="og:url" content="{{ site.url}}{{ page.url | replace:'index.html','' }}">
{% endif %}
{% if page.date %}
<meta property="article:published_time" content="{{ page.date | date_to_xmlschema }}">
{% endif %}
{% if page.image %}
<meta content="{{ site.url }}/assets/img/{{ page.image }}" property="og:image">
{% else %}
<meta content="{{ site.url }}/assets/img/share-image.png" property="og:image">
{% endif %}