mirror of
https://github.com/nairobilug/pelican-alchemy.git
synced 2024-12-30 12:15:06 +01:00
Merge c4da5c9734 into 1e1cfb9b4b
This commit is contained in:
commit
c5905059ec
4 changed files with 73 additions and 0 deletions
13
README.md
13
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_DOMAIN | TEXT | Google analytics |
|
||||||
| GOOGLE_ANALYTICS_ID | 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
|
## Live Demo
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,14 @@
|
||||||
{{ article.content }}
|
{{ article.content }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% for file in CUSTOM_ARTICLE_FOOTERS %}
|
||||||
|
{% include "include/" + file %}
|
||||||
|
{% endfor %}
|
||||||
|
{% block scripts %}
|
||||||
|
{% if CUSTOM_SCRIPTS_ARTICLE %}
|
||||||
|
{% include "include/" + CUSTOM_SCRIPTS_ARTICLE %}
|
||||||
|
{% endif %}
|
||||||
|
{% endblock %}
|
||||||
<hr class="separator">
|
<hr class="separator">
|
||||||
<div class="col-md-8 col-md-offset-2">
|
<div class="col-md-8 col-md-offset-2">
|
||||||
{% include 'include/disqus_comments.html' %}
|
{% include 'include/disqus_comments.html' %}
|
||||||
|
|
|
||||||
26
alchemy/templates/include/sharing.html
Normal file
26
alchemy/templates/include/sharing.html
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<hr />
|
||||||
|
<div class="well well-sm"> <!-- Social media sharing buttons -->
|
||||||
|
{% if TWITTER_USERNAME %}
|
||||||
|
<!-- Twitter -->
|
||||||
|
<a href="https://twitter.com/share" class="twitter-share-button"
|
||||||
|
data-via="{{ TWITTER_USERNAME }}" >Tweet</a>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<!-- Google+ -->
|
||||||
|
<div class="g-plus" data-action="share" data-annotation="bubble"></div>
|
||||||
|
|
||||||
|
<div class="g-plusone" data-size="medium"></div>
|
||||||
|
|
||||||
|
<!-- Facebook -->
|
||||||
|
<div class="fb-like"
|
||||||
|
{% if page %}
|
||||||
|
data-href="{{ SITEURL }}/{{ page.url }}"
|
||||||
|
{% else %}
|
||||||
|
data-href="{{ SITEURL }}/{{ article.url }}"
|
||||||
|
{% endif %}
|
||||||
|
data-layout="button_count"
|
||||||
|
data-action="like" data-show-faces="true"
|
||||||
|
data-share="true">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div> <!-- /Social media sharing buttons -->
|
||||||
26
alchemy/templates/include/sharing_scripts.html
Normal file
26
alchemy/templates/include/sharing_scripts.html
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
<!-- Facebook -->
|
||||||
|
<div id="fb-root"></div>
|
||||||
|
<script>(function(d, s, id) {
|
||||||
|
var js, fjs = d.getElementsByTagName(s)[0];
|
||||||
|
if (d.getElementById(id)) return;
|
||||||
|
js = d.createElement(s); js.id = id;
|
||||||
|
js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
|
||||||
|
fjs.parentNode.insertBefore(js, fjs);
|
||||||
|
}(document, 'script', 'facebook-jssdk'));
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Twitter -->
|
||||||
|
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>
|
||||||
|
|
||||||
|
<!-- Google+ -->
|
||||||
|
<!-- Synchronous
|
||||||
|
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
|
||||||
|
-->
|
||||||
|
<!-- Asynchronous -->
|
||||||
|
<script type="text/javascript">
|
||||||
|
(function() {
|
||||||
|
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
|
||||||
|
po.src = 'https://apis.google.com/js/platform.js';
|
||||||
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue