Mastodon Embed Shortcode for hugo
Written by Kevin Gimbel on 12.09.2018, 🍿 1 min. read
This website no longer uses Hugo. The Mastodon embed doesn't work as of January 2021 and I'm not sure if I'll implement it again for 11ty, the new static site generator used for this website.
For this reason, the embed examples in this post do not work.
You may know that I made some shortcodes for Hugo, the static site generator I am using to create this website. So far I made a shortcode for caniuse.com and codepen.io which allow to embed CodePen and "Can I Use" embeds easily with Hugos build-in Shortcode system.
Today I made another one which allows embeds from Mastodon, the decentralized Twitter-like social network. An example embed is shown below.
https://mastodon.social/@kevingimbel/100700713283716694
The Source Code can be found on GitHub.com
Configuration
The shortcode is fairly simple and requires only one attribute: The link to a single toot, e.g. https://mastodon.social/@kevingimbel/100700713283716694.
{{ mastodon "https://mastodon.social/@kevingimbel/100700713283716694" }}
Additional parameters:
# All parameters
{{ mastodon "https://mastodon.social/@kevingimbel/100700713283716694" "1000" "500" }}
Below is a short description for each parameter
Parameter | Value |
---|---|
status | The link to the status |
width | The width of the iframe |
height | The height of the iframe |
Examples
https://mastodon.social/@rootsworks/100666238685414786 https://mastodon.social/@prashere/539624 https://octodon.social/@spacekookie/100680807257148198