Embedding tweets

I was wondering if there was a way to “embed a tweet” into a post.

I know that embedding in general is possible, via Hugo shortcodes: using {{< youtube ... >}} works.

However, using the {{<tweet user="..." id="..." >}} shortcode doesn’t; the failure is having something like HAHAHUGOSHORTCODE-0xc000e7f900-1-HBHB show up in the rendered output.

So, Is this something that’s supposed to work?

(Has anyone ever embedded a tweet? Is there a reason why shortcodes are treated differently?)


I embedded a tweet successfully just now. So it’s supposed to work.

However, how you use the shortcode differs depending on the Hugo version. You can see your blog’s version by navigating to Design and looking for the label Hugo version.

Embed a tweet using Hugo 0.54:

{{< tweet 20 >}}

Embed a tweet using Hugo 0.91:

{{< tweet user="Jack" id="20" >}}

Doing the above ended up looking like this on my test blog:

1 Like

Hi! This is an only somewhat related follow up question. If I need to start a new thread, please let me know.

I’m trying to embed something from Apple Music. I’ve found blog posts, etc. related to creating a custom shortcode. Would I need to do that in order to embed Apple Music stuff? Is that even possible to do with micro.blog?

<iframe allow="autoplay *; encrypted-media *;" frameborder="0" height="450" style="width:100%;max-width:660px;overflow:hidden;background:transparent;" sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation" src="https://embed.music.apple.com/us/album/smile/24245496"></iframe>

Yes, pasting in the Apple Music embed code should work fine in a Micro.blog blog post. Note that the full iframe tag is not supported in the Micro.blog timeline, so instead Micro.blog will try to make it a link to Apple Music. But on your actual microblog on the web it will look correct.