Tweet2Hugo - Twitter without all the js

This is my script in Python3:

The script is quite simple. It pulls the latest tweet from a specified twitter handle (easier than ID) and stores the json in the data directory of your hugo installation. My git server above is running the CD/CI and it is easy to integrate the script there. All I do is run this script as a cronjob all 5 minutes and does a commit and git fires up the post-receive hook, publishing my newest tweet or changes in likes, retweets (which is mostly 0 :P).

Hope this helps anyone, it enables you to have tweets on your webpage that do not require cookie consent, do not hassle your user with javascript and will not be blocked by social media blockers, as it poses no danger. Using Twitter web-intents, you can even like, reply and retweet directly from that widget.

The script can also send you a mail when fetching fails. The downside is, it requires a twitter API key.


A little update:

I have added example configurations and the ability to ignore hashtags, so this particular tweet does not show up. If you write “politics” into the exclude list, then all tweets with “#politics” do not show up on your homepage.

You can now also disable the mailing function in the configuration.