Bjørn Erik Pedersen
2d80b8a741
For multiple dimensions setups, fix alias handling and multihost publish path
...
* The alias handling was left as is when we added new dimensions in v0.152.0, which meant that if you had `defaultContentVersionInSubDir=true` set, the alias page in the root would not be correctly created.
* Also, if you had multihost setup with multiple dimensions, the publish would be incorrect: The language key was added last instead of first.
* The home page alias handling is reworked and made more robust, which also fixes some subtle issues:
* It now supports redircects for multiple HTML output formats for the home page.
* We skip creating aliases for disabled home pages.
* With potentially multiple output formats with one of them canonical, we added a new `Canonical` method to the `Page.OutputFormats`, which allows you to do this in a template:
```handlebars
{{ with .OutputFormats.Canonical }}<link rel="{{ .Rel }}" href="{{ .Permalink }}">{{ end }}
```
Fixes #14354
Fixes #14356
2026-01-10 15:34:51 +01:00
Bjørn Erik Pedersen
09048aad76
Fix partial decorator detection in partial with blocks with outer range break or continue
...
E.g.:
```handlebars
{{- $items := slice "a" "b" "c" }}
{{- range $items }}
{{- with partial "b" . -}}
{{break}}
{{- else }}
else: {{ . -}}
{{- end }}
{{- end }}
```
Fixes #14333
2026-01-01 18:05:10 +01:00
Bjørn Erik Pedersen
7c19c196c3
Allow partials to work as decorators
...
Fixes #13193
2025-12-30 15:58:55 +01:00
Bjørn Erik Pedersen
0637adb239
Improve error messages for template failures
2025-12-17 21:12:15 +01:00
Bjørn Erik Pedersen
588d20b315
deps: Upgrade github.com/alecthomas/chroma/v2 v2.20.0 => v2.21.0
...
Closes #14266
2025-12-17 11:18:56 +01:00
Bjørn Erik Pedersen
3073fd5ccf
testing: Replace legacy config.toml with hugo.toml in most tests
2025-11-27 12:08:08 +01:00
Bjørn Erik Pedersen
b9b304a126
testing: Port integration tests to new templates structure
...
As introduced in v0.146.0. Keep some legecy test to preserve backwards compatibility.
2025-11-27 12:00:15 +01:00
Joe Mooring
565a10cbf0
config/privacy: Change GoogleAnalytics.RespectDoNotTrack default to true
...
Closes #13307
2025-11-27 09:46:53 +01:00
Bjørn Erik Pedersen
555dfa207a
Speedup and simplify page assembly for deeper content trees
...
This commit moves to a forked version go-radix (fork source has not had any updates in 3 years.), whith 2 notable changes:
* It's generic (using Go generics) and thus removes a lot of type conversions/assertions.
* It allows nodes to be replaced during walk, which allows to partition the tree for parallel processing without worrying about locking.
For this repo, this means:
* The assembly step now processes nested sections in parallel, which gives a speedup for deep content trees with a slight allocation penalty (see benchmarks below).
* Nodes that needs to be reinserted are inserted directly.
* Also, there are some drive-by fixes of some allocation issues, e.g. avoid wrapping mutexes in returned anonomous functions, a common source of hidden allocations.
```
│ master.bench │ perf-p3.bench │
│ sec/op │ sec/op vs base │
AssembleDeepSiteWithManySections/depth=1/sectionsPerLevel=1/pagesPerSection=50-10 6.958m ± 3% 7.015m ± 3% ~ (p=0.589 n=6)
AssembleDeepSiteWithManySections/depth=1/sectionsPerLevel=6/pagesPerSection=100-10 14.25m ± 1% 14.56m ± 8% ~ (p=0.394 n=6)
AssembleDeepSiteWithManySections/depth=1/sectionsPerLevel=6/pagesPerSection=500-10 48.07m ± 3% 49.23m ± 3% ~ (p=0.394 n=6)
AssembleDeepSiteWithManySections/depth=2/sectionsPerLevel=6/pagesPerSection=100-10 66.66m ± 4% 66.47m ± 6% ~ (p=0.485 n=6)
AssembleDeepSiteWithManySections/depth=4/sectionsPerLevel=2/pagesPerSection=100-10 59.57m ± 4% 50.73m ± 5% -14.85% (p=0.002 n=6)
geomean 28.54m 27.92m -2.18%
│ master.bench │ perf-p3.bench │
│ B/op │ B/op vs base │
AssembleDeepSiteWithManySections/depth=1/sectionsPerLevel=1/pagesPerSection=50-10 4.513Mi ± 0% 4.527Mi ± 0% +0.33% (p=0.002 n=6)
AssembleDeepSiteWithManySections/depth=1/sectionsPerLevel=6/pagesPerSection=100-10 15.35Mi ± 0% 15.49Mi ± 0% +0.94% (p=0.002 n=6)
AssembleDeepSiteWithManySections/depth=1/sectionsPerLevel=6/pagesPerSection=500-10 62.50Mi ± 0% 63.19Mi ± 0% +1.10% (p=0.002 n=6)
AssembleDeepSiteWithManySections/depth=2/sectionsPerLevel=6/pagesPerSection=100-10 86.78Mi ± 0% 87.73Mi ± 0% +1.09% (p=0.002 n=6)
AssembleDeepSiteWithManySections/depth=4/sectionsPerLevel=2/pagesPerSection=100-10 62.96Mi ± 0% 63.66Mi ± 0% +1.12% (p=0.002 n=6)
geomean 29.84Mi 30.11Mi +0.92%
│ master.bench │ perf-p3.bench │
│ allocs/op │ allocs/op vs base │
AssembleDeepSiteWithManySections/depth=1/sectionsPerLevel=1/pagesPerSection=50-10 60.44k ± 0% 60.97k ± 0% +0.87% (p=0.002 n=6)
AssembleDeepSiteWithManySections/depth=1/sectionsPerLevel=6/pagesPerSection=100-10 205.8k ± 0% 211.4k ± 0% +2.70% (p=0.002 n=6)
AssembleDeepSiteWithManySections/depth=1/sectionsPerLevel=6/pagesPerSection=500-10 831.1k ± 0% 858.3k ± 0% +3.27% (p=0.002 n=6)
AssembleDeepSiteWithManySections/depth=2/sectionsPerLevel=6/pagesPerSection=100-10 1.157M ± 0% 1.197M ± 0% +3.41% (p=0.002 n=6)
AssembleDeepSiteWithManySections/depth=4/sectionsPerLevel=2/pagesPerSection=100-10 839.9k ± 0% 867.8k ± 0% +3.31% (p=0.002 n=6)
geomean 398.5k 409.3k +2.71%
```
2025-11-25 11:37:05 +01:00
Bjørn Erik Pedersen
a2469d504e
testing: Rewrite all the old style integration tests to txtar style tests
...
And remove some not worth keeping (or too much work to convert).
2025-11-10 12:00:58 +01:00
Bjørn Erik Pedersen
04650ce778
all: Run modernize -fix ./...
...
Closes #14107
2025-11-05 21:05:42 +01:00
Bjørn Erik Pedersen
264022a75a
Add roles and versions as new dimensions (in addition to language)
...
See the main issue #13776 for details.
Fixes #519
Fixes #13680
Fixes #13663
Fixes #13776
Fixes #13855
Fixes #13648
Fixes #13996
Fixes #14001
Fixes #14031
Fixes #13818
Fixes #13196
2025-11-05 20:39:25 +01:00
Lukáš Zapletal
25c0f2408a
Remove noindex meta tag from alias.html
...
Google does not behave as expected when an alias is used. It does not index the client-side alias page, but on top of that it also does not index the original page.
Google does not require noindex to be present and since alias pages do not have any content, it makes little sense to provide it. Therefore, this patch removes the line completely.
https://developers.google.com/search/docs/crawling-indexing/301-redirects
2025-09-04 15:58:23 +02:00
Bjørn Erik Pedersen
cfc38ecfed
deps: Upgrade github.com/alecthomas/chroma/v2 v2.19.0 => v2.20.0
...
CLoses #13917
2025-08-25 18:24:07 +02:00
n1xx1
2216028620
Add a key to the partialCached deadlock prevention
...
Fixes #13889
2025-08-07 11:17:14 +02:00
Bjørn Erik Pedersen
7ff5ec734c
tpl: Add test for recent template selection regression
...
Closes #13868
Co-authored-by: Joe Mooring <joe.mooring@veriphor.com >
2025-07-27 14:39:39 +02:00
Bjørn Erik Pedersen
9c57af1351
Fix regression with hyphenated codeblock templates, e.g. render-codeblock-go-html-template.html
...
Fixes #13864
Co-authored-by: Joe Mooring <joe.mooring@veriphor.com >
2025-07-27 14:39:39 +02:00
Joe Mooring
84b31721bf
markup/goldmark: Change link and image render hook enablement to enums
...
Closes #13535
2025-07-07 11:19:34 +02:00
Joe Mooring
18a9ca7d7a
tpl/tplimpl: Copy embedded HTML table render hook to each output format
...
Closes #13351
2025-06-21 14:37:47 +02:00
Joe Mooring
b6c8dfa9dc
tpl/tplimpl: Change resources.GetRemote errors to suppressible warnings
...
Closes #13803
2025-06-17 07:35:14 -07:00
Bjørn Erik Pedersen
5273a884d4
Fix language handling in shortcode templates
...
Fixes #13767
2025-05-31 13:57:00 +02:00
Bjørn Erik Pedersen
9ad26b69ad
Fix it so e.g. de in layouts/_shortcodes/de.html is not interpreted as a language code
...
Fixes #13740
2025-05-26 20:26:56 +02:00
Bjørn Erik Pedersen
0c7b1a3f26
Fix live reload when editing inline partials
...
Fixes #13723
2025-05-22 13:15:41 +02:00
Bjørn Erik Pedersen
5a81a3a4cf
tpl: Add a test case
...
I'm not able to reproduce this, but leaving it in.
Closes #13699
2025-05-18 12:48:24 +02:00
Bjørn Erik Pedersen
61317821e4
tpl: Narrow down the usage of plain text shortcodes when rendering HTML
...
After this commit, if you want to resolve `layouts/_shortcodes/myshortcode.txt` when rendering HTML content, you need to use the `{{%` shortcode delimiter:
```
{{% myshortcode %}}
```
This should be what people would do anyway, but we have also as part of this improved the error message to inform about what needs to be done.
Note that this is not relevant for partials.
Fixes #13698
2025-05-18 12:48:24 +02:00
Bjørn Erik Pedersen
6142bc701c
tpl: Fix theme overrides when theme has old layout setup (e.g. _default)
...
Fixes #13715
2025-05-18 12:48:24 +02:00
Joe Mooring
81426998b8
tpl/tplimpl: Change calls to simple versions of embedded shortcodes
...
Closes #13700
2025-05-12 14:19:11 +02:00
Bjørn Erik Pedersen
c745a3e108
Fix/implement cascade for content adapters
...
Fixes #13692
2025-05-10 15:12:24 +02:00
Joe Mooring
84d7a108e8
tpl/tplimpl: Fix vimeo shortcode test to accommodate API changes
...
Fixes #13687
2025-05-09 10:02:00 -07:00
Bjørn Erik Pedersen
80f0595311
tpl: Fix case issue in templates.Exists
...
Fixes #13684
2025-05-05 11:23:52 +02:00
Bjørn Erik Pedersen
5fec7829b1
tpl: Add some more test cases
...
See #13672
See #13668
2025-05-01 12:55:11 +02:00
Bjørn Erik Pedersen
be93d5218b
tpl: Fix overlapping layout sections
...
Fixes #13672
2025-04-30 21:04:03 +02:00
Bjørn Erik Pedersen
07983e04e2
tpl: Fix it so we always prefer internal codeblock rendering over render-codeblock-foo.html and similar
...
Fixes #13651
2025-04-25 10:51:33 +02:00
Joe Mooring
5c491409d3
tpl/tplimpl: Fix allowFullScreen option in Vimeo and YouTube shortcodes
...
Closes #13650
2025-04-24 14:14:46 -07:00
Bjørn Erik Pedersen
ad4f63c92f
tpl: Remove some unreached code branches
2025-04-24 14:27:59 +02:00
Christian Oliff
6a0e04241a
all: Fix typos
2025-04-24 10:19:17 +02: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
Bjørn Erik Pedersen
6d69dc88a4
tpl: Fix indeterminate template lookup with templates with and without lang
...
Close #13636
2025-04-22 17:29:39 +02:00
Bjørn Erik Pedersen
5e62cc6fce
tpl: Fix layout fall back logic when layout is set in front matter but not found
...
Fixes #13630
2025-04-21 15:17:20 +02:00
Bjørn Erik Pedersen
1408c156d8
tpl: Detect and fail on infinite template recursion
...
Fixes #13627
2025-04-21 15:17:20 +02:00
Bjørn Erik Pedersen
088cd2f996
tpl: Fix when layout specified in front matter and no match is found
...
Fixes #13628
2025-04-20 12:55:18 +02: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
Bjørn Erik Pedersen
65c94c7b23
tpl: Fix issue with partials without suffix
...
Fixes #13601
2025-04-14 14:38:22 +02:00
Bjørn Erik Pedersen
e8e8ce10d2
tpl: Avoid panic on nonsensical return construct
...
Fixes #13600
2025-04-14 14:38:22 +02:00
Bjørn Erik Pedersen
cf9e6904cc
tpl: Fix the case for a shortcode in a nested folder only
...
Fixes #13605
2025-04-14 14:38:22 +02:00
Bjørn Erik Pedersen
8a2830f2dc
tpl: Add proper file context to template parse errors
...
Fixes #13604
2025-04-14 14:38:22 +02:00
Bjørn Erik Pedersen
1e0287f472
tpl: Make {{ template "partials/foo.html" . }} work in older setups
...
Fixes #13599
2025-04-14 14:38:22 +02:00
Bjørn Erik Pedersen
30b9c19c76
tpl: Make any layout set in front matter higher priority
...
Fixes #13541
2025-04-12 18:12:06 +02:00
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