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
* Move config loading to the page package
* Fix a lower bound panic for the `:sections` slice syntax.
* Always return the `:title`
* Add some permalinks integration tests
* Also see issues below
Fixes#9448Fixes#11184
See #8523
Allows using permalink configuration for sections (branch bundles) and
also for taxonomy pages. Extends the current permalink configuration to
be able to specified per page kind while also staying backward compatible:
all permalink patterns not dedicated to a certain kind, get automatically
added for both normal pages and term pages.
Fixes#8523
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
In `v0.103.0` we added support for `resources.PostProcess` for all file types, not just HTML. We had benchmarks that said we were fine in that department, but those did not consider the static file syncing.
This fixes that by:
* Making sure that the /static syncer always gets its own file system without any checks for the post process token.
* For dynamic files (e.g. rendered HTML files) we add an additional check to make sure that we skip binary files (e.g. images)
Fixes#10328
Looking at the code as a whole, we ended up with a little to much "buttons". It turns out that doing case insensitive matching (lower both pattern and strings to match) performs just fine. Or at least, it
gives the penalty to the people who uses mixed case filenames.
```
GetGlob/Default_cache-10 10.6ns ± 2% 10.6ns ± 1% ~ (p=0.657 n=4+4)
GetGlob/Filenames_cache,_lowercase_searchs-10 10.6ns ± 2% 10.6ns ± 0% ~ (p=1.000 n=4+4)
GetGlob/Filenames_cache,_mixed_case_searchs-10 29.7ns ± 1% 29.6ns ± 1% ~ (p=0.886 n=4+4)
GetGlob/GetGlob-10 13.7ns ± 1% 13.7ns ± 0% ~ (p=0.429 n=4+4)
name old alloc/op new alloc/op delta
GetGlob/Default_cache-10 0.00B 0.00B ~ (all equal)
GetGlob/Filenames_cache,_lowercase_searchs-10 0.00B 0.00B ~ (all equal)
GetGlob/Filenames_cache,_mixed_case_searchs-10 5.00B ± 0% 5.00B ± 0% ~ (all equal)
GetGlob/GetGlob-10 0.00B 0.00B ~ (all equal)
name old allocs/op new allocs/op delta
GetGlob/Default_cache-10 0.00 0.00 ~ (all equal)
GetGlob/Filenames_cache,_lowercase_searchs-10 0.00 0.00 ~ (all equal)
GetGlob/Filenames_cache,_mixed_case_searchs-10 1.00 ± 0% 1.00 ± 0% ~ (all equal)
GetGlob/GetGlob-10
```
On Linux, `hugofs.Glob` does not hit any directories which includes
uppercase letters. (This does not happen on macOS.)
Since `resources.GetMatch/Match` uses `Glob`,
```
{{ resources.GetMatch "Foo/bar.css" }}
```
this does not match `assets/Foo/bar.css` .
On the other hand, you can get it with
```
{{ resources.Get "Foo/bar.css" }}
```
Note that we will now fail if `inlineImports` is enabled and we cannot resolve an import.
You can work around this by either:
* Use url imports or imports with media queries.
* Set `skipInlineImportsNotFound=true` in the options
Also get the argument order in the different NewFileError* funcs in line.
Fixes#9895
* Add file context to minifier errors when publishing
* Misc fixes (see issues)
* Allow custom server error template in layouts/server/error.html
To get to this, this commit also cleans up and simplifies the code surrounding errors and files. This also removes the usage of `github.com/pkg/errors`, mostly because of https://github.com/pkg/errors/issues/223 -- but also because most of this is now built-in to Go.
Fixes#9852Fixes#9857Fixes#9863
The old implementation had some issues, mostly related to the context (e.g. name, file paths) passed to the template.
This new implementation is using the exact same code path for evaluating the pages as in a regular build.
This also makes it more robust and easier to reason about in a multilingual setup.
Now, if you are explicit about the target path, Hugo will now always pick the correct mount and language:
```bash
hugo new content/en/posts/my-first-post.md
```
Fixes#9032Fixes#7589Fixes#9043Fixes#9046Fixes#9047
This commit started out investigating a `concurrent map read write` issue, ending by replacing the map with a struct.
This is easier to reason about, and it's more effective:
```
name old time/op new time/op delta
SiteNew/Regular_Deep_content_tree-16 71.5ms ± 3% 69.4ms ± 5% ~ (p=0.200 n=4+4)
name old alloc/op new alloc/op delta
SiteNew/Regular_Deep_content_tree-16 29.7MB ± 0% 27.9MB ± 0% -5.82% (p=0.029 n=4+4)
name old allocs/op new allocs/op delta
SiteNew/Regular_Deep_content_tree-16 313k ± 0% 303k ± 0% -3.35% (p=0.029 n=4+4)
```
See #8749
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster:
```
BenchmarkDefaultConfigProvider/Viper-16 252418 4546 ns/op 2720 B/op 30 allocs/op
BenchmarkDefaultConfigProvider/Custom-16 450756 2651 ns/op 1008 B/op 6 allocs/op
```
Fixes#8633Fixes#8618Fixes#8630
Updates #8591Closes#6680Closes#5192
This change is mostly motivated to get a more stable CI build (we're building the Hugo site there, with Instagram and Twitter shortcodes sometimes failing).
Fixes#7866