I've created a shortcode for #GoHugoIo (a static site generator) that lets me embed Toots on my blog posts!

https://realmenweardress.es/2022/11/2022-11-30-s3-hugo-toot-embeds/

#Mastodon #Fediverse #SelfHost #Blog #Hugo #HugoBlog

Some shortcode magic for embedding toots in Hugo posts.

Some shortcode magic for embedding toots in Hugo posts - not using oembeds

Real Men Wear Dress.es
@pieceofthepie I love this… and I was thinking of doing a similar thing for the Publish static site generator.
I might, err, look at your code for inspiration :)
Thank-you!
@pieceofthepie this is cool. Do you have the code shared somewhere?
@bahree yep, it's linked near the bottom of the post. My theme is on GitHub.

@pieceofthepie I was looking at this. And the rendering is failing. Do you know what %s is in the second line?

{{- $finger := getJSON (printf "https://%s/.well-known/webfinger?resource=acct:%s@%s" (index $parts 2) (index $parts 1) (index $parts 2)) -}}

@bahree Thats going to resolve to your username in my case I would see acct:[email protected]

You'll see that the domain part is at index 2 and is also used to reach the url.

That whole thing is pulled from a configuration value you'll need in your config.toml file. MastodonName I think.

@pieceofthepie looking at the code, I saw one needs to setup "mastodonName" as a parameter. In my case thats "https://mastodon. Online/@bahree" - but it is expecting something else too.
@bahree Sorry, I guess thats not so well documented. Your mastodonName would be "@bahree @mastodon.online". Notice the @ prefix and no space obviously.
@pieceofthepie Oh awesome - that worked! Looks terrible on my theme (am on a forked PaperMod) - need to get in the CSS now. I think its the one here:
https://github.com/cooperaj/rmwd-hugo-theme/tree/master/assets/sass
rmwd-hugo-theme/assets/sass at master Β· cooperaj/rmwd-hugo-theme

The theme for my blog. It is pretty custom but you're welcome to have a browse. - rmwd-hugo-theme/assets/sass at master Β· cooperaj/rmwd-hugo-theme

GitHub
@bahree Yep. Thats the place, but since i'm using a CSS toolkit that Papermod likely isn't youre realistically going to be implementing it yourself. Though I guess I've done the work of extracting the colours out for you (see _toot.scss)

@pieceofthepie This is great - thanks. I'll try and work on cleaning it up and will share back in case anyone else wants to use.

And I am not a UX person, so will need to see how it turns out. :)