forked from Pelican-Elegant/elegant
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is enabled if the FLATTR_USER configuration variable is set. By default, all posts are in the "text" category. This can be changed by setting "flattrcategory" in the post metadata. Valid values are "text", "images", "video", "audio", "software", "people" and "rest" (as per https://api.flattr.com/rest/v2/categories.txt). Closes Pelican-Elegant#104.
- Loading branch information
Showing
4 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{% macro flattr_script() %} | ||
{% if FLATTR_USER %} | ||
<script type="text/javascript"> | ||
/* <![CDATA[ */ | ||
(function() { | ||
var s = document.createElement('script'); | ||
var t = document.getElementsByTagName('script')[0]; | ||
|
||
s.type = 'text/javascript'; | ||
s.async = true; | ||
s.src = '//api.flattr.com/js/0.6/load.js?'+ | ||
'mode=auto&uid={{ FLATTR_USER }}&language={{ DEFAULT_LANG }}&category=text&button=compact'; | ||
|
||
t.parentNode.insertBefore(s, t); | ||
})(); | ||
/* ]]> */ | ||
</script> | ||
{% endif %} | ||
{% endmacro %} | ||
|
||
{% macro flattr_button(article) %} | ||
{% if FLATTR_USER %} | ||
<a class="FlattrButton" style="display:none;" | ||
title="{{ article.title|striptags|escape }}" | ||
data-flattr-uid="{{ FLATTR_USER }}" | ||
data-flattr-tags="{{ article.tags|join(', ') }}" | ||
data-flattr-category="{{ article.flattrcategory|default('text') }}" | ||
href="{{ SITEURL }}/{{ article.url }}"> | ||
{{ article.summary|striptags|truncate(2000)|escape }} | ||
</a> | ||
{% endif %} | ||
{% endmacro %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters