mirror of
https://github.com/kremalicious/blog.git
synced 2024-11-22 09:56:51 +01:00
improve open graph and twitter cards
This commit is contained in:
parent
86d13840ae
commit
2d5c422a76
@ -31,15 +31,17 @@
|
||||
<title>
|
||||
{% if paginator.previous_page %}
|
||||
Page {{ paginator.page }} ¦ {{ page.title }}
|
||||
{% elsif page.path contains '_posts' %}
|
||||
{% elsif page.title %}
|
||||
{{ page.title }} ¦ {{ site.name }}
|
||||
{% else %}
|
||||
{{ page.title }} ¦ {{ site.description }}
|
||||
{{ site.name }} ¦ {{ site.description }}
|
||||
{% endif %}
|
||||
</title>
|
||||
|
||||
{% if page.description %}
|
||||
<meta name="description" content="{{ page.description }}">
|
||||
{% elsif page.front_page %}
|
||||
<meta name="description" content="{{ site.description }}">
|
||||
{% else %}
|
||||
<meta name="description" content="{{ page.excerpt | strip_html | strip_newlines }}" />
|
||||
{% endif %}
|
||||
@ -80,30 +82,13 @@
|
||||
</script>
|
||||
{% endif %}
|
||||
|
||||
<!-- Twitter Cards -->
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:site" content="@kremaliciouscom">
|
||||
<meta name="twitter:creator" content="@kremalicious">
|
||||
{% if page.title %}
|
||||
<meta name="twitter:title" content="{{ page.title }}">
|
||||
{% else %}
|
||||
<meta name="twitter:title" content="{{ site.title }}">
|
||||
{% endif %}
|
||||
{% if page.url %}
|
||||
<meta name="twitter:url" content="{{ site.url }}{{ page.url }}">
|
||||
{% endif %}
|
||||
{% if page.description %}
|
||||
<meta name="twitter:description" content="{{ page.description }}">
|
||||
{% else %}
|
||||
<meta name="twitter:description" content="{{ page.excerpt | strip_html }}">
|
||||
{% endif %}
|
||||
{% if page.image %}
|
||||
<meta name="twitter:image:src" content="{{ site.url }}/media/{{ page.image }}">
|
||||
{% else %}
|
||||
<meta name="twitter:image:src" content="{{ site.url }}/kremalicious1024.png">
|
||||
{% endif %}
|
||||
<!-- OpenGraph -->
|
||||
{% include opengraph.html %}
|
||||
|
||||
<!-- Facebook/Google+ Sharing -->
|
||||
<link rel="image_src" href="{{ site.url }}/kremalicious1024.png" />
|
||||
<!-- Twitter Cards -->
|
||||
{% include twittercards.html %}
|
||||
|
||||
<!-- Google Authorship -->
|
||||
<link href="https://plus.google.com/+MatthiasKretschmann" rel="author"/>
|
||||
|
||||
</head>
|
37
_src/_includes/opengraph.html
Normal file
37
_src/_includes/opengraph.html
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
<meta content="{{ site.name }}" property="og:site_name">
|
||||
{% if page.title %}
|
||||
<meta content="{{ page.title }}" property="og:title">
|
||||
{% else %}
|
||||
<meta content="{{ site.name }}" property="og:title">
|
||||
{% endif %}
|
||||
{% if page.title %}
|
||||
<meta content="article" property="og:type">
|
||||
<meta content="{{ site.url }}/about/" property="article:author">
|
||||
{% else %}
|
||||
<meta content="website" property="og:type">
|
||||
{% endif %}
|
||||
{% if page.description %}
|
||||
<meta content="{{ page.description }}" property="og:description">
|
||||
{% elsif page.front_page %}
|
||||
<meta content="{{ site.description }}" property="og:description">
|
||||
{% else %}
|
||||
<meta content="{{ page.excerpt | strip_html | strip_newlines }}" property="og:description">
|
||||
{% endif %}
|
||||
{% if page.url %}
|
||||
{% capture canonical %}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %}
|
||||
<meta content="{{ site.url }}{{ canonical }}" property="og:url">
|
||||
{% endif %}
|
||||
{% if page.date %}
|
||||
<meta content="{{ page.date | date_to_xmlschema }}" property="article:published_time">
|
||||
{% endif %}
|
||||
{% if page.image %}
|
||||
<meta content="{{ site.url }}/media/{{ page.image }}" property="og:image">
|
||||
{% else %}
|
||||
<meta content="{{ site.url }}/kremalicious1024.png" property="og:image">
|
||||
{% endif %}
|
||||
{% if page.categories %}
|
||||
{% for category in page.categories limit:1 %}
|
||||
<meta content="{{ category }}" property="article:section">
|
||||
{% endfor %}
|
||||
{% endif %}
|
22
_src/_includes/twittercards.html
Normal file
22
_src/_includes/twittercards.html
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
<meta name="twitter:card" content="summary">
|
||||
<meta name="twitter:site" content="@kremaliciouscom">
|
||||
<meta name="twitter:creator" content="@kremalicious">
|
||||
{% if page.title %}
|
||||
<meta name="twitter:title" content="{{ page.title }}">
|
||||
{% else %}
|
||||
<meta name="twitter:title" content="{{ site.title }}">
|
||||
{% endif %}
|
||||
{% if page.url %}
|
||||
<meta name="twitter:url" content="{{ site.url }}{{ page.url }}">
|
||||
{% endif %}
|
||||
{% if page.description %}
|
||||
<meta name="twitter:description" content="{{ page.description }}">
|
||||
{% else %}
|
||||
<meta name="twitter:description" content="{{ page.excerpt | strip_html }}">
|
||||
{% endif %}
|
||||
{% if page.image %}
|
||||
<meta name="twitter:image:src" content="{{ site.url }}/media/{{ page.image }}">
|
||||
{% else %}
|
||||
<meta name="twitter:image:src" content="{{ site.url }}/kremalicious1024.png">
|
||||
{% endif %}
|
@ -1,7 +1,6 @@
|
||||
---
|
||||
layout: base
|
||||
title: kremalicious
|
||||
description: 'Blog of designer & developer Matthias Kretschmann'
|
||||
front_page: true
|
||||
---
|
||||
|
||||
{% if paginator.next_page == 2 %}
|
||||
|
Loading…
Reference in New Issue
Block a user