Commit graph

2285 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
6bde2a5f88
Make all renderhook Text methods return template.HTML 2024-08-31 17:37:13 +02:00
Bjørn Erik Pedersen
f738669a4d Add Markdown render hooks for tables
Fixes #9316
Fixes #12811
2024-08-31 17:21:31 +02:00
Bjørn Erik Pedersen
37609262dc Add Page.Contents with scope support
Note that this also adds a new `.ContentWithoutSummary` method, and to do that we had to unify the different summary types:

Both `auto` and `manual` now returns HTML. Before this commit, `auto` would return plain text. This could be considered to be a slightly breaking change, but for the better: Now you can treat the `.Summary` the same without thinking about where it comes from, and if you want plain text, pipe it into `{{ .Summary | plainify }}`.

Fixes #8680
Fixes #12761
Fixes #12778
Fixes #716
2024-08-29 16:45:21 +02:00
Bjørn Erik Pedersen
371246de25
hugolib: Add a test for overriding _internal templates 2024-08-28 08:17:16 +02:00
Bjørn Erik Pedersen
5f667f8796 Fix missing method NameNormalized panic
Closes #12795
2024-08-25 23:17:26 +02:00
Bjørn Erik Pedersen
01008ba512 Add config options page.nextPrevSortOrder/nextPrevInSectionSortOrder
See #12776
2024-08-17 16:47:50 +02:00
b10c
5220d371ea
resources: Add URI GetRemote error
Previouly, only "ERROR failed to fetch remote resource: Forbidden"
would be shown when a resource failed to load. In my case, a tweet's
author I was embedding using the twitter shortcode switched his profile
to private which resulted in my blog failing to build. To figure out
where the originates, I added the log to the error message.
2024-08-14 13:24:58 +02:00
Bjørn Erik Pedersen
33c0938cd5 Add build time math rendering
While very useful on its own (and combined with the passthrough render hooks), this also serves as a proof of concept of using WASI (WebAssembly System Interface) modules in Hugo.

This will be marked _experimental_ in the documentation. Not because it will be removed or changed in a dramatic way, but we need to think a little more how to best set up/configure similar services, define where these WASM files gets stored, maybe we can allow user provided WASM files plugins via Hugo Modules mounts etc.

See these issues for more context:

* https://github.com/gohugoio/hugo/issues/12736
* https://github.com/gohugoio/hugo/issues/12737

See #11927
2024-08-09 17:18:37 +02:00
Bjørn Erik Pedersen
665ac949bd markup: Add blockquote render hooks
Closes #12590
2024-08-07 18:28:23 +02:00
Bjørn Erik Pedersen
c6227f1d85 Add render hooks for inline and block passthrough snippets
Fixes #11927
2024-08-07 18:28:23 +02:00
Bjørn Erik Pedersen
69455fa422
Fix deprecation errors 2024-08-05 19:23:53 +02:00
n1xx1
566fe7ba12
resources/page: Expand parmalinks tokens in url
This change allows to use permalink tokens in url front matter fields. This should be useful to target more specific pages instead of using a global permalink configuration. It's expected to be used with cascade.

Fixes #9714
2024-08-01 12:14:29 +02:00
Bjørn Erik Pedersen
216a69a1ef Shorten processed image filenames
Fixes #12688
Fixes #12656
2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
e67886c038 Consolidate all hashing to the common/hashing package
And remove now unsued hashing funcs.
2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
2babd6404e identity: Use xxHash in hashstructure (note)
```
name                 old time/op    new time/op    delta
HashString/n28-10       133ns ± 9%     107ns ±10%  -19.58%  (p=0.029 n=4+4)
HashString/n112-10      243ns ± 5%     121ns ± 4%  -50.08%  (p=0.029 n=4+4)
HashString/n448-10      698ns ± 3%     174ns ± 5%  -75.02%  (p=0.029 n=4+4)
HashString/n1792-10    2.58µs ± 4%    0.38µs ± 4%  -85.11%  (p=0.029 n=4+4)
HashString/n7168-10    10.0µs ± 3%     1.3µs ± 4%  -86.91%  (p=0.029 n=4+4)

name                 old alloc/op   new alloc/op   delta
HashString/n28-10       80.0B ± 0%     72.0B ± 0%  -10.00%  (p=0.029 n=4+4)
HashString/n112-10       160B ± 0%      152B ± 0%   -5.00%  (p=0.029 n=4+4)
HashString/n448-10       496B ± 0%      488B ± 0%   -1.61%  (p=0.029 n=4+4)
HashString/n1792-10    1.84kB ± 0%    1.83kB ± 0%   -0.43%  (p=0.029 n=4+4)
HashString/n7168-10    8.24kB ± 0%    8.23kB ± 0%   -0.06%  (p=0.029 n=4+4)

name                 old allocs/op  new allocs/op  delta
HashString/n28-10        4.00 ± 0%      3.00 ± 0%  -25.00%  (p=0.029 n=4+4)
HashString/n112-10       4.00 ± 0%      3.00 ± 0%  -25.00%  (p=0.029 n=4+4)
HashString/n448-10       4.00 ± 0%      3.00 ± 0%  -25.00%  (p=0.029 n=4+4)
HashString/n1792-10      4.00 ± 0%      3.00 ± 0%  -25.00%  (p=0.029 n=4+4)
HashString/n7168-10      4.00 ± 0%      3.00 ± 0%  -25.00%  (p=0.029 n=4+4)
```
2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
72ff937e11 Switch EXIF library
Closes #10855
Closes #8586
Closes #8996
2024-07-20 15:56:10 +02:00
Bjørn Erik Pedersen
7be0377505 deps: Upgrade github.com/bep/gitmap v1.4.0 => v1.6.0 (note)
Closes #8627
2024-07-17 10:54:28 +02:00
Bjørn Erik Pedersen
8cf96f244a Fix site.GetPage, never do short lookups for paths with leadig slash
Fixes #12638
2024-07-04 10:09:18 +02:00
Bjørn Erik Pedersen
7b6dafc53a Fix it so publishDate rolls up to section, taxonomy, or term pages
Fixes #12438
2024-07-01 21:48:12 +02:00
Bjørn Erik Pedersen
e1317dd322 Add css.TailwindCSS
Closes #12618
Closes #12620
2024-06-25 15:48:02 +02:00
Bjørn Erik Pedersen
6cd0784e44 Implement defer
Closes #8086
Closes #12589
2024-06-23 11:25:47 +02:00
Bjørn Erik Pedersen
8731d88222
Fix Erroridf/Warnidf mixed case issue
Fixes #12617
2024-06-22 19:01:56 +02:00
Bjørn Erik Pedersen
478a9107a6 Speed up GetTerms
```text
name                               old time/op    new time/op    delta
TaxonomiesGetTerms/pages_100-10      5.25ms  5%    5.13ms  4%     ~     (p=0.486 n=4+4)
TaxonomiesGetTerms/pages_1000-10     30.1ms  1%    26.8ms  1%  -11.13%  (p=0.029 n=4+4)
TaxonomiesGetTerms/pages_10000-10     1.33s 24%     0.29s  2%  -78.42%  (p=0.029 n=4+4)
TaxonomiesGetTerms/pages_20000-10     5.50s 12%     0.83s 28%  -84.88%  (p=0.029 n=4+4)

name                               old alloc/op   new alloc/op   delta
TaxonomiesGetTerms/pages_100-10      4.08MB  0%    4.06MB  0%   -0.59%  (p=0.029 n=4+4)
TaxonomiesGetTerms/pages_1000-10     25.1MB  0%    24.9MB  0%   -0.87%  (p=0.029 n=4+4)
TaxonomiesGetTerms/pages_10000-10     238MB  2%     233MB  0%   -1.94%  (p=0.029 n=4+4)
TaxonomiesGetTerms/pages_20000-10     469MB  0%     465MB  0%   -1.00%  (p=0.029 n=4+4)

name                               old allocs/op  new allocs/op  delta
TaxonomiesGetTerms/pages_100-10       49.5k  0%     48.9k  0%   -1.17%  (p=0.029 n=4+4)
TaxonomiesGetTerms/pages_1000-10       304k  0%      298k  0%   -1.97%  (p=0.029 n=4+4)
TaxonomiesGetTerms/pages_10000-10     3.02M  7%     2.81M  0%   -7.09%  (p=0.029 n=4+4)
TaxonomiesGetTerms/pages_20000-10     5.77M  1%     5.59M  0%   -3.19%  (p=0.029 n=4+4)

```

Note that the numbers above represents a full site build, but GetTerms is a big part of the site in question.

Fixes #12610
2024-06-19 15:18:43 +02:00
Joe Mooring
cba2de6ec9 resources/page: Let GroupByParam return nil instead of error
Closes #12578
2024-06-08 18:35:14 +02:00
Bjørn Erik Pedersen
9c4e14eb4f Add option to not generate aliases for first page of pagination pages
Also consolidate the pagination configuration into a struct.

Closes #12572
2024-06-08 15:42:01 +02:00
Bjørn Erik Pedersen
2b05a50f8f Misc remote HTTP/content adapter enhancements
* Recover from server errors
* Improve go adapter rebuilds when adding new content

See #12502
Fixes #12570
2024-06-05 12:16:40 +02:00
Bjørn Erik Pedersen
447108fed2
Add a HTTP cache for remote resources.
Fixes #12502
Closes #11891
2024-06-04 16:07:39 +02:00
Bjørn Erik Pedersen
917199a94e content adapter: Fix site.GetPage using the base part of the path
Fixes #12561
2024-06-02 13:30:52 +02:00
Joe Mooring
c8dac67def resources/page: Deprecate .Sites.First in favor of .Sites.Default
Closes #12513
2024-06-01 18:02:19 +02:00
Bjørn Erik Pedersen
0221ddb39e content adapter: Handle <!--more--> separator in content.value
Closes #12556
2024-06-01 12:04:05 +02:00
Bjørn Erik Pedersen
1464091ad6 content adapter: Fix server crash on partial edit
Fixes #12538
2024-05-30 16:22:26 +02:00
Bjørn Erik Pedersen
245928a1ff content adapter: Add support for menus in AddPage
Fixes #12507
2024-05-30 11:29:21 +02:00
Bjørn Erik Pedersen
519f41dbd7 content adapter: Fix issue with content starting out with a shortcode
Fixes #12544
2024-05-30 11:29:21 +02:00
Joe Mooring
7f3061723e hugolib: Allow override of sitemap file name
Closes #12525
2024-05-23 07:55:53 +02:00
Bjørn Erik Pedersen
6b006616e5 Also warn about duplicate content paths with --printPathWarnings
Closes #12511
2024-05-17 21:55:05 +02:00
Bjørn Erik Pedersen
39cf906bc0 Fix mixed case Page params handling in content adapters
Fixes #12497
2024-05-15 12:39:33 +02:00
Bjørn Erik Pedersen
1aacfced39 Fix paths with dots issue with content adapters
Fixes #12493
2024-05-15 12:39:33 +02:00
Bjørn Erik Pedersen
e2d66e3218
Create pages from _content.gotmpl
Closes #12427
Closes #12485
Closes #6310
Closes #5074
2024-05-14 13:12:08 +02:00
Bjørn Erik Pedersen
bb59a7ed97 Fix one more resource change eviction logic issue
This is how we should have fixed #1239.

Fixes #12456
2024-05-05 12:41:51 +02:00
Bjørn Erik Pedersen
503d20954f
Make the cache eviction logic for stale entities more robust
Fixes #12458
2024-05-04 19:45:43 +02:00
Bjørn Erik Pedersen
c892e75fbc
resources/page: Pull internal Page methods into its own interface
So it doesn't get visible when passing it to `jsonify`.
2024-05-02 10:49:02 +02:00
Bjørn Erik Pedersen
7be7f89bf6 Fix rebuilds on cascade deletes/renames
And also avoid reading sub directories on simple changes to branch `_index.md` files.

Fixes #12449
2024-05-01 17:18:30 +02:00
Bjørn Erik Pedersen
c8e400b621 commands: Print "Webserver is ..." right before "Total ..."
Also fix it so

* It's not printed when running `hugo -w`
* It'd printed for all kinds of rebuilds

Fixes #12384
2024-05-01 10:52:40 +02:00
Bjørn Erik Pedersen
9dd687027f Make sure replaced pages gets marked as stale
Fixes #12436
2024-04-30 20:57:44 +02:00
Bjørn Erik Pedersen
babcb339a8 config: Setups with only one active language can never be multihost
Fixes #12288
2024-04-25 14:35:49 +02:00
Bjørn Erik Pedersen
7203a95a60 Fix rebuilds when running hugo -w
This was partly broken in Hugo 0.123.0.

We have two internal config options that gets set from the CLI:

* Running; a web server is running
* Watching; either set via `hugo -w`  or `hugo server --watch=false`

Part of the change detection code wrongly used the `Running` as a flag when `Watching` would be the correct.

Fixes #12296
2024-04-25 14:35:49 +02:00
Bjørn Erik Pedersen
509ab08c1b markup/goldmark: Fix data race in the hugocontext wrapper
The window for this to happen is very small, but it has been reported by Go's race detector (-race flag) in a tests once.
2024-04-22 19:10:15 +02:00
Bjørn Erik Pedersen
15a4b9b337 tpl: Escape .Title in built-in image and link render hooks
Co-authored-by: Joe Mooring <joe@mooring.com>
2024-04-22 16:54:24 +02:00
Bjørn Erik Pedersen
06d248910c Only add root sections to the section pages menu
Fixes #12399
2024-04-20 17:23:33 +02:00
Bjørn Erik Pedersen
004b694390 Fix partial rebuilds for SCSS fetched with GetMatch and similar
Fixes #12395
2024-04-20 15:09:12 +02:00