From 2d5c422a76d326534135cf1dd2aad93e5abff444 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Sun, 6 Apr 2014 15:35:15 +0200 Subject: [PATCH] improve open graph and twitter cards --- _src/_includes/head.html | 41 ++++++++++---------------------- _src/_includes/opengraph.html | 37 ++++++++++++++++++++++++++++ _src/_includes/twittercards.html | 22 +++++++++++++++++ _src/index.html | 3 +-- 4 files changed, 73 insertions(+), 30 deletions(-) create mode 100644 _src/_includes/opengraph.html create mode 100644 _src/_includes/twittercards.html diff --git a/_src/_includes/head.html b/_src/_includes/head.html index 52fa7748..e741eb76 100644 --- a/_src/_includes/head.html +++ b/_src/_includes/head.html @@ -31,15 +31,17 @@ {% 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 %} {% if page.description %} + {% elsif page.front_page %} + {% else %} {% endif %} @@ -79,31 +81,14 @@ var total = {{ paginator.total_pages }}; {% endif %} - + + + {% include opengraph.html %} + - - - - {% if page.title %} - - {% else %} - - {% endif %} - {% if page.url %} - - {% endif %} - {% if page.description %} - - {% else %} - - {% endif %} - {% if page.image %} - - {% else %} - - {% endif %} - - - - + {% include twittercards.html %} + + + + \ No newline at end of file diff --git a/_src/_includes/opengraph.html b/_src/_includes/opengraph.html new file mode 100644 index 00000000..06c75505 --- /dev/null +++ b/_src/_includes/opengraph.html @@ -0,0 +1,37 @@ + + +{% if page.title %} + +{% else %} + +{% endif %} +{% if page.title %} + + +{% else %} + +{% endif %} +{% if page.description %} + +{% elsif page.front_page %} + +{% else %} + +{% endif %} +{% if page.url %} + {% capture canonical %}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %} + +{% endif %} +{% if page.date %} + +{% endif %} +{% if page.image %} + +{% else %} + +{% endif %} +{% if page.categories %} + {% for category in page.categories limit:1 %} + + {% endfor %} +{% endif %} \ No newline at end of file diff --git a/_src/_includes/twittercards.html b/_src/_includes/twittercards.html new file mode 100644 index 00000000..f2edf440 --- /dev/null +++ b/_src/_includes/twittercards.html @@ -0,0 +1,22 @@ + + + + +{% if page.title %} + +{% else %} + +{% endif %} +{% if page.url %} + +{% endif %} +{% if page.description %} + +{% else %} + +{% endif %} +{% if page.image %} + +{% else %} + +{% endif %} \ No newline at end of file diff --git a/_src/index.html b/_src/index.html index 1daa12dc..b1c05862 100644 --- a/_src/index.html +++ b/_src/index.html @@ -1,7 +1,6 @@ --- layout: base -title: kremalicious -description: 'Blog of designer & developer Matthias Kretschmann' +front_page: true --- {% if paginator.next_page == 2 %}