Commit graph

728 commits

Author SHA1 Message Date
hugoreleaser
df44ee1353 releaser: Prepare repository for 0.147.0-DEV
[ci skip]
2025-04-22 17:42:19 +00:00
hugoreleaser
1ad3d39dc4 releaser: Bump versions for release of 0.146.7
[ci skip]
2025-04-22 17:26:42 +00:00
Bjørn Erik Pedersen
496730840e Revert the breaking change from 0.146.0 with dots in content filenames
Closes #13632
2025-04-22 19:23:19 +02:00
hugoreleaser
99fff2997d releaser: Prepare repository for 0.147.0-DEV
[ci skip]
2025-04-20 11:13:56 +00:00
hugoreleaser
1e0b058efe releaser: Bump versions for release of 0.146.6
[ci skip]
2025-04-20 10:58:40 +00:00
hugoreleaser
d5a8c330cb releaser: Prepare repository for 0.147.0-DEV
[ci skip]
2025-04-15 18:09:42 +00:00
hugoreleaser
61328976e1 releaser: Bump versions for release of 0.146.5
[ci skip]
2025-04-15 17:54:38 +00:00
Bjørn Erik Pedersen
d61b9fc605 tpl: Fix language handling in partials
We now use the same code path for all templates re this.

Fixes #13612
2025-04-15 11:25:54 +02:00
hugoreleaser
01667275d4 releaser: Prepare repository for 0.147.0-DEV
[ci skip]
2025-04-14 13:25:05 +00:00
hugoreleaser
985af1c097 releaser: Bump versions for release of 0.146.4
[ci skip]
2025-04-14 13:10:30 +00:00
hugoreleaser
915ba3f7f0 releaser: Prepare repository for 0.147.0-DEV
[ci skip]
2025-04-12 17:36:11 +00:00
hugoreleaser
05ef8b713a releaser: Bump versions for release of 0.146.3
[ci skip]
2025-04-12 17:21:50 +00:00
hugoreleaser
53221f88ca releaser: Prepare repository for 0.147.0-DEV
[ci skip]
2025-04-11 17:39:58 +00:00
hugoreleaser
ff3ab192c2 releaser: Bump versions for release of 0.146.2
[ci skip]
2025-04-11 17:25:13 +00:00
hugoreleaser
e3e3f9ae17 releaser: Prepare repository for 0.147.0-DEV
[ci skip]
2025-04-10 16:59:48 +00:00
hugoreleaser
acc4fe24be releaser: Bump versions for release of 0.146.1
[ci skip]
2025-04-10 16:44:46 +00:00
hugoreleaser
648204b3f1 releaser: Prepare repository for 0.147.0-DEV
[ci skip]
2025-04-10 15:13:26 +00:00
hugoreleaser
5d1b9d3985 releaser: Bump versions for release of 0.146.0
[ci skip]
2025-04-10 14:57:56 +00:00
Bjørn Erik Pedersen
208a0de6c3 tpl: Add a partial lookup cache
````
                 │ stash.bench  │          perf-v146.bench           │
                 │    sec/op    │   sec/op     vs base               │
LookupPartial-10   248.00n ± 0%   14.75n ± 2%  -94.05% (p=0.002 n=6)

                 │ stash.bench │          perf-v146.bench          │
                 │    B/op     │   B/op     vs base                │
LookupPartial-10    48.00 ± 0%   0.00 ± 0%  -100.00% (p=0.002 n=6)

                 │ stash.bench │          perf-v146.bench           │
                 │  allocs/op  │ allocs/op   vs base                │
LookupPartial-10    3.000 ± 0%   0.000 ± 0%  -100.00% (p=0.002 n=6)
```

THe speedup above assumes reuse of the same partials over and over again, which I think is not uncommon.

This commits also adds some more lookup benchmarks. The current output of these on my MacBook looks decent:

```
BenchmarkLookupPagesLayout/Single_root-10                3031562               395.5 ns/op             0 B/op          0 allocs/op
BenchmarkLookupPagesLayout/Single_sub_folder-10          2515915               480.9 ns/op             0 B/op          0 allocs/op
BenchmarkLookupPartial-10                               84808112                14.13 ns/op            0 B/op          0 allocs/op
BenchmarkLookupShortcode/toplevelpage-10                 8111779               148.2 ns/op             0 B/op          0 allocs/op
BenchmarkLookupShortcode/nestedpage-10                   8088183               148.6 ns/op             0 B/op          0 allocs/op
```

Note that in the above the partial lookups are cahced, the others not (they are harder to cache because of the page path).

Closes #13571
2025-04-10 11:07:19 +02:00
Bjørn Erik Pedersen
d4c6dd16b1 tpl: Add templates.Current
This commit also

* Unexport all internal state in TemplateInfo.
* Make the dispatcher keys used for passing context.Context into uint8 from string to save memory allocations.

Co-authored-by: Joe Mooring <joe@mooring.com>

Updates #13571
2025-04-09 20:15:40 +02:00
Bjørn Erik Pedersen
83cfdd78ca
Reimplement and simplify Hugo's template system
See #13541 for details.

Fixes #13545
Fixes #13515
Closes #7964
Closes #13365
Closes #12988
Closes #4891
2025-04-06 20:59:41 +02:00
Bjørn Erik Pedersen
812ea0b325 config: Use the non-global logger for deprecations when possible
To prevent warnings leaking into parallel tests.
2025-04-03 13:43:54 +02:00
Bjørn Erik Pedersen
8d2379bcb3 common/hreflect: Replace the map/RWMutex method cache with sync.Map
It's much faster when running in parallel:

```
GetMethodByName-10        125.1n ± 6%   181.7n ± 7%  +45.30% (p=0.002 n=6)
GetMethodByNamePara-10   770.10n ± 1%   24.77n ± 9%  -96.78% (p=0.002 n=6)
```
2025-03-26 14:24:51 +01:00
Joe Mooring
a6bd67793b common/hexec: Remove github.com/cli/safeexec
We began using the safeexec package in v0.79.1 to address
https://github.com/gohugoio/hugo/security/advisories/GHSA-8j34-9876-pvfq.

The vulnerability was addressed by the Go team in 1.19, so the safeexec
package is no longer needed.

Closes #13516
2025-03-23 13:55:42 +01:00
hugoreleaser
cb4a097190 releaser: Prepare repository for 0.146.0-DEV
[ci skip]
2025-02-26 15:58:38 +00:00
hugoreleaser
666444f0a5 releaser: Bump versions for release of 0.145.0
[ci skip]
2025-02-26 15:41:25 +00:00
Bjørn Erik Pedersen
c498d0fe1e Use the page path and not the backing filename as the last resort in the default sort
This should:

1. Fix some (rare) tiebreaker issues when sorting pages from multiple content adapters.
2. Improve the sorting for pages without a backing file.
2025-02-26 13:06:26 +01:00
Bjørn Erik Pedersen
521911a576 all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
hugoreleaser
669216e204 releaser: Prepare repository for 0.145.0-DEV
[ci skip]
2025-02-18 12:29:51 +00:00
hugoreleaser
a79d63a446 releaser: Bump versions for release of 0.144.1
[ci skip]
2025-02-18 12:14:07 +00:00
hugoreleaser
f1e799c2e1 releaser: Prepare repository for 0.145.0-DEV
[ci skip]
2025-02-17 16:36:56 +00:00
hugoreleaser
b289b17c43 releaser: Bump versions for release of 0.144.0
[ci skip]
2025-02-17 16:22:31 +00:00
Bjørn Erik Pedersen
9b5f786df8 Deprecate kind, lang, and path from front matter
These were added to the page meta object when we implemented "pages from data", but were not meant to be used in front matter.

That is not supported, so we might as well add validation.

Fixes #12484
2025-02-10 21:22:43 +01:00
Bjørn Erik Pedersen
c2fb221209 Add ContentTypes to config
This is an empty struct for now, but we will most likely expand on that.

```
[contentTypes]
  [contentTypes.'text/markdown']
```

The above means that only Markdown will be considered a content type. E.g. HTML will be treated as plain text.

Fixes #12274
2025-02-08 10:31:15 +01:00
Oleksandr Redko
4245a4514d
all: Remove deprecated build tags 2025-02-08 10:29:42 +01:00
hugoreleaser
377287a614 releaser: Prepare repository for 0.144.0-DEV
[ci skip]
2025-02-04 09:14:03 +00:00
hugoreleaser
0270364a34 releaser: Bump versions for release of 0.143.1
[ci skip]
2025-02-04 08:57:38 +00:00
Joe Mooring
7104de83ce common/hugo: Adjust deprecation timing and message
Closes #13333
2025-02-03 18:32:30 +01:00
hugoreleaser
05e067ced8 releaser: Prepare repository for 0.144.0-DEV
[ci skip]
2025-02-01 16:09:38 +00:00
hugoreleaser
ee48d9692a releaser: Bump versions for release of 0.143.0
[ci skip]
2025-02-01 15:56:04 +00:00
Bjørn Erik Pedersen
329b2342f0 Fix "concurrent map iteration and map write" in pages from data
Fixes #13254
2025-01-30 19:57:09 +01:00
Bjørn Erik Pedersen
cd7dc7a372 Fix some server rebuild issues for non-HTML custom output formats
The failing test case here is

* A custom search output format defined on the home page, marked as `noAlternative` and not `permalinkable`
* In fast render mode, when making a change to a data source for that search output format, the JSON file was not refreshed.

There are variants of the above, but the gist of it is:

* The change set was correctly determined, but since the search JSON file was not in the recently visited browser stack, we skipped rendering it.

Running with `hugo server --disableFastRender` would be a workaround for the above.

This commit fixes this by:

* Adding a check for the HTTP request header `Sec-Fetch-Mode = navigation` to the condition for if we should track server request as a user navigation (and not e.g. a HTTP request for a linked CSS stylesheet).
* Making sure that we compare against the real relative URL for non-permalinkable output formats.

Fixes #13014
2025-01-24 17:27:02 +01:00
Bjørn Erik Pedersen
7f0f50b133 Make cascade front matter order deterministic
Fixes #12594
2025-01-23 09:45:47 +01:00
hugoreleaser
9d765e1b99 releaser: Prepare repository for 0.143.0-DEV
[ci skip]
2025-01-22 12:35:08 +00:00
hugoreleaser
1f746a8724 releaser: Bump versions for release of 0.142.0
[ci skip]
2025-01-22 12:20:52 +00:00
W. Michael Petullo
4b0c194fb3 Fix build with Go 1.24
Go 1.24 provides stricter checking that forbids passing a variable as
a format string to Printf-family functions with no other arguments. Remove
instances of this. See also:

https://tip.golang.org/doc/go1.24#vet

Signed-off-by: W. Michael Petullo <mike@flyn.org>
2025-01-21 11:10:03 +01:00
hugoreleaser
e91d3cff98 releaser: Prepare repository for 0.142.0-DEV
[ci skip]
2025-01-16 13:26:52 +00:00
hugoreleaser
e7bd51698e releaser: Bump versions for release of 0.141.0
[ci skip]
2025-01-16 13:11:18 +00:00
Jack Baldry
8b52626915
common/paths: Fix docstring 2025-01-16 10:58:18 +01:00
Bjørn Erik Pedersen
a2edf04c27 deps: Upgrade github.com/gohugoio/hashstructure from 0.1.0 to 0.3.0
Faster hashing of maps:

```
           │ stash.bench  │      deps-hashstructv030.bench      │
           │    sec/op    │    sec/op     vs base               │
HashMap-10   198.9µ ± ∞ ¹   142.6µ ± ∞ ¹  -28.31% (p=0.029 n=4)
¹ need >= 6 samples for confidence interval at level 0.95

           │  stash.bench  │      deps-hashstructv030.bench       │
           │     B/op      │     B/op       vs base               │
HashMap-10   92.38Ki ± ∞ ¹   37.14Ki ± ∞ ¹  -59.80% (p=0.029 n=4)
¹ need >= 6 samples for confidence interval at level 0.95

           │ stash.bench  │      deps-hashstructv030.bench      │
           │  allocs/op   │  allocs/op    vs base               │
HashMap-10   6.747k ± ∞ ¹   4.748k ± ∞ ¹  -29.63% (p=0.029 n=4)
```
2025-01-13 16:22:24 +02:00