devyn barrie


Stop embedding tweets on websites

Elon Musk began July by breaking Twitter yet again. This is just the latest in his series of bizarre decisions to worsen the user experience and cut down on actual use of the service. Concurrent with the rate limiting, Twitter is also now requiring people to sign in first to view tweets. You can't just go to twitter.com and see a tweet anymore. This lock-down of information has led me to wonder if days are numbered for tweets embedded on websites. While you can still see tweets embedded on websites as of July 2, it's definitely possible Elon will break that as well someday.

Both my blog and OttawaStart.com are made with Hugo, a static site generator. This has been a source of many headaches when it comes to embedded Tweets. This is because when I embed a tweet, I put in a shortcode in the article text: {{ < tweet (ID #) > }}. Hugo uses a template to render this into an actual tweet that readers can view on the published article. A quirk of Hugo I discovered—if there is an error for any reason (the tweet is deleted, user deactivates their account, Musk unplugs the wrong cord), Hugo can't finish generating the static site. I would have to remove that shortcode and restart the process.

This quirk made me seriously lay off the use of embedding tweets a few years ago. A certain local politician had the habit of periodically deactivating their Twitter account and this kept breaking the site. Ultimately, I realized that embedding copious quantities of tweets in articles was a particularly lazy era in journalism, and I'm sorry I ever had anything to do with it.

Aside from the fact that this issue with Hugo could probably be bypassed, I've decided it is high time now to just remove all the legacy embeds. Lesson learned: don't rely on Twitter!^1


1

Or any corporate platform, for that matter.

Tags: twitter, web, hugo.