-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Embed Mastodon #210
Comments
Definitely been thinking about this! I'd be curious how you'd want to handle URLs, since there are hundreds of Mastodon servers out there, each with their own URL. At a minimum, I think you'd have to configure the URL of the server you use: eleventyConfig.addPlugin(embedEverything, {
mastodon: {
options: {
server: "mastodon.social"
}
}
}); But what happens if the |
OK, did some quick and dirty research here:
<iframe src="https://mastodon.archive.org/@internetarchive/111247884522639243/embed" width="400" allowfullscreen="allowfullscreen" sandbox="allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-forms"></iframe> So it seems like all the components we need to rebuild the original post URL are present (server, user handle, post ID) regardless of which server you're browsing from. So that bodes well! I suppose edge cases could include:
|
I believe that taking advantage of existing datasets of existing and active Mastodon instances and their characteristics could be very helpful! Here is the first one I found, it seems very complete! |
(This is mostly me just making notes as I go, don't mind me) So I spoke too soon on the post ID — a federated post that shows up on your server has a different ID from the originating server. From the example above:
Knowing your server's post ID doesn't tell you anything about the original post's ID. Which is too bad. But there's an API, so we can get the required URL that way: {
"id": "111247893684188804",
"created_at": "2023-10-17T02:00:03.000Z",
// ...
"url": "https://mastodon.archive.org/@internetarchive/111247884522639243",
// ...
} We can then use that URL to create the embed code. This is similar to how the Soundcloud plugin works, which requires calling an API to get the required embed data. That's why it's not enabled by default in all-in-one plugin, and I'd do the same here — you'd have to opt-in for Mastodon embeds (unless you use it standalone). This would be the minimum required configuration: eleventyConfig.addPlugin(embedEverything, {
add: ['mastodon'],
mastodon: {
options: {
server: "<example.mastodon.server>"
}
}
}); I think that's a plan. Definitely doable, just a matter of carving out some time! |
Hi @gfscott! Jumping back in wondering if there was any progress on this, and if I could help in any way! |
Apologies, no progress to report yet but appreciate the prod! I'll take another run at it. |
This is great, @gfscott! Thank you ❤️🚀 |
OK, package is now published — give it a try and let me know if you run into any issues! |
It would be awesome if embedding Mastodon posts was supported!
The text was updated successfully, but these errors were encountered: