Built-in Shortcodes

Shortcodes are simple snippets inside your content files calling built-in or custom templates.
What a Shortcode Is
Hugo loves Markdown because of its simple content format, but there are times when Markdown falls short. Often, content authors are forced to add raw HTML (e.g., video <iframe>’s) to Markdown content. We think this contradicts the beautiful simplicity of Markdown’s syntax.
Hugo created shortcodes to circumvent these limitations.
A shortcode is a simple snippet inside a content file that Hugo will render using a predefined template. Note that shortcodes will not work in template files. If you need the type of drop-in functionality that shortcodes provide but in a template, you most likely want a partial template instead.
In addition to cleaner Markdown, shortcodes can be updated any time to reflect new classes, techniques, or standards. At the point of site generation, Hugo shortcodes will easily merge in your changes. You avoid a possibly complicated search and replace operation.
Use Shortcodes
- Shortcodes with raw string parameters ` `
- Shortcodes with Markdown
% % - Shortcodes without Markdown
< >
See more details in the Use Shortcodes section.
Embedded Shortcodes
Use these Hugo’s embedded shortcodes as needed.
layouts/shortcodes directory.Figure
Example figure input:
| |
The rendered output looks like this:

Lighthouse (figure)
The HTML looks like this:
| |
Gist
Example gist input:
| |
The rendered output looks like this:
The HTML looks like this:
| |
Highlight
Example highlight input:
| |
The rendered output looks like this:
| |
Example instagram input:
| |
The rendered output looks like this:
Param
Example param input:
| |
The rendered output looks like this:
Shortcodes are simple snippets inside your content files calling built-in or custom templates.Ref
Documentation of
refshortcode.Always use the
{{% %}}notation when calling this shortcode.
Example ref input:
| |
The rendered output looks like this:
The HTML looks like this:
| |
Relref
Documentation of
relrefshortcode.Always use the
{{% %}}notation when calling this shortcode.
Example relref input:
| |
The rendered output looks like this:
The HTML looks like this:
| |
Documentation of twitter shortcode
Example twitter input:
| |
The rendered output looks like this:
Owl bet you'll lose this staring contest 🦉 pic.twitter.com/eJh4f2zncC
— San Diego Zoo Wildlife Alliance (@sandiegozoo) October 26, 2021
Vimeo
Documentation of vimeo shortcode
Example vimeo input:
| |
The rendered output looks like this:
Youtube
Documentation of youtube shortcode
Example youtube input:
| |
The rendered output looks like this:
Privacy Configuration
To learn how to configure your Hugo site to meet the new EU privacy regulation, see privacy protections.