Youtube Embeds

I’ve searched the help and the web and I can’t seem to figure out if MB does any auto-embedding of YouTube videos. Based on my recent post, that answer is no. Or, if there’s a way I can make this happen with the right Markdown incantation. Or, do I need to do all the HTML. If it’s the latter, is that possible in the MB iOS app?

Hugo (the blogging engine powering comes with a clever little feature called shortcodes. And there’s one for embedding YouTube videos. Just pass it the YouTube identifier like this:

{{< youtube w7Ft2ymGmfc >}}
1 Like

I didn’t think to look at the Hugo documentation! Thanks!

Note: embeds of all kinds are stripped out of the timeline. Your blog and RSS will all look good though.

To add one more thing: for YouTube embeds specifically (and Apple Music and Spotify too, because they are also common embeds), will show a link in the timeline instead of the embed, so that people viewing the timeline can still click out to it. And then as @jsonbecker said, if they’re reading on your blog post they will get the full embed.

Thanks for the details and explanations. It looks like Hugo supports custom shortcodes. Is that possible with MB or should I figure out how to use a partial for that use case. Specifically, I’d love to create one for Bandcamp embeds. Maybe that’s possible in a plugin scenario?

Yes, a plug-in can provide a custom Hugo shortcode. One example to check out: I made this RSVP plug-in. Really all you need is a template in layouts/shortcodes and you’re good to go. That can be a custom template just for your blog, or as a plug-in so other folks can install it easily.

1 Like

Here’s another good shortcode example for @jsonbecker’s Bookshop plug-in. (Better than my RSVP example, actually, because the Bookshop shortcode supports different types of parameters.)

1 Like

Looks like I have a little Friday afternoon project. Thanks!

1 Like