Use docs.json to generate default config throughout the site

This commit is contained in:
Joe Mooring 2023-08-07 09:09:15 -07:00 committed by GitHub
parent 57dca93df7
commit 7726bbcac6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 11 additions and 76 deletions

View File

@ -384,14 +384,7 @@ Note the self-closing shortcode syntax above. You may call the `imgproc` shortco
Define an `imaging` section in your site configuration to set the default [image processing options](#image-processing-options).
{{< code-toggle file="hugo" copy=true >}}
[imaging]
resampleFilter = "Box"
quality = 75
hint = "photo"
anchor = "Smart"
bgColor = "#ffffff"
{{< /code-toggle >}}
{{< code-toggle config="imaging" />}}
anchor
: See image processing options: [anchor](#anchor).

View File

@ -19,6 +19,10 @@ Also See [Hugo Multilingual Part 1: Content translation].
## Configure languages
This is the default language configuration:
{{< code-toggle config="languages" />}}
This is an example of a site configuration for a multilingual project. Any key not defined in a `languages` object will fall back to the global value in the root of your site configuration.
{{< code-toggle file="hugo" >}}

View File

@ -82,11 +82,7 @@ Hugo natively supports taxonomies.
Without adding a single line to your [site configuration] file, Hugo will automatically create taxonomies for `tags` and `categories`. That would be the same as manually [configuring your taxonomies](#configure-taxonomies) as below:
{{< code-toggle file="hugo" copy=false >}}
[taxonomies]
tag = "tags"
category = "categories"
{{</ code-toggle >}}
{{< code-toggle config="taxonomies" />}}
If you do not want Hugo to create any taxonomies, set `disableKinds` in your [site configuration] to the following:

View File

@ -491,28 +491,7 @@ enableemoji: true
The `build` configuration section contains global build-related configuration options.
{{< code-toggle file="hugo" >}}
[build]
noJSConfigInAssets = false
useResourceCacheWhen = 'fallback'
[build.buildStats]
disableClasses = false
disableIDs = false
disableTags = false
enable = false
[[build.cachebusters]]
source = 'assets/.*\.(js|ts|jsx|tsx)'
target = '(js|scripts|javascript)'
[[build.cachebusters]]
source = 'assets/.*\.(css|sass|scss)$'
target = '(css|styles|scss|sass)'
[[build.cachebusters]]
source = '(postcss|tailwind)\.config\.js'
target = '(css|styles|scss|sass)'
[[build.cachebusters]]
source = 'assets/.*\.(.*)$'
target = '$1'
{{< /code-toggle >}}
{{< code-toggle config="build" />}}
buildStats {{< new-in "0.115.1" >}}
: When enabled, creates a `hugo_stats.json` file in the root of your project. This file contains arrays of the `class` attributes, `id` attributes, and tags of every HTML element within your published site. Use this file as data source when [removing unused CSS] from your site. This process is also known as pruning, purging, or tree shaking.
@ -735,13 +714,7 @@ Dates are important in Hugo, and you can configure how Hugo assigns dates to you
The default configuration is:
{{< code-toggle file="hugo" >}}
[frontmatter]
date = ["date", "publishDate", "lastmod"]
lastmod = [":git", "lastmod", "date", "publishDate"]
publishDate = ["publishDate", "date"]
expiryDate = ["expiryDate"]
{{< /code-toggle >}}
{{< code-toggle config="frontmatter" />}}
If you, as an example, have a non-standard date parameter in some of your content, you can override the setting for `date`:
@ -797,27 +770,7 @@ Default configuration:
Since Hugo 0.52 you can configure more than just the `cacheDir`. This is the default configuration:
{{< code-toggle file="hugo" >}}
[caches]
[caches.getjson]
dir = ":cacheDir/:project"
maxAge = -1
[caches.getcsv]
dir = ":cacheDir/:project"
maxAge = -1
[caches.getresource]
dir = ":cacheDir/:project"
maxAge = -1
[caches.images]
dir = ":resourceDir/_gen"
maxAge = -1
[caches.assets]
dir = ":resourceDir/_gen"
maxAge = -1
[caches.modules]
dir = ":cacheDir/modules"
maxAge = -1
{{< /code-toggle >}}
{{< code-toggle config="caches" />}}
You can override any of these cache settings in your own `hugo.toml`.

View File

@ -129,13 +129,7 @@ system.
Every `Page` has a [`Kind`][page_kinds] 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 |
{{< code-toggle config="outputs" />}}
### Customizing output formats

View File

@ -27,12 +27,7 @@ With a multilingual project, Hugo generates:
Set the default values for [change frequency] and [priority], and the name of the generated file, in your site configuration.
{{< code-toggle file="hugo" >}}
[sitemap]
changefreq = 'monthly'
filename = 'sitemap.xml'
priority = 0.5
{{</ code-toggle >}}
{{< code-toggle config="sitemap" />}}
changefreq
: How frequently a page is likely to change. Valid values are `always`, `hourly`, `daily`, `weekly`, `monthly`, `yearly`, and `never`. Default is `""` (change frequency omitted from rendered sitemap).