e65df1059 Bump to v0.30 e9e118730 releaser: Prepare repository for 0.31-DEV e6f2508d4 releaser: Add release notes to /docs for release of 0.30 9c5d6a65b releaser: Bump versions for release of 0.30 88bf0e663 Merge commit 'ecf5e081b5540e69f4af330233f39a07baf53846' 6c7191331 Merge commit 'dae5a7c61cceeb0de59f2d755f63e453f71dd9b2' efd1821bd tpl: Add errorf template function 0cf8dc046 Change SummaryLength to be configurable (#3924) 9e8c09652 tpl: Add os.fileExists template function e969cfcd7 Merge commit '9d68f695e782c6a83c77aff13317c7a22c694c98' 1a2d516a0 tpl: Add float template function 5310162dc releaser: Prepare repository for 0.30-DEV 648fdf2d0 releaser: Add release notes to /docs for release of 0.29 b2f46992c releaser: Bump versions for release of 0.29 ec447e043 releaser: Prepare repository for 0.29-DEV 9f469e93a releaser: Add release notes to /docs for release of 0.28 c91c18ebc releaser: Bump versions for release of 0.28 253d2ede2 Merge commit '61c27b58b353c73772aae572c7d822fdfdf7791b' e35b93cc7 Merge commit '30694a133a88d5f76a51d0372646e10cbeca7691' 9fad59f66 Merge commit '7a89dce53bfbd67a17442a8f9be8fa895fc4f9b1' 4221c2855 Merge commit 'ba45da9d03056447e4873de13d4e0f8d658a769b' 0010b6743 releaser: Prepare repository for 0.28-DEV 9e71765cd releaser: Add release notes to /docs for release of 0.27.1 56206b90d releaser: Bump versions for release of 0.27.1 59522fca0 releaser: Prepare repository for 0.28-DEV 4686686d2 releaser: Add release notes to /docs for release of 0.27 0cd9a5d58 releaser: Bump versions for release of 0.27 d21a59d2d docs: Merge commit '1b4319be62ba071f79e90ef32dbe92eb893429f7' 9c4ff2d8e docs: Document Related Content 887fb1af7 docs: Merge commit '7d63a23b0c68d9cd7c7c09c2755619237bc03485' c8163b51b Update docs versiona and README f782c9959 Merge commit 'ec4e6f9df2ab9ffdc62a3f59675369096e0d3f77' as 'docs'd384c661f
docs: Re-integrate9a2eb0f1d
Revert "Squashed 'docs/' changes from 35abbc86..f887bd7b"0373e4310
Squashed 'docs/' changes from 35abbc86..f887bd7bea2cc26b3
Remove the theme submodule from /docs0f9f73cce
Add support for multiple config files via --config a.toml,b.toml,c.tomlc8257f8b7
Render task list item inside label for correct accessibility0abdeeef6
source: Normalize UniqueID between Windows & Linuxe2f8664ef
hugolib: More spelling46ac74537
all: Fix spelling4b54fb070
all: gofmt -s40d7d3baa
releaser: Prepare repository for 0.27-DEVf090c2711
releaser: Add release notes to /docs for release of 0.26b36f6e31e
releaser: Bump versions for release of 0.260f51e4926
releaser: Add release notes draft for 0.2662583db50
vendor: Update checksum for inflect0d495d537
releaser: Update to new release notes location22b213b1a
Merge commit 'e81208265bb3cdb7606d051a23d83aeebcb7d34d'e81208265
Squashed 'docs/' changes from ef02e34e..35abbc8611e5d456e
releaser: Include stats from hugoDocsf768c27f0
helpers: Remove some unused funcs81c13171a
Add some missing doc comments9891c0fb0
Remove sourceRelativeLinks481924b34
helpers: Fix broken TaskList in Markdown09907d36a
Switch from fork bep/inflect to markbates/inflect8fb594bfb
Make the title case style guide configurable9b4170ce7
Remove unused dependencies from vendor.json6acbe41f0
media: Add missing JSON tags to Typee321306c6
media: Add JSON tags to Type9c1977872
output: Add JSON tags to Format50ec65fbe
Squashed 'docs/' changes from 73f355ce..ef02e34e1c18f3fc4
Merge commit '50ec65fbe1a48475d3320775dab2c47389c02114'cb9dfc261
helpers: Add support for French Guillemetsc4a0b6e8a
vendor: Add support for French Guillemetsa8080c084
Remove CODEOWNERS84710eb3e
Add -u flag for go get govendor in CONTRIBUTING.md555a9bc80
tpl: Accommodate gccgo in TestMethodToName55d0b8941
tpl/collections: Fix intersect on []interface{} handlingaee2b0678
Add --debug option to be improved on over timec1a5da977
vendor: Update dependencies for 0.26-DEV9ed48c1c9
Dockerfile: Run go install with -ldflags '-s -w'bfe0bfbbd
Dockerfile: Reduce image size from 277MB to 27MB606d6a8c9
Dockerfile: Optimize Docker image size12e049520
docs: Add RSS template lookup example6cd33f695
tpl: Use hash for cache keydbe63970e
hugolib: Support reflinks starting with a slash0c90e6d71
Change "hugodocs" to "hugoDocs" to match GitHub's default URLb60aa1a50
helpers: Add --trace to asciidoctor argsff433f981
Add script to pull in docs changes2c0d1ccdc
Squashed 'docs/' changes from b0470688..73f355cef387cb1b3
doc: Merge commit '2c0d1ccdcd95de0bddeb39dca2e4d08f0d8056d7'40566ec98
Remove ^M from file to make line-endings consistent7759a98f7
Clarify the repo choice in the contribution guidelines720786cd3
Add note about doc-related pull requests in contribution guide214e16eca
appveyor: Update submodulesa2fb8150c
Add some README info about the docs repo73273d4e8
Add the docs theme to .gitmodules4c220c4ac
Merge commit '6dbde8d731f221b027c0c60b772ba82dad759943'6dbde8d73
Squashed 'docs/' changes from f3c88b08..b0470688deccc5400
hubolib: Add HasShortcode00b590d7a
Improve the twitter card templateea5e9e346
Add GOEXE to support building with different versions of `go`61bb3ccab
hugolib: Improve panic handling in layout rendering794ea21e9
hugolib: Make template panics into nice error messages91f410ea9
Bump versions to 0.26-DEV0e25f1e96
Revert "Revert "vendor: Update dependencies for 0.26-DEV""aded65b71
releaser: Prepare repository for 0.25-DEVbbd33dbf5
releaser: Add release notes to /docs for release of 0.25.10e09be7b3
releaser: Bump versions for release of 0.25.1195f94575
releaser: Ignore openbsd/arm44b8f740e
releaser: Add release notes draft for 0.25.1a48e13234
Revert "vendor: Update dependencies for 0.26-DEV"7f82b41a2
parser: Final (!) fix for issue with escaped JSON front matter84db6c74a
parser: Fix issue with escaped JSON front mattere0cf2e05b
tpl/collections: Add some empty slice tests to intersectdbbc5c481
tpl/collections: Fix union when the first slice is empty7bcc1ce65
commands: Navigate to changed on CREATE When working with content from IntelliJ IDE, like WebStorm, every file save is followed by two events: "RENAME" and then "CREATE".fd41e70cf
Add first draft of CODEOWNERS4ec8ee7fb
vendor: Update dependencies for 0.26-DEV1e19a9845
releaser: Prepare repository for 0.26-DEV6fb556367
releaser: Add release notes to /docs for release of 0.2551bcd5083
releaser: Fix tag push6e086e3d0
releaser: Bump versions for release of 0.255895e32b0
releaser: Add release notes draft for 0.25b2dcd867f
Revert "vendor: Update dependencies"d2c24baaf
vendor: Update dependencies4989950d4
releaser: Use real theme count in templatea358b33f2
docs: Regenerate the docs helpersa392fca96
docs: Regenerate commands doc75f782f03
Revert "commands: Adjust docs path"37c69054e
Squashed 'docs/' changes from 5d9a6703..f3c88b08e00f5c9c0
docs: Merge docs commit '37c69054e294bf554be03cf7e4c01e1f586e6943'477684022
releaser: Adjustments70d8ddcb6
releaser: Revise the docs handling to match new subtree5f831a622
releaser: Replace the magic version handlinge7a54e7af
releaser: Add --try flag to ease testingaa6b1b9be
output: Support templates per site/languagea1d260b41
hugolib: Extend the sections APIdd9b1baab
hugolib: Make .Site.Sections return the top level sections1039356ed
commands: Support human-readable YAML boolean values in undraftccdd08d57
tpl/collections: Add Pages support to Intersect and Uniond12cf5a25
tpl/collections: Fix In function for JSON arrayse10e51a00
parser: Fix handling of JSON front matter with escaped quotes34c566773
tpl/math: Add log function41805dca9
hugolib: Render 404.html for all languages7ee1f25e9
hugo import jekyll support nested _posts directories3aa0e16d0
cache: Add even more concurrency to testb3c8056de
cache: Add concurrent cache testfe132e1c3
vendor: Add missing WebP dependencies8431c8d39
tpl: Add WebP images supportda72805a4
tpl: Only show post's own keywords in schema.org72fd87171
hugolib: Add more summary test118f8f7cf
Dockerfile: Update Dockerfile and add Docker optimizations56d82aa02
hugofs: Fix typo in code commenteccb06478
tpl: Simplify the Disqus template a little bit (#3655)2e1e4934b
tpl: Improve the built-in Disqus template (#3639)a54404968
helpers: Add Blackfriday 'joinLines' extension support (#3574)bfce30d85
helpers: add --initial-header-level=2 to rst2html (#3528)30e14cc31
Make `--navigateToChanged` more robust on Windowsc825a7312
Support open "current content page" in browser7198ea8a1
Revert "Remove docs building from CI builds"dd78d5b23
Squashed 'docs/' content from commit 5d9a6703a7765bb3c
Merge commit 'dd78d5b23fe597f4461aa4199401b4e07c0612e2' as 'docs' git-subtree-dir: docs git-subtree-split: e65df1059549d951a45853576374be4088ded1d3
15 KiB
title | linktitle | description | date | publishdate | lastmod | categories | keywords | menu | weight | sections_weight | draft | aliases | toc | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Configure Hugo | Configuration | Often the default settings are good enough, but the config file can provide highly granular control over how your site is rendered. | 2013-07-01 | 2017-01-02 | 2017-03-05 |
|
|
|
60 | 60 | false |
|
true |
The directory structure of a Hugo website—or more precisely, the source organization of files containing the website's content and templates—provides most of the configuration information that Hugo needs in order to generate a finished website.
Because of Hugo's sensible defaults, many websites may not need a configuration file. Hugo is designed to recognize certain typical usage patterns.
Configuration Lookup Order
Similar to the template lookup order, Hugo has a default set of rules for searching for a configuration file in the root of your website's source directory as a default behavior:
./config.toml
./config.yaml
./config.json
In your config
file, you can direct Hugo as to how you want your website rendered, control your website's menus, and arbitrarily define site-wide parameters specific to your project.
YAML Configuration
The following is a typical example of a YAML configuration file. The values nested under params:
will populate the .Site.Params
variable for use in templates:
{{< code file="config.yml">}} baseURL: "https://yoursite.example.com/" title: "My Hugo Site" footnoteReturnLinkContents: "↩" permalinks: post: /:year/:month/:title/ params: Subtitle: "Hugo is Absurdly Fast!" AuthorName: "Jon Doe" GitHubUser: "spf13" ListOfFoo: - "foo1" - "foo2" SidebarRecentLimit: 5 {{< /code >}}
All Variables, YAML
The following is the full list of Hugo-defined variables in an example YAML file. The values provided in this example represent the default values used by Hugo.
{{< code file="config.yml" download="config.yml" >}} archetypeDir: "archetypes"
hostname (and path) to the root, e.g. http://spf13.com/
baseURL: ""
include content marked as draft
buildDrafts: false
include content with publishdate in the future
buildFuture: false
include content already expired
buildExpired: false
enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs. See the "URL Management" page
relativeURLs: false canonifyURLs: false
config file (default is path/config.yaml|json|toml)
config: "config.toml" contentDir: "content" dataDir: "data" defaultExtension: "html" defaultLayout: "post"
Missing translations will default to this content language
defaultContentLanguage: "en"
Renders the default content language in subdir, e.g. /en/. The root directory / will redirect to /en/
defaultContentLanguageInSubdir: false disableLiveReload: false
Do not build RSS files
disableRSS: false
Do not build Sitemap file
disableSitemap: false
Enable GitInfo feature
enableGitInfo: false
Build robots.txt file
enableRobotsTXT: false
Do not render 404 page
disable404: false
Do not inject generator meta tag on homepage
disableHugoGeneratorInject: false
Allows you to disable all page types and will render nothing related to 'kind';
values = "page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404"
disableKinds: []
Do not make the url/path to lowercase
disablePathToLower: false ""
Enable Emoji emoticons support for page content; see emoji-cheat-sheet.com
enableEmoji: false
Show a placeholder instead of the default value or an empty string if a translation is missing
enableMissingTranslationPlaceholders: false footnoteAnchorPrefix: "" footnoteReturnLinkContents: ""
google analytics tracking id
googleAnalytics: ""
if true, auto-detect Chinese/Japanese/Korean Languages in the content. (.Summary and .WordCount can work properly in CJKLanguage)
hasCJKLanguage: false languageCode: ""
the length of text to show in a .Summary
summaryLength: 70 layoutDir: "layouts"
Enable Logging
log: false
Log File path (if set, logging enabled automatically)
logFile: ""
"toml","yaml", or "json"
metaDataFormat: "toml" newContentEditor: ""
Don't sync permission mode of files
noChmod: false
Don't sync modification time of files
noTimes: false
Pagination
paginate: 10 paginatePath: "page"
See "content-management/permalinks"
permalinks:
Pluralize titles in lists using inflect
pluralizeListTitles: true
Preserve special characters in taxonomy names ("Gérard Depardieu" vs "Gerard Depardieu")
preserveTaxonomyNames: false
filesystem path to write files to
publishDir: "public"
enables syntax guessing for code fences without specified language
pygmentsCodeFencesGuessSyntax: false
color-codes for highlighting derived from this style
pygmentsStyle: "monokai"
true use pygments-css or false will color code directly
pygmentsUseClasses: false
maximum number of items in the RSS feed
rssLimit: 15
see "Section Menu for Lazy Bloggers", /templates/menu-templates for more info
SectionPagesMenu: ""
default sitemap configuration map
sitemap:
filesystem path to read files relative from
source: "" staticDir: "static"
display memory and timing of different steps of the program
stepAnalysis: false
display metrics about template executions
templateMetrics: false
theme to use (located by default in /themes/THEMENAME/)
themesDir: "themes" theme: "" title: ""
Title Case style guide for the title func and other automatic title casing in Hugo.
// Valid values are "AP" (default), "Chicago" and "Go" (which was what you had in Hugo <= 0.25.1). // See https://www.apstylebook.com/ and http://www.chicagomanualofstyle.org/home.html titleCaseStyle: "AP"
if true, use /filename.html instead of /filename/
uglyURLs: false
verbose output
verbose: false
verbose logging
verboseLog: false
watch filesystem for changes and recreate as needed
watch: true taxonomies:
- category: "categories"
- tag: "tags" {{< /code >}}
TOML Configuration
The following is an example of a TOML configuration file. The values under [params]
will populate the .Site.Params
variable for use in templates:
{{< code file="config.toml">}} contentDir = "content" layoutDir = "layouts" publishDir = "public" buildDrafts = false baseURL = "https://yoursite.example.com/" canonifyURLs = true title = "My Hugo Site"
[taxonomies] category = "categories" tag = "tags"
[params] subtitle = "Hugo is Absurdly Fast!" author = "John Doe" {{< /code >}}
All Variables, TOML
The following is the full list of Hugo-defined variables in an example TOML file. The values provided in this example represent the default values used by Hugo.
{{< code file="config.toml" download="config.toml">}} archetypeDir = "archetypes"
hostname (and path) to the root, e.g. http://spf13.com/
baseURL = ""
include content marked as draft
buildDrafts = false
include content with publishdate in the future
buildFuture = false
include content already expired
buildExpired = false
enable this to make all relative URLs relative to content root. Note that this does not affect absolute URLs.
relativeURLs = false canonifyURLs = false
config file (default is path/config.yaml|json|toml)
config = "config.toml" contentDir = "content" dataDir = "data" defaultExtension = "html" defaultLayout = "post"
Missing translations will default to this content language
defaultContentLanguage = "en"
Renders the default content language in subdir, e.g. /en/. The root directory / will redirect to /en/
defaultContentLanguageInSubdir = false disableLiveReload = false
Do not build RSS files
disableRSS = false
Do not build Sitemap file
disableSitemap = false
Enable GitInfo feature
enableGitInfo = false
Build robots.txt file
enableRobotsTXT = false
Do not render 404 page
disable404 = false
Do not inject generator meta tag on homepage
disableHugoGeneratorInject = false
Allows you to disable all page types and will render nothing related to 'kind';
values = "page", "home", "section", "taxonomy", "taxonomyTerm", "RSS", "sitemap", "robotsTXT", "404"
disableKinds = []
Do not make the url/path to lowercase
disablePathToLower = false
Enable Emoji emoticons support for page content; see emoji-cheat-sheet.com
enableEmoji = false
Show a placeholder instead of the default value or an empty string if a translation is missing
enableMissingTranslationPlaceholders = false footnoteAnchorPrefix = "" footnoteReturnLinkContents = ""
google analytics tracking id
googleAnalytics = ""
if true, auto-detect Chinese/Japanese/Korean Languages in the content. (.Summary and .WordCount can work properly in CJKLanguage)
hasCJKLanguage = false languageCode = ""
the length of text to show in a .Summary
summaryLength: 70 layoutDir = "layouts"
Enable Logging
log = false
Log File path (if set, logging enabled automatically)
logFile =
maximum number of items in the RSS feed
rssLimit = 15
"toml","yaml", or "json"
metaDataFormat = "toml" newContentEditor = ""
Don't sync permission mode of files
noChmod = false
Don't sync modification time of files
noTimes = false
Pagination
paginate = 10 paginatePath = "page"
See "content-management/permalinks"
permalinks =
Pluralize titles in lists using inflect
pluralizeListTitles = true
Preserve special characters in taxonomy names ("Gérard Depardieu" vs "Gerard Depardieu")
preserveTaxonomyNames = false
filesystem path to write files to
publishDir = "public"
enables syntax guessing for code fences without specified language
pygmentsCodeFencesGuessSyntax = false
color-codes for highlighting derived from this style
pygmentsStyle = "monokai"
true: use pygments-css or false: color-codes directly
pygmentsUseClasses = false
see "Section Menu for Lazy Bloggers", /templates/menu-templates for more info
SectionPagesMenu =
default sitemap configuration map
sitemap =
filesystem path to read files relative from
source = "" staticDir = "static"
display memory and timing of different steps of the program
stepAnalysis = false
theme to use (located by default in /themes/THEMENAME/)
themesDir = "themes" theme = "" title = ""
if true, use /filename.html instead of /filename/
uglyURLs = false
verbose output
verbose = false
verbose logging
verboseLog = false
watch filesystem for changes and recreate as needed
watch = true [taxonomies] category = "categories" tag = "tags" {{< /code >}}
{{% note %}} If you are developing your site on a *nix machine, here is a handy shortcut for finding a configuration option from the command line:
cd ~/sites/yourhugosite
hugo config | grep emoji
which shows output like
enableemoji: true
{{% /note %}}
Environmental Variables
In addition to the 3 config options already mentioned, configuration key-values can be defined through operating system environment variables.
For example, the following command will effectively set a website's title on Unix-like systems:
$ env HUGO_TITLE="Some Title" hugo
{{% note "Setting Environment Variables" %}}
Names must be prefixed with HUGO_
and the configuration key must be set in uppercase when setting operating system environment variables.
{{% /note %}}
Ignore Files When Rendering
The following statement inside ./config.toml
will cause Hugo to ignore files ending with .foo
and .boo
when rendering:
ignoreFiles = [ "\\.foo$", "\\.boo$" ]
The above is a list of regular expressions. Note that the backslash (\
) character is escaped in this example to keep TOML happy.
Configure Blackfriday
Blackfriday is Hugo's built-in Markdown rendering engine.
Hugo typically configures Blackfriday with sane default values that should fit most use cases reasonably well.
However, if you have specific needs with respect to Markdown, Hugo exposes some of its Blackfriday behavior options for you to alter. The following table lists these Hugo options, paired with the corresponding flags from Blackfriday's source code ( html.go and markdown.go).
{{< readfile file="/content/readfiles/bfconfig.md" markdown="true" >}}
{{% note %}}
- Blackfriday flags are case sensitive as of Hugo v0.15.
- Blackfriday flags must be grouped under the
blackfriday
key and can be set on both the site level and the page level. Any setting on a page will override its respective site setting. {{% /note %}}
{{< code file="bf-config.toml" >}} [blackfriday] angledQuotes = true fractions = false plainIDAnchors = true extensions = ["hardLineBreak"] {{< /code >}}
{{< code file="bf-config.yml" >}} blackfriday: angledQuotes: true fractions: false plainIDAnchors: true extensions: - hardLineBreak {{< /code >}}
Configure Additional Output Formats
Hugo v0.20 introduced the ability to render your content to multiple output formats (e.g., to JSON, AMP html, or CSV). See Output Formats for information on how to add these values to your Hugo project's configuration file.