Commit graph

8 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
c8710625b7
tpl: Fix it so embedded render-codeblock-goat is used even if custom render-codeblock exists
Fixes #13595
2025-04-12 13:03:45 +02:00
Bjørn Erik Pedersen
d1c394442b
tpl: Fix codeblock hook resolve issue
Fixes #13593
2025-04-11 18:59:42 +02:00
Bjørn Erik Pedersen
1074e01152 tpl: Fix legacy section mappings
Fixes #13584
2025-04-11 18:23:51 +02:00
Bjørn Erik Pedersen
3b9f2a7ded tpl: Skip dot and temp files inside /layouts
Fixes #13579
2025-04-10 18:41:01 +02:00
Bjørn Erik Pedersen
383dd82f95 tpl: Warn and skip non-hook templates inside /layouts/_markup
Fixes #13577
2025-04-10 16:54:05 +02: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