Emfed

Twitter used to have a really convenient way to embed a feed into your website, but now Twitter is dead.

Emfed is a simple, in-browser way to embed Mastodon feeds into webpages. To make a feed like the one on this page, you use simple markup like this:

<a class="mastodon-feed"
   href="https://mastodon.social/@Mastodon"
   data-toot-limit="4"
   >follow me into the Fediverse</a>

Then include the JavaScript:

<script type="module" src="https://esm.sh/emfed@1"></script>

Optionally, consider adding the stylesheet (or otherwise just style it yourself, however you like):

<link rel="stylesheet" type="text/css"
    href="https://esm.sh/emfed@1/toots.css">

Alternatively, you can embed a single post along with its replies:

<a class="mastodon-thread"
   href="https://mastodon.social/@Mastodon"
   data-toot-id="112011697087209298"
   >Single toot and its replies</a>

One place you can see Emfed in action is at the beets project. The code is dedicated to the public domain. For more details, check out the README.