Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Tip: Show a Mastodon Fediverse Feed on a TXP Site
Hi everyone,
I just wanted to share this little tip on creating a feed from your Mastodon profile. So far I’ve enjoyed using Mastodon (kind of a Twitter alternative, but with lots more controls, and more FOSS-friendly community in some ways) and wanted to integrate the feed with my own website.
Here’s what you’ll need:
- An account on a Mastodon server instance. My account is on oldbytes.space, but there are many others. Generally people pick servers that match their interests. (And I kid you not, there’s a dolphins server where you’re only allowed to use the letter ‘e’ in your posts). These servers all talk to each other, so you have both a local server community and also a broader community to interact with.
- Here’s a good thread with tips for new users, by the way.
- Your profile’s RSS feed address (see below for instructions)
- Bloke’s excellent smd_xml plugin, installed and activated
- A form or a place to put this code
How to get your RSS feed address:
- Add
.rss
to the end of your profile address, which comes after the server address. Example:
Original address: https://oldbytes.space/@marcolas ... RSS feed version: https://oldbytes.space/@marcolas.rss
As a final step, here’s the code to use after you’ve enabled the smd_xml plugin. You can put this in a form for your sidebar, for example:
<h2>Recent Fediverse Activity</h2>
<txp:smd_xml limit="10" data="https://oldbytes.space/@marcolas.rss" record="item" fields="title, link, pubDate" format="pubDate|date|%d %B %Y %H:%I" wraptag="div" class="mastodon" break="p">{title} on <a href='{link}'>(Full Toot from {pubDate} →)</a></txp:smd_xml>
What this does:
- Show your latest 10 posts
- Use the “item” record type to focus on posts (there is a lot more content in the feed, for example your profile pic, etc. so you can get fancy if you want)
- Use the fields title, link, and pubDate from that record
- Format the date so it’s nicer than the default
I haven’t made any shortcodes yet, so if somebody wants to give that a shot please feel welcome.
I’ve posted this to the Fediverse with the #txp and #textpattern hashtags. Right now hashtags are really important for discovery on Mastodon. Please boost (retweet) & say hi if you get a chance!
Last edited by maruchan (2022-04-29 19:57:39)
Offline