Mastodon Timeline Embed: Emfed

About This Method

This method uses the Emfed JavaScript library. It fetches timeline data directly from the Mastodon API and renders it client-side, replacing a specific anchor (<a>) tag on the page.

Configuration is done using data-* attributes directly on the anchor tag. Key attributes include:

  • href: The URL of the Mastodon user profile (e.g., https://instance.social/@username).
  • class="mastodon-feed": Required class for Emfed to find the element.
  • data-toot-limit: Maximum number of posts to display.
  • data-toot-account-id: The numerical Account ID for the user. Required for fetching posts.
  • data-exclude-reblogs: Set to "true" to hide boosts/reblogs (optional).

Important: You need the Mastodon Account ID (a number, not the username) for the account you want to embed. You can often find this using API tools (like searching the account via /.well-known/webfinger on the instance and looking for the ID in the self link) or sometimes by viewing the source code of the user's profile page.

Rendered Timeline

Emfed will replace the anchor tag below with the rendered timeline:

Loading posts by @andypiper@macaw.social...