mirror of
https://github.com/gohugoio/hugo.git
synced 2026-08-31 18:52:38 +00:00
Merge branch 'tempv0.116.0'
This commit is contained in:
@@ -27,7 +27,7 @@ hugo [flags]
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
|
||||
--config string config file (default is hugo.yaml|json|toml)
|
||||
|
||||
@@ -62,3 +62,4 @@ hugo completion bash
|
||||
### SEE ALSO
|
||||
|
||||
* [hugo completion](/commands/hugo_completion/) - Generate the autocompletion script for the specified shell
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ hugo config [command] [flags]
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
--format string preferred file format (toml, yaml or json) (default "toml")
|
||||
-h, --help help for config
|
||||
|
||||
@@ -15,7 +15,7 @@ hugo config mounts [flags] [args]
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-h, --help help for mounts
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
|
||||
@@ -20,7 +20,7 @@ hugo mod clean [flags] [args]
|
||||
```
|
||||
--all clean entire module cache
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-h, --help help for clean
|
||||
--pattern string pattern matching module paths to clean (all if not set), e.g. "**hugo*"
|
||||
|
||||
@@ -21,7 +21,7 @@ hugo mod graph [flags] [args]
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
--clean delete module cache for dependencies that fail verification
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-h, --help help for graph
|
||||
|
||||
@@ -26,7 +26,7 @@ hugo mod init [flags] [args]
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-h, --help help for init
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
|
||||
@@ -29,7 +29,7 @@ hugo mod npm pack [flags] [args]
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-h, --help help for pack
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
|
||||
@@ -15,7 +15,7 @@ hugo mod tidy [flags] [args]
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-h, --help help for tidy
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
|
||||
@@ -21,7 +21,7 @@ hugo mod vendor [flags] [args]
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-h, --help help for vendor
|
||||
-t, --theme strings themes to use (located in /themes/THEMENAME/)
|
||||
|
||||
@@ -19,7 +19,7 @@ hugo mod verify [flags] [args]
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
--clean delete module cache for dependencies that fail verification
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
-h, --help help for verify
|
||||
|
||||
@@ -26,7 +26,7 @@ hugo new content [path] [flags]
|
||||
|
||||
```
|
||||
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
--editor string edit new content with this editor, if provided
|
||||
-f, --force overwrite file if it already exists
|
||||
|
||||
@@ -33,7 +33,7 @@ hugo server [command] [flags]
|
||||
-D, --buildDrafts include content marked as draft
|
||||
-E, --buildExpired include expired content
|
||||
-F, --buildFuture include content with publishdate in the future
|
||||
--cacheDir string filesystem path to cache directory. Defaults: $TMPDIR/hugo_cache_$USER/
|
||||
--cacheDir string filesystem path to cache directory
|
||||
--cleanDestinationDir remove files from destination not found in static directories
|
||||
-c, --contentDir string filesystem path to content directory
|
||||
--disableBrowserError do not show build errors in the browser
|
||||
|
||||
@@ -73,6 +73,9 @@ The following logical operators are available with `where`:
|
||||
`intersect`
|
||||
: `true` if a given field value that is a slice/array of strings or integers contains elements in common with the matching value; it follows the same rules as the [`intersect` function][intersect].
|
||||
|
||||
`like`
|
||||
: `true` if a given field value matches a regular expression. Use the `like` operator to compare `string` values. Returns `false` when comparing other data types to the regular expression.
|
||||
|
||||
## Use `where` with boolean values
|
||||
When using booleans you should not put quotation marks.
|
||||
```go-html-template
|
||||
@@ -80,7 +83,6 @@ When using booleans you should not put quotation marks.
|
||||
<p>{{ .Title }}</p>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
|
||||
## Use `where` with `intersect`
|
||||
|
||||
@@ -102,6 +104,31 @@ You can also put the returned value of the `where` clauses into a variable:
|
||||
{{ end }}
|
||||
{{< /code >}}
|
||||
|
||||
## Use `where` with `like`
|
||||
|
||||
This example matches pages where the "foo" parameter begins with "ab":
|
||||
|
||||
```go-html-template
|
||||
{{ range where site.RegularPages "Params.foo" "like" "^ab" }}
|
||||
<h2><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></h2>
|
||||
{{ end }}
|
||||
```
|
||||
|
||||
When specifying the regular expression, use a raw [string literal] (backticks) instead of an interpreted string literal (double quotes) to simplify the syntax. With an interpreted string literal you must escape backslashes.
|
||||
|
||||
[string literal]: https://go.dev/ref/spec#String_literals
|
||||
|
||||
Go's regular expression package implements the [RE2 syntax]. Note that the RE2 `\C` escape sequence is not supported.
|
||||
|
||||
[RE2 syntax]: https://github.com/google/re2/wiki/Syntax/
|
||||
|
||||
{{% note %}}
|
||||
The RE2 syntax is a subset of that accepted by [PCRE], roughly speaking, and with various [caveats].
|
||||
|
||||
[caveats]: https://swtch.com/~rsc/regexp/regexp3.html#caveats
|
||||
[PCRE]: https://www.pcre.org/
|
||||
{{% /note %}}
|
||||
|
||||
## Use `where` with `first`
|
||||
|
||||
Using `first` and `where` together can be very
|
||||
|
||||
@@ -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`.
|
||||
Reference in New Issue
Block a user