Shoud we add internal shortcodes for popular services?

Shortcodes are small and reusable code snippets for a variety of common usecases: to easily embed a Youtube video, your last presentation on Speakerdeck, a Github gist for a tutorial and so on.

Why shouldn’t we add a number of shortcodes for the most popular usecases and services. New users could use them out of the box without the need of creating them manually. And API usually don’t change their design radically from one day to the other. So maintaince would not be a big issue.

/ cc @bep @spf13


As long as the user can override the built-ins.

This was one of my intentions. This would be the case if your own shortcode has the same name as an internal one.

user override has been supported for a long time now. It’s one of Hugo’s principles, “sane defaults but customizable by the user”.

1 Like

I’ve created an issue on Github. See #1576.

Feel free to suggest more usecases that you would like to use.

Update: Currently I’ve added the following shortcodes to the pull request:

  • Twitter
  • Speakerdeck presentations
  • YouTube videos
  • Vimeo videos
  • Github gists

Personally I’m for keeping Hugo [and the sites it generates] as lean & mean as possible. I get a bit OCD about removing unused ‘bloat’ sometiimes. So, for me, a load of extra shortcodes I wasn’t using would be just that; extra bloat.

That said, I’m not into re-inventing the wheel either. So, maybe a separate repo for user-contributed shortcodes would be a useful resource.

1 Like

This is internal Hugo templates – if you don’t use them, you don’t see or feel them.

Hello and thank you so much for developing the video shortcodes. They work great!!

I was wondering if it’s possible to specify some of the video embed settings in the youtube shortcode.

For example, I would like to specify a custom image url for the thumbnail / poster image. Also set autoplay to true.

Hello @Shiva,

I’ll have a look at the options that could be added to the embeddable video player. It should be hard to add them with a few optional shortcode parameters.

I’ve created a pull request to add the option to autoplay a video a the page was loaded.

However, after googling for examples for the integration of a custom thumbnail I came to the conclusion that the code of the shortcode logic would end up very messy. I didn’t found a path as parameter that could be appended to the url. Instead I would need to add a HTML wrapper around the current code and only if the parameter is set.

Thanks @digitalcraftsman, wow that was fast! I really appreciate your help.

I’ll check out your pull request. Meanwhile, I guess if I must have a poster image, I am down to using the youtube iframe embed code, is that right? And yes, you are correct in that custom thumbnails are messy and not recommended for youtube embed.