1
0
mirror of https://github.com/kremalicious/blog.git synced 2024-12-23 01:30:01 +01:00

improve open graph and twitter cards

This commit is contained in:
Matthias Kretschmann 2014-04-06 15:35:15 +02:00
parent 86d13840ae
commit 2d5c422a76
4 changed files with 73 additions and 30 deletions

View File

@ -31,15 +31,17 @@
<title>
{% if paginator.previous_page %}
Page {{ paginator.page }} &brvbar; {{ page.title }}
{% elsif page.path contains '_posts' %}
{% elsif page.title %}
{{ page.title }} &brvbar; {{ site.name }}
{% else %}
{{ page.title }} &brvbar; {{ site.description }}
{{ site.name }} &brvbar; {{ 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 %}
@ -79,31 +81,14 @@
var total = {{ paginator.total_pages }};
</script>
{% endif %}
<!-- OpenGraph -->
{% include opengraph.html %}
<!-- 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 %}
<!-- Facebook/Google+ Sharing -->
<link rel="image_src" href="{{ site.url }}/kremalicious1024.png" />
{% include twittercards.html %}
<!-- Google Authorship -->
<link href="https://plus.google.com/+MatthiasKretschmann" rel="author"/>
</head>

View 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 %}

View 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 %}

View File

@ -1,7 +1,6 @@
---
layout: base
title: kremalicious
description: 'Blog of designer & developer Matthias Kretschmann'
front_page: true
---
{% if paginator.next_page == 2 %}