Main Configurations
These are the main configurations resides under config/<ENV>/config.toml
. We will go through each of them in detail but not its values or
baseURL = "http://example.org/"
canonifyURLs = true
buildDrafts = true
buildExpired = false
buildFuture = false
theme = []
enableRobotsTXT = true
metaDataFormat = "toml"
googleAnalytics = ""
paginate = 10
summaryLength = 70
sectionPagesMenu = "sections"
archetypeDir = "./archetypes"
assetDir = "./assets"
dataDir = "./docs/.data"
staticDir = "./static"
layoutDir = "./layouts"
themesDir = "./themes"
publishDir = "./public"
i18nDir = "./i18n"
defaultContentLanguage = "en-us"
defaultContentLanguageInSubdir = true
hasCJKLanguage = true
Core Settings
The first sections are the core settings, the heart of Hugo.
baseURL
Your main base URL. It can be a full domain name with or without default pathing, or as an empty string. If you're building multi-front website, you need to set this as empty string.
If there is a value, please make sure it ends with a slash.
canonifyURLs
This turns the relative URLs into absolute URLs.
buildDrafts
Ask HUGO to build and publish draft version as well.
buildExpired
Ask HUGO to build expired version as well.
buildFuture
Ask HUGO to build future versions.
themes
Specify the list of themes to deploy.
enableRobotsTXT
Enable robot.txt
generation for SEO.
metaDataFormat
Specify the format for the metadata.
googleAnalytics
Specify the Google Analytics ID for internal template inclusion.
paginate
Number of elements in a page
summaryLength
The maximum length of the page summary.
sectionPagesMenu
The menu for section pages.
Source Directories
Next is to set the sources directories. There are 2 sections for this:
- sources that are language specific
- sources that are generalized
Generalized Sources
archetypeDir = "./archetypes"
assetDir = "./assets"
dataDir = "./docs/.data"
staticDir = "./static"
layoutDir = "./layouts"
themesDir = "./themes"
publishDir = "./public"
i18nDir = "./i18n"
These are the general sources. You can specify them accordingly to point to your correct directory. However, keep in mind that if you want to generate a different public directly, say, it is now named as main
instead of public
, you need to add a trailing slash. Example:
publishDir = "./main/"
Languages Specific Sources
contentDir = "../docs/en-us"
These are the sources for Hugo to search for your content.
Generalized Language Settings
The last sections would be the generalized multilingual mode settings. These are the settings to tell HUGO to default into if there is an multilingual mode related error is found.
defaultContentLanguage
This is for Hugo to bounce back to the default language if content is missing.
defaultContentLanguageInSubdir
Render the default root page to the default language sub-directory. In other word, redirect /
to /default-lang
.
hasCJKLanguage
Tell Hugo that the other languages has Chinese, Japanese, and Korean runes instead of the english. This is to correct things like word count function etc. to return the proper values.
That's all about main configurations in HUGO. You may proceed to the next section which is the languages configurations.