Embed Mastodon Hashtag Feeds on Your Website – FediTag.js
It’s built as a custom web component that fetches posts through the Mastodon API and renders them with full support for media attachments, polls, and custom emojis.
1. Download and load the FediTag’s JavaScript & CSS files in the document.
<link rel="stylesheet" href="feditag.css"> <script src="feditag.js"></script>
2. Add the custom fedi-tag element wherever you want the feed to appear. The required attributes:
https://your-instance/api/v1/accounts/lookup?acct=username. For example, if your username is photographer, visit https://mastodon.social/api/v1/accounts/lookup?acct=photographer to find the ID in the returned JSON.<fedi-tag host="mastodon.social" account="1" tag="FilmPhotography"> </fedi-tag>
3. Override these classes to create your own styles:
Q: Can I display posts from multiple hashtags?
A: Not with FediTag directly. The library filters by a single hashtag through the Mastodon API’s tagged parameter. You could run multiple fedi-tag elements on the same page with different hashtags, but they would display as separate feeds.
Q: What happens if the Mastodon instance is slow or down?
A: The feed shows “Loading posts…” indefinitely until the fetch completes or fails. FediTag does not implement timeout handling or error messages for failed API calls. The promise rejection goes uncaught, so you would see errors in the browser console but no user-facing message. You can wrap the fetch in the loadPosts method with a catch block to handle failures.
Q: Why does the library remove trailing hashtags?
A: Mastodon users commonly add hashtags at the end of posts for discovery. When displaying these posts outside Mastodon in a feed already filtered by that hashtag, showing the repeated hashtags becomes redundant and clutters the layout.
Q: How do I handle posts with sensitive content warnings?
A: FediTag does not process the spoiler_text field from the API response. Posts with content warnings display their full content immediately without the expandable warning that Mastodon shows. If you need content warning support, you would modify the renderPost method to check post.spoiler_text and conditionally hide post.content behind a button.
The post Embed Mastodon Hashtag Feeds on Your Website – FediTag.js appeared first on CSS Script.
March 16, 2026 All three new food and beverage options at Cherapa Place now are…
March 16, 2026 Vacancy in the Sioux Falls multifamily market ticked up to start the…
Reviewed: On Antisemitism: A Word in HistoryMark MazowerPenguin Press, $29 In April 2024, six months…
RadiusTech.xyz – Cloudflare customer – (United States) Forward-looking developers use .xyz domains to build AI…
The first globe—a spherical representation of our planet Earth—dates back to the Age of Discovery.…
The New Jersey Motion Picture and Television Commission announced Tuesday that 15 towns joined the…
This website uses cookies.