From 12c391c8409495b18d1add45c8d45dc5b9310c5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 21 Jan 2013 01:18:38 +0100 Subject: [PATCH] add flattr to head tag --- _config.yml | 2 +- source/_includes/custom/head.html | 3 + source/_includes/flattr_feed_button.html | 5 +- source/_includes/flattr_param.html | 14 +++ source/_includes/flattr_payment_link.xml | 1 - source/_includes/post/flattr_button.html | 4 +- ...013-01-20-add-flattr-to-octopress.markdown | 85 ++++++++++++++----- source/atom.xml | 5 +- 8 files changed, 90 insertions(+), 29 deletions(-) create mode 100644 source/_includes/flattr_param.html delete mode 100644 source/_includes/flattr_payment_link.xml diff --git a/_config.yml b/_config.yml index 7d6abb3..2be74bc 100644 --- a/_config.yml +++ b/_config.yml @@ -7,7 +7,7 @@ title: ~/git/blog subtitle: hot and spicy author: Jörg Thalheim simple_search: http://www.duckduckgo.com/ -description: a tech blog about the latest shit +description: a tech blog # Default date format is "ordinal" (resulting in "July 22nd 2007") # You can customize the format as defined in diff --git a/source/_includes/custom/head.html b/source/_includes/custom/head.html index 21766a0..80e74ed 100644 --- a/source/_includes/custom/head.html +++ b/source/_includes/custom/head.html @@ -11,4 +11,7 @@ })(); /* ]]> */ + +{% include flattr_param.html %} + {% endif %} diff --git a/source/_includes/flattr_feed_button.html b/source/_includes/flattr_feed_button.html index be1e626..07b1d2b 100644 --- a/source/_includes/flattr_feed_button.html +++ b/source/_includes/flattr_feed_button.html @@ -1,4 +1,5 @@ - +{% include flattr_payment_link.html %} + Flattr this + alt="Flattr this"/> diff --git a/source/_includes/flattr_param.html b/source/_includes/flattr_param.html new file mode 100644 index 0000000..e03140b --- /dev/null +++ b/source/_includes/flattr_param.html @@ -0,0 +1,14 @@ +{% if post %} +{% assign item = post %} +{% else %} + +{% assign item = page %} +{% endif %} + +{% capture flattr_url %}{{ site.url }}{{ item.url }}{% endcapture %} + +{% capture flattr_title %}{% if item.title %}{{ item.title }}{% else %}{{ site.title }}{% endif %}{% endcapture %} + +{% capture flattr_description %}{% if item.description %}{{ item.description}}{% else index == true %}{{ site.description }}{% endif %}{% endcapture %} + +{% capture flattr_param %}url={{ flattr_url | cgi_escape }}&user_id={{site.flattr_user | cgi_escape }}&title={{ flattr_title | cgi_escape }}&category=text&description={{ flattr_description | truncate: 1000 | cgi_escape }}&tags={{ item.categories | join: "," | cgi_escape }}{% endcapture %} diff --git a/source/_includes/flattr_payment_link.xml b/source/_includes/flattr_payment_link.xml deleted file mode 100644 index 0600155..0000000 --- a/source/_includes/flattr_payment_link.xml +++ /dev/null @@ -1 +0,0 @@ - diff --git a/source/_includes/post/flattr_button.html b/source/_includes/post/flattr_button.html index b70d301..c0a1841 100644 --- a/source/_includes/post/flattr_button.html +++ b/source/_includes/post/flattr_button.html @@ -1,9 +1,9 @@ diff --git a/source/_posts/2013-01-20-add-flattr-to-octopress.markdown b/source/_posts/2013-01-20-add-flattr-to-octopress.markdown index b7c6a21..786493b 100644 --- a/source/_posts/2013-01-20-add-flattr-to-octopress.markdown +++ b/source/_posts/2013-01-20-add-flattr-to-octopress.markdown @@ -11,6 +11,8 @@ categories: - feed --- +**Update** add payment relation to header, thanks to [@voxpelli](https://twitter.com/voxpelli) + In this article I will show how to add [{% img left https://flattr.com/_img/icons/flattr_logo_16.png 14 14 %}Flattr](https://flattr.com/) to your [{% img left /favicon.png 14 14 %} octopress](http://octopress.org) blog and feed. @@ -28,11 +30,11 @@ To add a flattr button to the sharing section of your posts, add this template: ``` {% endraw %} @@ -41,7 +43,6 @@ and add the following javascript to your custom head.html {% raw %} ``` html source/_includes/custom/head.html - {% include custom/richobject.html %} {% if site.flattr_user %} + +{% include flattr_param.html %} + +{% endif %} +``` +{% endraw %} + Because not (yet) all feed reader support this feature, you can add a dedicated flattr link. Therefor create a new template: {% raw %} -```xml source/_includes/flattr_feed_button.html - +```html source/_includes/flattr_feed_button.html +{% include flattr_payment_link.html %} + Flattr this + alt="Flattr this"/> ``` {% endraw %} @@ -160,8 +198,11 @@ layout: nil <![CDATA[{{ post.title | cdata_escape }}]]> {{ post.date | date_to_xmlschema }} - {% if site.flattr_user %}{% include flattr_payment_link.xml %}{% endif %} {{ site.url }}{{ post.id }} + {% if site.flattr_user %} + {% include flattr_param.html %} + + {% endif %} {{ post.date | date_to_xmlschema }} - {% if site.flattr_user %}{% include flattr_payment_link.xml %}{% endif %} + {% if site.flattr_user %} + {% include flattr_payment_link.html %} + + {% endif %} {{ site.url }}{{ post.id }}