mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
docs: Rework the cacheDir documentation
This commit is contained in:
parent
8859be1c01
commit
a50356b9a2
1 changed files with 16 additions and 1 deletions
|
@ -824,7 +824,7 @@ You can override any of these cache settings in your own `hugo.toml`.
|
|||
### The keywords explained
|
||||
|
||||
`:cacheDir`
|
||||
: This is the value of the `cacheDir` configuration option if set (can also be set via OS env variable `HUGO_CACHEDIR`). It will fall back to `/opt/build/cache/hugo_cache/` on Netlify, or a `hugo_cache_$USER` directory below the OS temp dir for the others. This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see [this configuration](https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml).
|
||||
: See [Configure cacheDir](#configure-cachedir).
|
||||
|
||||
`:project`
|
||||
: The base directory name of the current Hugo project. This means that, in its default setting, every project will have separated file caches, which means that when you do `hugo --gc` you will not touch files related to other Hugo projects running on the same PC.
|
||||
|
@ -853,3 +853,18 @@ dir
|
|||
[toml]: https://github.com/toml-lang/toml
|
||||
[yaml]: https://yaml.org/spec/
|
||||
[static-files]: /content-management/static-files/
|
||||
|
||||
|
||||
# Configure cacheDir
|
||||
|
||||
This is the directory where Hugo by default will store its file caches. See [Configure File Caches](#configure-file-caches).
|
||||
|
||||
This can be set using the `cacheDir` config option or via the OS env variable `HUGO_CACHEDIR`.
|
||||
|
||||
If this is not set, Hugo will use, in order of preference:
|
||||
|
||||
1. If running on Netlify: `/opt/build/cache/hugo_cache/`. This means that if you run your builds on Netlify, all caches configured with `:cacheDir` will be saved and restored on the next build. For other CI vendors, please read their documentation. For an CircleCI example, see [this configuration](https://github.com/bep/hugo-sass-test/blob/6c3960a8f4b90e8938228688bc49bdcdd6b2d99e/.circleci/config.yml).
|
||||
1. In a `hugo_cache` directory below the OS user cache directory as defined by Go's [os.UserCacheDir](https://pkg.go.dev/os#UserCacheDir). On Unix systems, this is `$XDG_CONFIG_HOME` as specified by [basedir-spec-latest](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html) if non-empty, else `$HOME/.config`. On MacOS, this is `$HOME/Library/Application Support`. On Windows, this is`%AppData%`. On Plan 9, this is `$home/lib`. {{< new-in "0.116.0" >}}
|
||||
1. In a `hugo_cache_$USER` directory below the OS temp dir.
|
||||
|
||||
If you want to know the current value of `cacheDir`, you can run `hugo config`, e.g: `hugo config | grep cachedir`.
|
Loading…
Reference in a new issue