---
title: "Shortcodes"
date: "2013-07-01"
aliases: ["/doc/shortcodes/"]
weight: 10
menu:
main:
parent: 'extras'
---
Because Hugo uses markdown for its simple content format, however there's a lot
of things that markdown doesn't support well.
We are unwilling to accept being constrained by our simple format. Also
unacceptable is writing raw html in our markdown every time we want to include
unsupported content such as a video. To do so is in complete opposition to the
intent of using a bare bones format for our content and utilizing templates to
apply styling for display.
To avoid both of these limitations Hugo created shortcodes.
A shortcode is a simple snippet inside a markdown file that Hugo will render
using a predefined template.
## Using a shortcode
In your content files a shortcode can be called by using '{{% name parameters
%}}' respectively. Shortcodes are space delimited (parameters with spaces
can be quoted).
The first word is always the name of the shortcode. Parameters follow the name.
The format for named parameters models that of html with the format
name="value". The current implementation only supports this exact format. Extra
spaces or different quote marks will not parse properly.
Some shortcodes use or require closing shortcodes. Like HTML, the opening and closing
shortcodes match (name only), the closing being prepended with a slash.
Example of a paired shortcode:
{{ % highlight go %}} A bunch of code here {{ % /highlight %}}
## Hugo Shortcodes
Hugo ships with a set of predefined shortcodes.
### highlight
This shortcode will convert the source code provided into syntax highlighted
html. Read more on [highlighting](/extras/highlighting).
#### Usage
Highlight takes exactly one required parameter of language and requires a
closing shortcode.
#### Example
The example has an extra space between the “{{” and “%” characters to prevent rendering here.
{{ % highlight html %}}
{{ .Title }}
{{ range .Data.Pages }}
{{ .Render "summary"}}
{{ end }}
<html>
<body> This HTML </body>
</html>