We will now try
1. cacheDir (or, commonly set in environment as `HUGO_CACHEDIR`)
2. if on Netlify we use `/opt/build/cache/hugo_cache/`
3. os.UserCacheDir
4. A temp dir
Storing the cache, especially the module cache, in a temporary idea has had lots of hard to debug issues, especially on MacOS,
which this commit tries to fix.
This should also make it easier to locate the Hugo cache:
>UserCacheDir returns the default root directory to use for user-specific cached data. Users should create their own
application-specific subdirectory within this one and use that.
>
>On Unix systems, it returns $XDG_CACHE_HOME as specified by
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.cache. On Darwin, it
returns $HOME/Library/Caches. On Windows, it returns %LocalAppData%. On Plan 9, it returns $home/lib/cache.
>
>If the location cannot be determined (for example, $HOME is not defined), then it will return an error.
Fixes#11286Fixes#11291
A common pattern for Tailwind 3 is to mount that file to get it on the server watch list.
A common pattern is also to add hugo_stats.json to .gitignore.
This has meant that the first time you start the server (no hugo_stats.json), it just doesn't work as expected.
Fixes#11264
This was broken in the config rewrite in Hugo 0.112.0.
The workaround is to be explicit about setting these flag values (even if just using the defaults), e.g.:
```
hugo deploy --invalidateCDN --maxDeletes 256
```
Fixes#11127
* commands: Add TLS/HTTPS support to hugo server
The "auto cert" handling in this PR is backed by mkcert (see link below).
To get this up and running on a new PC, you can:
```
hugo server trust
hugo server --tlsAuto
```
When `--tlsAuto` (or `--tlsCertFile` and `--tlsKeyFile`) is set and no `--baseURL` is provided as a flag, the server is
started with TLS and `https` as the protocol.
Note that you only need to run `hugo server trust` once per PC.
If you already have the key and the cert file (e.g. by using mkcert directly), you can do:
```
hugo server --tlsCertFile mycert.pem --tlsKeyFile mykey.pem
```
See https://github.com/FiloSottile/mkcertFixes#11064
Primary motivation is documentation, but it will also hopefully simplify the code.
Also,
* Lower case the default output format names; this is in line with the custom ones (map keys) and how
it's treated all the places. This avoids doing `stringds.EqualFold` everywhere.
Closes#10896Closes#10620