I'm trying to craft a unique Tweet button for each article/web page, using this HTML snippet found in most themes' twitter.html
template file:
<!-- language: raw -->
<script
charset="utf-8"
src="http://platform.twitter.com/widgets.js"
type="text/javascript"
>
</script>
<a class="fab fa-twitter"
target="_blank"
href="https://twitter.com/intent/tweet?ref_src=twsrc%5Etfw&text=Hi!%20I%20think%20that%20...&tw_p=tweetbutton&url={{ article }}&via={{ TWITTER_USERNAME }}">
</a>
My problem is that pelican output processor translate the {{ article }}
internal variable name gets into its full OS-filepath specification of a particular article and not my desired URL setting.
I would like to used something like:
{{ SITEURL }}/{{ slug }}
.
But pelican
computes that as an empty string.
Caveat: I do have RELATIVE_URL = True
in my pelicanconfig.py
configuration setting file.
What internal variable names (or environment name) can one used to get the full URL setting (i.e., https://example.org/articles/first-post.html
)?
The only fix I can do is to duplicate the SITEURL
as in:
SITEURL = 'https://example.com/'
ABSOLUTE_SITEURL = SITEURL
And in its place where SITEURL
is, use the untouched ABSOLUTE_SITEURL
in the template files whether it is in RELATIVE_URLS
mode or not.