From c4da5c973489fb5b5c2afbdb41182b93d23ab067 Mon Sep 17 00:00:00 2001 From: Jean Petric Date: Sun, 27 Sep 2015 11:23:45 +0100 Subject: [PATCH] social buttons on articles --- README.md | 13 ++++++++++ alchemy/templates/article.html | 8 ++++++ alchemy/templates/include/sharing.html | 26 +++++++++++++++++++ .../templates/include/sharing_scripts.html | 26 +++++++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 alchemy/templates/include/sharing.html create mode 100644 alchemy/templates/include/sharing_scripts.html diff --git a/README.md b/README.md index 20f4043..330c260 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,19 @@ An RSS icon will also appear on the nav if `FEED_ATOM` or `FEED_RSS` is set. | GOOGLE_ANALYTICS_DOMAIN | TEXT | Google analytics | | GOOGLE_ANALYTICS_ID | TEXT | Google analytics | +To include social buttons on articles add the following. + +| Config | Type | Description | +| ------------------------- | ---------- | ------------------------- | +| TWITTER_USERNAME | TEXT | Twitter username | +| CUSTOM_ARTICLE_FOOTERS | DICT | Add sharing.html | +| CUSTOM_SCRIPTS_ARTICLE | TEXT | Add sharing_scripts.html | + +An example of pelicanconf.py file for adding social buttons. + +TWITTER_USERNAME = "your twitter username" +CUSTOM_ARTICLE_FOOTERS = ('sharing.html',) +CUSTOM_SCRIPTS_ARTICLE = "sharing_scripts.html" ## Live Demo diff --git a/alchemy/templates/article.html b/alchemy/templates/article.html index ab5d9ec..a6f86b1 100644 --- a/alchemy/templates/article.html +++ b/alchemy/templates/article.html @@ -49,6 +49,14 @@

{{ article.content }} + {% for file in CUSTOM_ARTICLE_FOOTERS %} + {% include "include/" + file %} + {% endfor %} + {% block scripts %} + {% if CUSTOM_SCRIPTS_ARTICLE %} + {% include "include/" + CUSTOM_SCRIPTS_ARTICLE %} + {% endif %} + {% endblock %}
{% include 'include/disqus_comments.html' %} diff --git a/alchemy/templates/include/sharing.html b/alchemy/templates/include/sharing.html new file mode 100644 index 0000000..6f9f9fe --- /dev/null +++ b/alchemy/templates/include/sharing.html @@ -0,0 +1,26 @@ +
+
+ {% if TWITTER_USERNAME %} + +   + {% endif %} + + +
+      +
  + + +
+
+   +
\ No newline at end of file diff --git a/alchemy/templates/include/sharing_scripts.html b/alchemy/templates/include/sharing_scripts.html new file mode 100644 index 0000000..390d4fc --- /dev/null +++ b/alchemy/templates/include/sharing_scripts.html @@ -0,0 +1,26 @@ + +
+ + + + + + + + + \ No newline at end of file