Hugo can output content in multiple formats, including calendar events, e-book formats, Google AMP, and JSON search indexes, or any custom text format.
This page describes how to properly configure your site with the media types and output formats, as well as where to create your templates for your custom outputs.
Media Types
A
media type
(also known as MIME type and content type ) is a two-part identifier for file formats and format contents transmitted on the Internet.
This is the full set of built-in media types in Hugo:
Title Author Date
A visit to the Workshop: Hugo/Unix/Vim integration fREW Schmidt 2017-07-22
Hugo Easy Gallery - Automagical PhotoSwipe image gallery with a one-line shortcode Li-Wen Yip 2017-03-25
Automagical Image Gallery in Hugo with PhotoSwipe and jQuery Li-Wen Yip 2017-03-04
Adding Isso Comments to Hugo Stíobhart Matulevicz 2017-02-24
Hugo Tutorial: How to Build & Host a (Very Fast) Static E-Commerce Site Snipcart 2017-02-23
How to Password Protect a Hugo Site Aerobatic 2017-02-19
Switching from WordPress to Hugo Mario Martelli 2017-02-19
Zero to HTTP/2 with AWS and Hugo Josh Habdas 2017-02-16
Deploy a Hugo site to Aerobatic with CircleCI Aerobatic 2017-02-14
NPM scripts for building and deploying Hugo site Aerobatic 2017-02-12
Getting started with Hugo and the plain-blog theme, on NearlyFreeSpeech.Net Li-aung “Lewis” Yip 2017-02-12
Choose Hugo over Jekyll Josh Habdas 2017-02-10
Build a Hugo site using Cloud9 IDE and host on App Engine Pascal Aubort 2017-02-05
Hugo Continuous Deployment with Bitbucket Pipelines and Aerobatic Aerobatic 2017-02-04
How to use Firebase to host a Hugo site Andrew Cuga 2017-02-04
A publishing workflow for teams using static site generators Tom Atkins 2017-01-02
How To Dynamically Use Google Fonts In A Hugo Website Hash Borgir 2016-10-27
Embedding Facebook In A Hugo Template Hash Borgir 2016-10-22
通过 Gitlab-cl 将 Hugo blog 自动部署至 GitHub (Chinese, Continuous integration) Zetao Yang 2016-10-17
A Step-by-Step Guide: Hugo on Netlify Eli Williamson 2016-09-21
Building our site: From Django & WordPress to a static generator (Part I) Alan Descoins 2016-09-20
Webseitenmaschine - Statische Websites mit Hugo erzeugen (German, $) Christian Helmbold 2016-05-27
Cómo hacer sitios web estáticos con Hugo y Go - Platzi (Video tutorial) Verónica López 2016-04-06
CDNOverview: A CDN comparison site made with Hugo Thijs de Zoete 2016-02-23
Hugo: A Modern WebSite Engine That Just Works Shekhar Gulati 2016-02-14
Minify Hugo Generated HTML Ratson 2016-02-02
HugoのデプロイをWerckerからCircle CIに変更した - log Deprode 2016-01-17
Static site generators: el futuro de las webs estáticas(Hugo, Jekyll, Flask y otros) Eneko Sarasola 2016-01-09
Writing a Lambda Function for Hugo Jeremy Olexa 2016-01-01
Ein Blog mit Hugo erstellen - Tutorial (Deutsch/German) Bernhard Albicker 2015-12-30
How to host Hugo static website generator on AWS Lambda Ilya Bezdelev 2015-12-15
Migrating from Pelican to Hugo Salar Rahmanian 2015-11-29
Static Website Generators Reviewed: Jekyll, Middleman, Roots, Hugo Mathias Biilmann Christensen 2015-11-16
How To Deploy a Hugo Site to Production with Git Hooks on Ubuntu 14.04 Justin Ellingwood 2015-11-12
How To Install and Use Hugo, a Static Site Generator, on Ubuntu 14.04 Justin Ellingwood 2015-11-09
Switching from Wordpress to Hugo Justin Israel 2015-11-08
Hands-on Experience with Hugo as a Static Site Generator Thomas Peham 2015-10-15
Statische Webseites mit Hugo erstellen/Vortrag mit Foliensatz (deutsch) Harald Weidner 2015-09-19
Moving from WordPress to Hugo Abhishek Pandey 2015-09-15
通过webhook将Hugo自动部署至GitHub Pages和GitCafe Pages (Automated deployment) CoderZh 2015-09-13
使用hugo搭建个人博客站点 (Using Hugo to build a personal blog site) CoderZh 2015-08-29
Good-Bye Wordpress, Hello Hugo! (German) Armin Hanisch 2015-08-18
Générer votre site web statique avec Hugo (Generate your static site with Hugo) Benoît Benedetti 2015-06-26
Hugo向けの新しいテーマを作った (I created a new theme for Hugo) Daisuke Tsuji 2015-06-20
Hugo - Gerando um site com conteúdo estático. (Portuguese Brazil) Fabiano Frizzo 2015-06-02
An Introduction to Static Site Generators Eduardo Bouças 2015-05-20
Hugo Still Rules Cheeky Coder 2015-05-18
hugo - Static Site Generator G Scaccoio 2015-05-04
WindowsでHugoを使う うれ太郎 2015-05-01
Hugoのshortcodesを用いてサイトにスライドなどを埋め込む Yucchiy 2015-04-29
HugoとCircleCIでGitHub PagesにBlogを公開してみたら超簡単だった Hori Ryota 2015-04-17
10 Best Static Site Generators Aniruddha Mysore 2015-04-06
Goodbye WordPress; Hello Hugo Will Warren 2015-04-05
Static Websites with Hugo on Google Cloud Storage Moxie Input/Output 2015-04-02
De nuevo iniciando un blog Alvaro Lizama 2015-03-29
We moved our blog from Posthaven to Hugo after only three posts. Why? Hypriot 2015-03-27
Top Static Site Generators in 2015 Kanishk Kunal 2015-03-12
Moving to Hugo Abiola Ibrahim 2015-03-08
Migrating a blog (yes, this one!) from Wordpress to Hugo Justin Dunham 2015-02-13
blogをoctopressからHugoに乗り換えたメモ jigyakkuma 2015-02-11
Hugoでブログをつくった porgy13 2015-02-07
Hugoにブログを移行した Keichi Takahashi 2015-02-04
Hugo静态网站生成器中文教程 Nanshu Wang 2015-01-31
Hugo + Github Pages + Wercker CI = ¥0(無料)でコマンド 1 発(自動化)でサイト・ブログを公開・運営・分析・収益化 Yohei Yoshimuta 2015-01-31
Running Hugo websites on anynines Julian Weber 2015-01-30
MiddlemanからHugoへ移行した Haruki Konishi 2015-01-21
WordPress から Hugo に乗り換えました rakuishi 2015-01-20
HUGOを使ってサイトを立ち上げる方法 Syui 2015-01-17
Jekyllが許されるのは小学生までだよね Ishimoto Koji 2015-01-16
Getting started with Hugo Anthony Fok 2015-01-12
把这个博客静态化了 (Migrate to Hugo) Li Cheng 2015-01-03
Porting my blog with Hugo Stuart Rackham 2014-12-30
Hugoを使ってみたときのメモ Machortz 2014-12-29
OctopressからHugoへ移行した Taichi Nakashima 2014-12-25
Migrating to Hugo From Octopress Nathan LeClaire 2014-12-22
Dynamic Pages with GoHugo.io Cyrill Schumacher 2014-12-21
6 Static Blog Generators That Aren’t Jekyll David Turnbull 2014-12-08
Travel Blogging Setup Rasmus Stougaard 2014-11-23
Hosting A Hugo Website Behind Nginx Rick Beton 2014-11-20
使用Hugo搭建免费个人Blog (How to use Hugo) Ulric Qin 秦晓辉 2014-11-11
Built in Speed and Built for Speed by Hugo Cheeky Coder 2014-10-30
Hugo para crear sitios web estáticos Web Bizarro 2014-08-19
Going with hugo Markus Eliasson 2014-08-18
Benchmarking Jekyll, Hugo and Wintersmith Fredrik Loch 2014-08-12
Goodbye Octopress, Hello Hugo! Andrei Mihu 2014-08-11
Beautiful sites for Open Source projects Beautiful Open 2014-08-09
Hugo: Beyond the Defaults Nate Finch 2014-08-08
First Impressions of Hugo Peter Aba 2014-06-06
New Site Workflow Giles Paterson 2014-08-05
How I Learned to Stop Worrying and Love the (Static) Web Joshua McKenty 2014-08-04
Hugo - Static Site Generator Kenny Woo 2014-08-03
Hugo Is Friggin’ Awesome Nate Finch 2014-08-01
再次搬家 (Move from WordPress to Hugo) 青砾 (chingli) 2014-07-12
Embedding Gists in Hugo Dan Mull 2014-07-05
An Introduction To Hugo Dan Silber 2014-07-01
Moving to Hugo Dan Mull 2014-05-29
开源之静态站点生成器排行榜(Leaderboard of open-source static website generators) CSDN.net 2014-05-23
Finally, a satisfying and effective blog setup Michael Whatcott 2014-05-20
Hugo from scratch Zack Williams 2014-05-18
Why I switched away from Jekyll Jake Januzelli 2014-05-10
Welcome our new blog Ninya.io 2014-04-11
Mission Not Accomplished Dave Johnston 2014-04-03
Hugo - A Static Site Builder in Go Deep Fried Code 2014-03-30
Adventures in Angular Podcast Matias Niemela 2014-03-28
Hugo bra.am 2014-03-23
Converting Blogger To Markdown Trisha Gee 2014-03-20
Moving to Hugo Static Web Pages Tobias Weingartner 2014-03-16
New Blog Engine: Hugo fREW Schmidt 2014-03-15
Hugo + gulp.js = Huggle Jesse Yang 杨建超 2014-03-08
Powered by Hugo Kieran Healy 2014-02-24
静的サイトを素早く構築するためにGoLangで作られたジェネレータHugo 2014-02-21
Latest Roundup of Useful Tools For Developers CodeGeekz 2014-02-13
Hugo: Static Site Generator written in Go Brave Terry 2014-02-06
10 Useful HTML5 Tools for Web Designers and Developers Design Dizzy 2014-02-04
Hugo – Fast, Flexible Static Site Generator Joby Joseph 2014-01-18
Hugo: A new way to build static website w3update 2014-01-17
Xaprb now uses Hugo Baron Schwartz 2014-01-15
New jQuery Plugins And Resources That Web Designers Need Design Your Way 2014-01-01
On Blog Construction Alexander Lash 2013-12-27
Hugo One Thing Well 2013-12-05
In Praise Of Hugo sound-guru.com 2013-10-19
Hosting a blog on S3 and Cloudfront Dan Esparza 2013-07-24
Note:
It is possible to add custom media types or change the defaults; e.g., if you want to change the suffix for text/html
to asp
. Suffixes
are the values that will be used for URLs and filenames for that media type in Hugo.The Type
is the identifier that must be used when defining new/custom Output Formats
(see below). The full set of media types will be registered in Hugo’s built-in development server to make sure they are recognized by the browser. To add or modify a media type, define it in a mediaTypes
section in your
site configuration
, either for all sites or for a given language.
config.yaml
config.toml
config.json
mediaTypes :
text/enriched :
suffixes :
- enr
text/html :
suffixes :
- asp
[ mediaTypes ]
[ mediaTypes . 'text/enriched' ]
suffixes = [ 'enr' ]
[ mediaTypes . 'text/html' ]
suffixes = [ 'asp' ]
{
"mediaTypes" : {
"text/enriched" : {
"suffixes" : [
"enr"
]
},
"text/html" : {
"suffixes" : [
"asp"
]
}
}
}
The above example adds one new media type, text/enriched
, and changes the suffix for the built-in text/html
media type.
Note: these media types are configured for your output formats . If you want to redefine one of Hugo’s default output formats (e.g. HTML
), you also need to redefine the media type. So, if you want to change the suffix of the HTML
output format from html
(default) to htm
:
[ mediaTypes ]
[ mediaTypes . "text/html" ]
suffixes = [ "htm" ]
# Redefine HTML to update its media type.
[ outputFormats ]
[ outputFormats . HTML ]
mediaType = "text/html"
Note that for the above to work, you also need to add an outputs
definition in your site config.
Output Format Definitions
Given a media type and some additional configuration, you get an Output Format .
This is the full set of Hugo’s built-in output formats:
Title Author Date
A visit to the Workshop: Hugo/Unix/Vim integration fREW Schmidt 2017-07-22
Hugo Easy Gallery - Automagical PhotoSwipe image gallery with a one-line shortcode Li-Wen Yip 2017-03-25
Automagical Image Gallery in Hugo with PhotoSwipe and jQuery Li-Wen Yip 2017-03-04
Adding Isso Comments to Hugo Stíobhart Matulevicz 2017-02-24
Hugo Tutorial: How to Build & Host a (Very Fast) Static E-Commerce Site Snipcart 2017-02-23
How to Password Protect a Hugo Site Aerobatic 2017-02-19
Switching from WordPress to Hugo Mario Martelli 2017-02-19
Zero to HTTP/2 with AWS and Hugo Josh Habdas 2017-02-16
Deploy a Hugo site to Aerobatic with CircleCI Aerobatic 2017-02-14
NPM scripts for building and deploying Hugo site Aerobatic 2017-02-12
Getting started with Hugo and the plain-blog theme, on NearlyFreeSpeech.Net Li-aung “Lewis” Yip 2017-02-12
Choose Hugo over Jekyll Josh Habdas 2017-02-10
Build a Hugo site using Cloud9 IDE and host on App Engine Pascal Aubort 2017-02-05
Hugo Continuous Deployment with Bitbucket Pipelines and Aerobatic Aerobatic 2017-02-04
How to use Firebase to host a Hugo site Andrew Cuga 2017-02-04
A publishing workflow for teams using static site generators Tom Atkins 2017-01-02
How To Dynamically Use Google Fonts In A Hugo Website Hash Borgir 2016-10-27
Embedding Facebook In A Hugo Template Hash Borgir 2016-10-22
通过 Gitlab-cl 将 Hugo blog 自动部署至 GitHub (Chinese, Continuous integration) Zetao Yang 2016-10-17
A Step-by-Step Guide: Hugo on Netlify Eli Williamson 2016-09-21
Building our site: From Django & WordPress to a static generator (Part I) Alan Descoins 2016-09-20
Webseitenmaschine - Statische Websites mit Hugo erzeugen (German, $) Christian Helmbold 2016-05-27
Cómo hacer sitios web estáticos con Hugo y Go - Platzi (Video tutorial) Verónica López 2016-04-06
CDNOverview: A CDN comparison site made with Hugo Thijs de Zoete 2016-02-23
Hugo: A Modern WebSite Engine That Just Works Shekhar Gulati 2016-02-14
Minify Hugo Generated HTML Ratson 2016-02-02
HugoのデプロイをWerckerからCircle CIに変更した - log Deprode 2016-01-17
Static site generators: el futuro de las webs estáticas(Hugo, Jekyll, Flask y otros) Eneko Sarasola 2016-01-09
Writing a Lambda Function for Hugo Jeremy Olexa 2016-01-01
Ein Blog mit Hugo erstellen - Tutorial (Deutsch/German) Bernhard Albicker 2015-12-30
How to host Hugo static website generator on AWS Lambda Ilya Bezdelev 2015-12-15
Migrating from Pelican to Hugo Salar Rahmanian 2015-11-29
Static Website Generators Reviewed: Jekyll, Middleman, Roots, Hugo Mathias Biilmann Christensen 2015-11-16
How To Deploy a Hugo Site to Production with Git Hooks on Ubuntu 14.04 Justin Ellingwood 2015-11-12
How To Install and Use Hugo, a Static Site Generator, on Ubuntu 14.04 Justin Ellingwood 2015-11-09
Switching from Wordpress to Hugo Justin Israel 2015-11-08
Hands-on Experience with Hugo as a Static Site Generator Thomas Peham 2015-10-15
Statische Webseites mit Hugo erstellen/Vortrag mit Foliensatz (deutsch) Harald Weidner 2015-09-19
Moving from WordPress to Hugo Abhishek Pandey 2015-09-15
通过webhook将Hugo自动部署至GitHub Pages和GitCafe Pages (Automated deployment) CoderZh 2015-09-13
使用hugo搭建个人博客站点 (Using Hugo to build a personal blog site) CoderZh 2015-08-29
Good-Bye Wordpress, Hello Hugo! (German) Armin Hanisch 2015-08-18
Générer votre site web statique avec Hugo (Generate your static site with Hugo) Benoît Benedetti 2015-06-26
Hugo向けの新しいテーマを作った (I created a new theme for Hugo) Daisuke Tsuji 2015-06-20
Hugo - Gerando um site com conteúdo estático. (Portuguese Brazil) Fabiano Frizzo 2015-06-02
An Introduction to Static Site Generators Eduardo Bouças 2015-05-20
Hugo Still Rules Cheeky Coder 2015-05-18
hugo - Static Site Generator G Scaccoio 2015-05-04
WindowsでHugoを使う うれ太郎 2015-05-01
Hugoのshortcodesを用いてサイトにスライドなどを埋め込む Yucchiy 2015-04-29
HugoとCircleCIでGitHub PagesにBlogを公開してみたら超簡単だった Hori Ryota 2015-04-17
10 Best Static Site Generators Aniruddha Mysore 2015-04-06
Goodbye WordPress; Hello Hugo Will Warren 2015-04-05
Static Websites with Hugo on Google Cloud Storage Moxie Input/Output 2015-04-02
De nuevo iniciando un blog Alvaro Lizama 2015-03-29
We moved our blog from Posthaven to Hugo after only three posts. Why? Hypriot 2015-03-27
Top Static Site Generators in 2015 Kanishk Kunal 2015-03-12
Moving to Hugo Abiola Ibrahim 2015-03-08
Migrating a blog (yes, this one!) from Wordpress to Hugo Justin Dunham 2015-02-13
blogをoctopressからHugoに乗り換えたメモ jigyakkuma 2015-02-11
Hugoでブログをつくった porgy13 2015-02-07
Hugoにブログを移行した Keichi Takahashi 2015-02-04
Hugo静态网站生成器中文教程 Nanshu Wang 2015-01-31
Hugo + Github Pages + Wercker CI = ¥0(無料)でコマンド 1 発(自動化)でサイト・ブログを公開・運営・分析・収益化 Yohei Yoshimuta 2015-01-31
Running Hugo websites on anynines Julian Weber 2015-01-30
MiddlemanからHugoへ移行した Haruki Konishi 2015-01-21
WordPress から Hugo に乗り換えました rakuishi 2015-01-20
HUGOを使ってサイトを立ち上げる方法 Syui 2015-01-17
Jekyllが許されるのは小学生までだよね Ishimoto Koji 2015-01-16
Getting started with Hugo Anthony Fok 2015-01-12
把这个博客静态化了 (Migrate to Hugo) Li Cheng 2015-01-03
Porting my blog with Hugo Stuart Rackham 2014-12-30
Hugoを使ってみたときのメモ Machortz 2014-12-29
OctopressからHugoへ移行した Taichi Nakashima 2014-12-25
Migrating to Hugo From Octopress Nathan LeClaire 2014-12-22
Dynamic Pages with GoHugo.io Cyrill Schumacher 2014-12-21
6 Static Blog Generators That Aren’t Jekyll David Turnbull 2014-12-08
Travel Blogging Setup Rasmus Stougaard 2014-11-23
Hosting A Hugo Website Behind Nginx Rick Beton 2014-11-20
使用Hugo搭建免费个人Blog (How to use Hugo) Ulric Qin 秦晓辉 2014-11-11
Built in Speed and Built for Speed by Hugo Cheeky Coder 2014-10-30
Hugo para crear sitios web estáticos Web Bizarro 2014-08-19
Going with hugo Markus Eliasson 2014-08-18
Benchmarking Jekyll, Hugo and Wintersmith Fredrik Loch 2014-08-12
Goodbye Octopress, Hello Hugo! Andrei Mihu 2014-08-11
Beautiful sites for Open Source projects Beautiful Open 2014-08-09
Hugo: Beyond the Defaults Nate Finch 2014-08-08
First Impressions of Hugo Peter Aba 2014-06-06
New Site Workflow Giles Paterson 2014-08-05
How I Learned to Stop Worrying and Love the (Static) Web Joshua McKenty 2014-08-04
Hugo - Static Site Generator Kenny Woo 2014-08-03
Hugo Is Friggin’ Awesome Nate Finch 2014-08-01
再次搬家 (Move from WordPress to Hugo) 青砾 (chingli) 2014-07-12
Embedding Gists in Hugo Dan Mull 2014-07-05
An Introduction To Hugo Dan Silber 2014-07-01
Moving to Hugo Dan Mull 2014-05-29
开源之静态站点生成器排行榜(Leaderboard of open-source static website generators) CSDN.net 2014-05-23
Finally, a satisfying and effective blog setup Michael Whatcott 2014-05-20
Hugo from scratch Zack Williams 2014-05-18
Why I switched away from Jekyll Jake Januzelli 2014-05-10
Welcome our new blog Ninya.io 2014-04-11
Mission Not Accomplished Dave Johnston 2014-04-03
Hugo - A Static Site Builder in Go Deep Fried Code 2014-03-30
Adventures in Angular Podcast Matias Niemela 2014-03-28
Hugo bra.am 2014-03-23
Converting Blogger To Markdown Trisha Gee 2014-03-20
Moving to Hugo Static Web Pages Tobias Weingartner 2014-03-16
New Blog Engine: Hugo fREW Schmidt 2014-03-15
Hugo + gulp.js = Huggle Jesse Yang 杨建超 2014-03-08
Powered by Hugo Kieran Healy 2014-02-24
静的サイトを素早く構築するためにGoLangで作られたジェネレータHugo 2014-02-21
Latest Roundup of Useful Tools For Developers CodeGeekz 2014-02-13
Hugo: Static Site Generator written in Go Brave Terry 2014-02-06
10 Useful HTML5 Tools for Web Designers and Developers Design Dizzy 2014-02-04
Hugo – Fast, Flexible Static Site Generator Joby Joseph 2014-01-18
Hugo: A new way to build static website w3update 2014-01-17
Xaprb now uses Hugo Baron Schwartz 2014-01-15
New jQuery Plugins And Resources That Web Designers Need Design Your Way 2014-01-01
On Blog Construction Alexander Lash 2013-12-27
Hugo One Thing Well 2013-12-05
In Praise Of Hugo sound-guru.com 2013-10-19
Hosting a blog on S3 and Cloudfront Dan Esparza 2013-07-24
A page can be output in as many output formats as you want, and you can have an infinite amount of output formats defined as long as they resolve to a unique path on the file system . In the above table, the best example of this is AMP
vs. HTML
. AMP
has the value amp
for Path
so it doesn’t overwrite the HTML
version; e.g. we can now have both /index.html
and /amp/index.html
. The MediaType
must match the Type
of an already defined media type. You can define new output formats or redefine built-in output formats; e.g., if you want to put AMP
pages in a different path. To add or modify an output format, define it in an outputFormats
section in your site’s
configuration file
, either for all sites or for a given language.
config.yaml
config.toml
config.json
outputFormats :
MyEnrichedFormat :
baseName : myindex
isPlainText : true
mediaType : text/enriched
protocol : bep://
[ outputFormats ]
[ outputFormats . MyEnrichedFormat ]
baseName = 'myindex'
isPlainText = true
mediaType = 'text/enriched'
protocol = 'bep://'
{
"outputFormats" : {
"MyEnrichedFormat" : {
"baseName" : "myindex" ,
"isPlainText" : true ,
"mediaType" : "text/enriched" ,
"protocol" : "bep://"
}
}
}
The above example is fictional, but if used for the homepage on a site with baseURL
https://example.org
, it will produce a plain text homepage with the URL bep://example.org/myindex.enr
.
Configure Output Formats
The following is the full list of configuration options for output formats and their default values:
name
the output format identifier. This is used to define what output format(s) you want for your pages. mediaType
this must match the Type
of a defined media type. path
sub path to save the output files. baseName
the base filename for the list filenames (homepage, etc.). Default: index
. rel
can be used to create rel
values in link
tags. Default: alternate
. protocol
will replace the “http://” or “https://” in your baseURL
for this output format. isPlainText
use Go’s plain text templates parser for the templates. Default: false
. isHTML
used in situations only relevant for HTML
-type formats; e.g., page aliases. noUgly
used to turn off ugly URLs If uglyURLs
is set to true
in your site. Default: false
. notAlternative
enable if it doesn’t make sense to include this format in an AlternativeOutputFormats
format listing on Page
(e.g., with CSS
). Note that we use the term alternative and not alternate here, as it does not necessarily replace the other format. Default: false
. permalinkable
make .Permalink
and .RelPermalink
return the rendering Output Format rather than main (
see below
). This is enabled by default for HTML
and AMP
. Default: false
.
Output Formats for Pages
A Page
in Hugo can be rendered to multiple output formats on the file
system.
Default Output Formats
Every Page
has a
Kind
attribute, and the default Output
Formats are set based on that.
Kind Default Output Formats
page
HTML
home
HTML, RSS
section
HTML, RSS
taxonomy
HTML, RSS
term
HTML, RSS
Customizing Output Formats
This can be changed by defining an outputs
list of output formats in either
the Page
front matter or in the site configuration (either for all sites or
per language).
Example from site config file:
config.yaml
config.toml
config.json
outputs :
home :
- HTML
- AMP
- RSS
page :
- HTML
[ outputs ]
home = [ 'HTML' , 'AMP' , 'RSS' ]
page = [ 'HTML' ]
{
"outputs" : {
"home" : [
"HTML" ,
"AMP" ,
"RSS"
],
"page" : [
"HTML"
]
}
}
Note that in the above examples, the output formats for section
,
taxonomy
and term
will stay at their default value ["HTML", "RSS"]
.
New in v0.73.0
We have fixed the before confusing page kinds used for taxonomies (see the listing below) to be in line with the terms used when we talk about taxonomies. We have been careful to avoid site breakage, and you should get an ERROR in the console if you need to adjust your outputs
section.
Kind Description Example
home
The landing page for the home page /index.html
page
The landing page for a given page my-post
page (/posts/my-post/index.html
)
section
The landing page of a given section posts
section (/posts/index.html
)
taxonomy
The landing page for a taxonomy tags
taxonomy (/tags/index.html
)
term
The landing page for one taxonomy’s term term awesome
in tags
taxonomy (/tags/awesome/index.html
)
The outputs
definition is per
Page
Kind
(page
, home
, section
, taxonomy
, or term
). The names (e.g. HTML
, AMP
) used must match the Name
of a defined Output Format .
These names are case insensitive. These can be overridden per Page
in the front matter of content files. The following is an example of YAML
front matter in a content file that defines output formats for the rendered Page
:
---
date : "2016-03-19"
outputs :
- html
- amp
- json
---
List Output formats
Each Page
has both an .OutputFormats
(all formats, including the current) and an .AlternativeOutputFormats
variable, the latter of which is useful for creating a link rel
list in your site’s <head>
:
{{ range .AlternativeOutputFormats -}}
< link rel = " {{ .Rel }} " type = " {{ .MediaType.Type }} " href = " {{ .Permalink | safeURL }} " >
{{ end -}}
Link to Output Formats
.Permalink
and .RelPermalink
on Page
will return the first output format defined for that page (usually HTML
if nothing else is defined). This is regardless of the template file they are being called from.
from single.json.json
:
{{ .RelPermalink }} > /that-page/
{{ with .OutputFormats.Get "json" -}}
{{ .RelPermalink }} > /that-page/index.json
{{- end }}
In order for them to return the output format of the current template file instead, the given output format should have its permalinkable
setting set to true.
Same template file as above with json output format’s permalinkable
set to true:
{{ .RelPermalink }} > /that-page/index.json
{{ with .OutputFormats.Get "html" -}}
{{ .RelPermalink }} > /that-page/
{{- end }}
From content files, you can use the
ref
or relref
shortcodes
:
[Neat]({{ < ref "blog/neat.md" "amp" > }} )
[Who]({{ < relref "about.md#who" "amp" > }} )
Templates for Your Output Formats
A new output format needs a corresponding template in order to render anything useful.
The following table shows examples of different output formats, the suffix used, and Hugo’s respective template
lookup order
. All of the examples in the table can:
Title Author Date
A visit to the Workshop: Hugo/Unix/Vim integration fREW Schmidt 2017-07-22
Hugo Easy Gallery - Automagical PhotoSwipe image gallery with a one-line shortcode Li-Wen Yip 2017-03-25
Automagical Image Gallery in Hugo with PhotoSwipe and jQuery Li-Wen Yip 2017-03-04
Adding Isso Comments to Hugo Stíobhart Matulevicz 2017-02-24
Hugo Tutorial: How to Build & Host a (Very Fast) Static E-Commerce Site Snipcart 2017-02-23
How to Password Protect a Hugo Site Aerobatic 2017-02-19
Switching from WordPress to Hugo Mario Martelli 2017-02-19
Zero to HTTP/2 with AWS and Hugo Josh Habdas 2017-02-16
Deploy a Hugo site to Aerobatic with CircleCI Aerobatic 2017-02-14
NPM scripts for building and deploying Hugo site Aerobatic 2017-02-12
Getting started with Hugo and the plain-blog theme, on NearlyFreeSpeech.Net Li-aung “Lewis” Yip 2017-02-12
Choose Hugo over Jekyll Josh Habdas 2017-02-10
Build a Hugo site using Cloud9 IDE and host on App Engine Pascal Aubort 2017-02-05
Hugo Continuous Deployment with Bitbucket Pipelines and Aerobatic Aerobatic 2017-02-04
How to use Firebase to host a Hugo site Andrew Cuga 2017-02-04
A publishing workflow for teams using static site generators Tom Atkins 2017-01-02
How To Dynamically Use Google Fonts In A Hugo Website Hash Borgir 2016-10-27
Embedding Facebook In A Hugo Template Hash Borgir 2016-10-22
通过 Gitlab-cl 将 Hugo blog 自动部署至 GitHub (Chinese, Continuous integration) Zetao Yang 2016-10-17
A Step-by-Step Guide: Hugo on Netlify Eli Williamson 2016-09-21
Building our site: From Django & WordPress to a static generator (Part I) Alan Descoins 2016-09-20
Webseitenmaschine - Statische Websites mit Hugo erzeugen (German, $) Christian Helmbold 2016-05-27
Cómo hacer sitios web estáticos con Hugo y Go - Platzi (Video tutorial) Verónica López 2016-04-06
CDNOverview: A CDN comparison site made with Hugo Thijs de Zoete 2016-02-23
Hugo: A Modern WebSite Engine That Just Works Shekhar Gulati 2016-02-14
Minify Hugo Generated HTML Ratson 2016-02-02
HugoのデプロイをWerckerからCircle CIに変更した - log Deprode 2016-01-17
Static site generators: el futuro de las webs estáticas(Hugo, Jekyll, Flask y otros) Eneko Sarasola 2016-01-09
Writing a Lambda Function for Hugo Jeremy Olexa 2016-01-01
Ein Blog mit Hugo erstellen - Tutorial (Deutsch/German) Bernhard Albicker 2015-12-30
How to host Hugo static website generator on AWS Lambda Ilya Bezdelev 2015-12-15
Migrating from Pelican to Hugo Salar Rahmanian 2015-11-29
Static Website Generators Reviewed: Jekyll, Middleman, Roots, Hugo Mathias Biilmann Christensen 2015-11-16
How To Deploy a Hugo Site to Production with Git Hooks on Ubuntu 14.04 Justin Ellingwood 2015-11-12
How To Install and Use Hugo, a Static Site Generator, on Ubuntu 14.04 Justin Ellingwood 2015-11-09
Switching from Wordpress to Hugo Justin Israel 2015-11-08
Hands-on Experience with Hugo as a Static Site Generator Thomas Peham 2015-10-15
Statische Webseites mit Hugo erstellen/Vortrag mit Foliensatz (deutsch) Harald Weidner 2015-09-19
Moving from WordPress to Hugo Abhishek Pandey 2015-09-15
通过webhook将Hugo自动部署至GitHub Pages和GitCafe Pages (Automated deployment) CoderZh 2015-09-13
使用hugo搭建个人博客站点 (Using Hugo to build a personal blog site) CoderZh 2015-08-29
Good-Bye Wordpress, Hello Hugo! (German) Armin Hanisch 2015-08-18
Générer votre site web statique avec Hugo (Generate your static site with Hugo) Benoît Benedetti 2015-06-26
Hugo向けの新しいテーマを作った (I created a new theme for Hugo) Daisuke Tsuji 2015-06-20
Hugo - Gerando um site com conteúdo estático. (Portuguese Brazil) Fabiano Frizzo 2015-06-02
An Introduction to Static Site Generators Eduardo Bouças 2015-05-20
Hugo Still Rules Cheeky Coder 2015-05-18
hugo - Static Site Generator G Scaccoio 2015-05-04
WindowsでHugoを使う うれ太郎 2015-05-01
Hugoのshortcodesを用いてサイトにスライドなどを埋め込む Yucchiy 2015-04-29
HugoとCircleCIでGitHub PagesにBlogを公開してみたら超簡単だった Hori Ryota 2015-04-17
10 Best Static Site Generators Aniruddha Mysore 2015-04-06
Goodbye WordPress; Hello Hugo Will Warren 2015-04-05
Static Websites with Hugo on Google Cloud Storage Moxie Input/Output 2015-04-02
De nuevo iniciando un blog Alvaro Lizama 2015-03-29
We moved our blog from Posthaven to Hugo after only three posts. Why? Hypriot 2015-03-27
Top Static Site Generators in 2015 Kanishk Kunal 2015-03-12
Moving to Hugo Abiola Ibrahim 2015-03-08
Migrating a blog (yes, this one!) from Wordpress to Hugo Justin Dunham 2015-02-13
blogをoctopressからHugoに乗り換えたメモ jigyakkuma 2015-02-11
Hugoでブログをつくった porgy13 2015-02-07
Hugoにブログを移行した Keichi Takahashi 2015-02-04
Hugo静态网站生成器中文教程 Nanshu Wang 2015-01-31
Hugo + Github Pages + Wercker CI = ¥0(無料)でコマンド 1 発(自動化)でサイト・ブログを公開・運営・分析・収益化 Yohei Yoshimuta 2015-01-31
Running Hugo websites on anynines Julian Weber 2015-01-30
MiddlemanからHugoへ移行した Haruki Konishi 2015-01-21
WordPress から Hugo に乗り換えました rakuishi 2015-01-20
HUGOを使ってサイトを立ち上げる方法 Syui 2015-01-17
Jekyllが許されるのは小学生までだよね Ishimoto Koji 2015-01-16
Getting started with Hugo Anthony Fok 2015-01-12
把这个博客静态化了 (Migrate to Hugo) Li Cheng 2015-01-03
Porting my blog with Hugo Stuart Rackham 2014-12-30
Hugoを使ってみたときのメモ Machortz 2014-12-29
OctopressからHugoへ移行した Taichi Nakashima 2014-12-25
Migrating to Hugo From Octopress Nathan LeClaire 2014-12-22
Dynamic Pages with GoHugo.io Cyrill Schumacher 2014-12-21
6 Static Blog Generators That Aren’t Jekyll David Turnbull 2014-12-08
Travel Blogging Setup Rasmus Stougaard 2014-11-23
Hosting A Hugo Website Behind Nginx Rick Beton 2014-11-20
使用Hugo搭建免费个人Blog (How to use Hugo) Ulric Qin 秦晓辉 2014-11-11
Built in Speed and Built for Speed by Hugo Cheeky Coder 2014-10-30
Hugo para crear sitios web estáticos Web Bizarro 2014-08-19
Going with hugo Markus Eliasson 2014-08-18
Benchmarking Jekyll, Hugo and Wintersmith Fredrik Loch 2014-08-12
Goodbye Octopress, Hello Hugo! Andrei Mihu 2014-08-11
Beautiful sites for Open Source projects Beautiful Open 2014-08-09
Hugo: Beyond the Defaults Nate Finch 2014-08-08
First Impressions of Hugo Peter Aba 2014-06-06
New Site Workflow Giles Paterson 2014-08-05
How I Learned to Stop Worrying and Love the (Static) Web Joshua McKenty 2014-08-04
Hugo - Static Site Generator Kenny Woo 2014-08-03
Hugo Is Friggin’ Awesome Nate Finch 2014-08-01
再次搬家 (Move from WordPress to Hugo) 青砾 (chingli) 2014-07-12
Embedding Gists in Hugo Dan Mull 2014-07-05
An Introduction To Hugo Dan Silber 2014-07-01
Moving to Hugo Dan Mull 2014-05-29
开源之静态站点生成器排行榜(Leaderboard of open-source static website generators) CSDN.net 2014-05-23
Finally, a satisfying and effective blog setup Michael Whatcott 2014-05-20
Hugo from scratch Zack Williams 2014-05-18
Why I switched away from Jekyll Jake Januzelli 2014-05-10
Welcome our new blog Ninya.io 2014-04-11
Mission Not Accomplished Dave Johnston 2014-04-03
Hugo - A Static Site Builder in Go Deep Fried Code 2014-03-30
Adventures in Angular Podcast Matias Niemela 2014-03-28
Hugo bra.am 2014-03-23
Converting Blogger To Markdown Trisha Gee 2014-03-20
Moving to Hugo Static Web Pages Tobias Weingartner 2014-03-16
New Blog Engine: Hugo fREW Schmidt 2014-03-15
Hugo + gulp.js = Huggle Jesse Yang 杨建超 2014-03-08
Powered by Hugo Kieran Healy 2014-02-24
静的サイトを素早く構築するためにGoLangで作られたジェネレータHugo 2014-02-21
Latest Roundup of Useful Tools For Developers CodeGeekz 2014-02-13
Hugo: Static Site Generator written in Go Brave Terry 2014-02-06
10 Useful HTML5 Tools for Web Designers and Developers Design Dizzy 2014-02-04
Hugo – Fast, Flexible Static Site Generator Joby Joseph 2014-01-18
Hugo: A new way to build static website w3update 2014-01-17
Xaprb now uses Hugo Baron Schwartz 2014-01-15
New jQuery Plugins And Resources That Web Designers Need Design Your Way 2014-01-01
On Blog Construction Alexander Lash 2013-12-27
Hugo One Thing Well 2013-12-05
In Praise Of Hugo sound-guru.com 2013-10-19
Hosting a blog on S3 and Cloudfront Dan Esparza 2013-07-24
Hugo will now also detect the media type and output format of partials, if possible, and use that information to decide if the partial should be parsed as a plain text template or not.
Hugo will look for the name given, so you can name it whatever you want. But if you want it treated as plain text, you should use the file suffix and, if needed, the name of the Output Format. The pattern is as follows:
[partial name].[OutputFormat].[suffix]
The partial below is a plain text template (Output Format is CSV
, and since this is the only output format with the suffix csv
, we don’t need to include the Output Format’s Name
):
{{ partial "mytextpartial.csv" . }}
Last updated:
December 11, 2019