Open navClose nav

Hugo Shortcodes

You can extend the functionality of Markdown in Hugo with shortcodes. Shortcodes are special templates that are called when a shortcode is used inside the content body.

They can be used to add custom markup, format text, generate HTML elements, or pull in data from external sources.

Using Shortcodes in Forestry

You can use Forestry Snippets to configure shortcodes in the editor. You can also use Hugo shortcodes directly, in the format Hugo requires them in the content file.

For example, using Hugo’s built-in figure shortcode, a user may enter the following into the content body:

https://res.cloudinary.com/forestry-io/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/example.jpg

Example Image

This could be configured as a Forestry snippet for ease of use.

Built-in Shortcodes

Hugo ships with a collection of built-in shortcodes for modifying the output of your content body.

Custom Shortcodes

Hugo also allows you to build your own shortcodes.

Further Reading


Last updated on July 24, 2017