Picoblog is my somewhat opinionated interpretation and usage of twtxt. It started it's life as a PHP script, but seeing as I mostly forgot how to write and use PHP as well as the fact that I now use Python as part of work, I figured I'll rewrite it. The rendered file is now static, as I figured I don't necessarily update it often enough for it to be dynamic.
This code is provided as an example, although you're more than welcome to use it as is (your own template provided, of course!).
_tweets[_parsed_date]: list = []
.
You can omit this behavior in the code, or in your template.minify-html
to make the resulting HTML smaller in size although you can skip this.--watch|-w
) is looking for changes every 15 seconds via file changed time.usage: main.py [-h] [-t TEMPLATE] [-w] input output
Picoblog builds an html file using a template from a twtxt (https://twtxt.readthedocs.io) feed.
positional arguments:
input Input file (TWTXT format)
output Output file (HTML)
options:
-h, --help show this help message and exit
-t TEMPLATE, --template TEMPLATE
Template to use (HTML)
-w, --watch Watch input file for changes (15s)
Here's a very (VERY) basic template usage:
<div class="entries">
{% for date, entries in tweets.items() %}
<section class="day" id="{{ date }}">
{% for entry in entries %}
<article class="entry">{{ entry.1 }}</article>
{% endfor %}
</section>
{% endfor %}
</div>
@<example http://example.org/twtxt.txt>
).