Configure file caches
Configure file caches.
This is the default configuration:
caches:
assets:
dir: :resourceDir/_gen
maxAge: -1
getcsv:
dir: :cacheDir/:project
maxAge: -1
getjson:
dir: :cacheDir/:project
maxAge: -1
getresource:
dir: :cacheDir/:project
maxAge: -1
images:
dir: :resourceDir/_gen
maxAge: -1
misc:
dir: :cacheDir/:project
maxAge: -1
modules:
dir: :cacheDir/modules
maxAge: -1
[caches]
[caches.assets]
dir = ':resourceDir/_gen'
maxAge = -1
[caches.getcsv]
dir = ':cacheDir/:project'
maxAge = -1
[caches.getjson]
dir = ':cacheDir/:project'
maxAge = -1
[caches.getresource]
dir = ':cacheDir/:project'
maxAge = -1
[caches.images]
dir = ':resourceDir/_gen'
maxAge = -1
[caches.misc]
dir = ':cacheDir/:project'
maxAge = -1
[caches.modules]
dir = ':cacheDir/modules'
maxAge = -1
{
"caches": {
"assets": {
"dir": ":resourceDir/_gen",
"maxAge": -1
},
"getcsv": {
"dir": ":cacheDir/:project",
"maxAge": -1
},
"getjson": {
"dir": ":cacheDir/:project",
"maxAge": -1
},
"getresource": {
"dir": ":cacheDir/:project",
"maxAge": -1
},
"images": {
"dir": ":resourceDir/_gen",
"maxAge": -1
},
"misc": {
"dir": ":cacheDir/:project",
"maxAge": -1
},
"modules": {
"dir": ":cacheDir/modules",
"maxAge": -1
}
}
}
Keys
- dir
- (
string
) The absolute file system path where the cached files will be stored. You can begin the path with the:cacheDir
or:resourceDir
token. These tokens will be replaced with the actual configured cache directory and resource directory paths, respectively. - maxAge
- (
string
) Theduration
a cached entry remains valid before being evicted. A value of0
disables the cache. A value of-1
means the cache entry never expires (the default).
Tokens
:cacheDir
- (
string
) The designated cache directory. See details. :project
- (
string
) The base directory name of the current Hugo project. By default, this ensures each project has isolated file caches, so runninghugo --gc
will only affect the current project’s cache and not those of other Hugo projects on the same machine. :resourceDir
- (
string
) The designated directory for caching output from asset pipelines. See details.
Last updated:
March 5, 2025
:
content: Consolidate configuration documentation (b6cae5cbc)
Improve this page