In this article, I wrote about how to use pelican embed_tweet plugin in Pelican static site generator, which is useful for embedding tweet into your own blog posts, like so:

In the beginning of 2020, I started a goal of writing more professionally. I did not like the idea of putting my blog articles in pay-wall sites such as medium, so I decided to use my own static site generator and host my blog in GitHub pages.

The static site generator, I picked is Pelican. The pelican plugin I want to talk in this post is the embed-tweet plugin, which is useful for embedding tweet into your own blog posts. (If you're interested in how I landed on Pelican, I talked about that briefly over in Pelican Readtime Plugin article.)

It's a short and sweet plugin, but it took some time to make it work with my site. So I figured that I'll writeup what worked for me, in case it helps others in the future.

This particular plugin is not on PyPI, so what I did to get it to work on my system was to first copy the file content of embed_tweet.py into my own file system in the pelican-plugins subfolder. I also made a subfolder and __init__.py file, like so:

$ tree pelican-plugins

pelican-plugins
└── embed_tweet
    ├── __init__.py
    └── embed_tweet.py

Then, I added plugin name to the pelicanconf.py file:

PLUGINS=[ ... , "embed_tweet"]

Then, in the main body of my article, I can just highlight the tweet using the t# prefix. (Please remove one of the extra # from the line below.)

This article is from t##ikding

And here is one of his tweets: t##ikding/status/1306120884646674438

By the way, the suffix is ``t#``, not ``t##``. I added the extra ``#`` to stop embed-tweet from rendering the tweet.

The embed-tweet plugin will automatically convert it to an embedded tweet:

This article is from @ikding

And here is one of his tweets: 

Comments

comments powered by Disqus