5.8 KiB
title | description | categories | keywords | menu | weight | toc | aliases | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Content formats | Both HTML and Markdown are supported content formats. |
|
|
|
40 | true |
|
You can put any file type into your /content
directories, but Hugo uses the markup
front matter value if set or the file extension (see Markup identifiers
in the table below) to determine if the markup needs to be processed, e.g.:
- Markdown converted to HTML
- Shortcodes processed
- Layout applied
List of content formats
The current list of content formats in Hugo:
Name | Markup identifiers | Comment |
---|---|---|
Goldmark | markdown , goldmark |
Note that you can set the default handler of md and markdown to something else, see Configure Markup. |
Emacs Org-Mode | org |
See go-org. |
AsciiDoc | asciidocext , adoc , ad |
Needs Asciidoctor installed. |
RST | rst |
Needs RST installed. |
Pandoc | pandoc , pdc |
Needs Pandoc installed. |
HTML | html , htm |
To be treated as a content file, with layout, shortcodes etc., it must have front matter. If not, it will be copied as-is. |
The markup identifier
is fetched from either the markup
variable in front matter or from the file extension. For markup-related configuration, see Configure Markup.
External helpers
Some of the formats in the table above need external helpers installed on your PC. For example, for AsciiDoc files,
Hugo will try to call the asciidoctor
command. This means that you will have to install the associated
tool on your machine to be able to use these formats.
Hugo passes reasonable default arguments to these external helpers by default:
asciidoctor
:--no-header-footer -
rst2html
:--leave-comments --initial-header-level=2
pandoc
:--mathjax
and, for pandoc >= 2.11,--citeproc
{{% note %}} Because additional formats are external commands, generation performance will rely heavily on the performance of the external tool you are using. As this feature is still in its infancy, feedback is welcome. {{% /note %}}
Asciidoctor
The Asciidoctor community offers a wide set of tools for the AsciiDoc format that can be installed additionally to Hugo.
See the Asciidoctor docs for installation instructions. Make sure that also all
optional extensions like asciidoctor-diagram
or asciidoctor-html5s
are installed if required.
{{% note %}}
External asciidoctor
command requires Hugo rendering to disk to a specific destination directory. It is required to run Hugo with the command option --destination
.
{{% /note %}}
Some Asciidoctor parameters can be customized in Hugo. See details.
External Helper Pandoc
Pandoc is a universal document converter and can be used to convert markdown files.
In Hugo, Pandoc can be used for LaTeX-style math (the --mathjax
command line option is provided):
---
title: Math document
---
Some inline math: $a^2 + b^2 = c^2$.
This will render in your HTML as:
<p>Some inline math: <span class="math inline">\(a^2 + b^2 = c^2\)</span></p>
You will have to add MathJax to your template to properly render the math.
For Pandoc >= 2.11, you can use citations. One way is to employ BibTeX files to cite:
---
title: Citation document
---
---
bibliography: assets/bibliography.bib
...
This is a citation: @Doe2022
Note that Hugo will not pass its metadata YAML block to Pandoc; however, it will pass the second meta data block, denoted with ---
and ...
to Pandoc.
Thus, all Pandoc settings should go there.
You can also add all elements from a bibliography file (without citing them explicitly) using:
---
title: My Publications
---
---
bibliography: assets/bibliography.bib
nocite: |
@*
...
It is also possible to provide a custom CSL style by passing csl: path-to-style.csl
as a Pandoc option.
Learn Markdown
Markdown syntax is simple enough to learn in a single sitting. The following are excellent resources to get you up and running: