Compare commits

...

792 commits

Author SHA1 Message Date
David Jones
dd6e2c8724
deploy: walkLocal worker pool for performance
Some checks are pending
Test / test (1.23.x, ubuntu-latest) (push) Waiting to run
Test / test (1.23.x, windows-latest) (push) Waiting to run
Test / test (1.24.x, ubuntu-latest) (push) Waiting to run
Test / test (1.24.x, windows-latest) (push) Waiting to run
2025-06-29 16:41:56 +02:00
hugoreleaser
762417617c releaser: Prepare repository for 0.148.0-DEV
[ci skip]
2025-06-23 08:38:21 +00:00
hugoreleaser
29bdbde19c releaser: Bump versions for release of 0.147.9
[ci skip]
2025-06-23 08:22:20 +00:00
Bjørn Erik Pedersen
6a4a3ab8f8 Remove WARN with false negatives
Fixes #13806
2025-06-22 16:55:43 +02:00
Bjørn Erik Pedersen
36f6f987a9 resources/page: Make sure a map is always initialized
Fixes #13810
2025-06-21 14:38:06 +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
dependabot[bot]
621ea42f3c build(deps): bump google.golang.org/api from 0.221.0 to 0.237.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.221.0 to 0.237.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.221.0...v0.237.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-version: 0.237.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-13 13:53:25 +02:00
Bjørn Erik Pedersen
4ef5720141
hugolib: Remove test for deprecated future 2025-06-13 12:17:06 +02:00
dependabot[bot]
34e83789f7 build(deps): bump github.com/aws/aws-sdk-go-v2 from 1.36.1 to 1.36.4
Bumps [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2) from 1.36.1 to 1.36.4.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.36.1...v1.36.4)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2
  dependency-version: 1.36.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-13 11:25:11 +02:00
dependabot[bot]
4d3ebe4d21 build(deps): bump golang.org/x/image from 0.27.0 to 0.28.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.27.0 to 0.28.0.
- [Commits](https://github.com/golang/image/compare/v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-version: 0.28.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-12 14:17:16 +02:00
Joe Mooring
b5c0383bda deps: Upgrade github.com/spf13/cast v1.8.0 => v1.9.2 2025-06-12 10:07:09 +02:00
Joe Mooring
4217fee4b0 common/terminal: Enable color output on windows
Closes #8209
2025-06-09 11:44:13 +02:00
hugoreleaser
fad57964aa releaser: Prepare repository for 0.148.0-DEV
[ci skip]
2025-06-07 13:13:56 +00:00
hugoreleaser
10da2bd765 releaser: Bump versions for release of 0.147.8
[ci skip]
2025-06-07 12:59:52 +00:00
Joe Mooring
01241d5dc9 hugolib: Emit ignorable warning when home page is a leaf bundle
Closes #13538
2025-06-07 13:02:28 +02:00
Bjørn Erik Pedersen
8e61f1fe12
dockerfile: Update Alpine
Closes #13783
2025-06-06 08:16:30 +02:00
Bjørn Erik Pedersen
f37412a575
dockerfile: Update Go version
FIxes #13780
2025-06-04 16:52:17 +02:00
dependabot[bot]
21a4a9acd7 build(deps): bump github.com/evanw/esbuild from 0.25.3 to 0.25.5
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.25.3 to 0.25.5.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.25.3...v0.25.5)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-version: 0.25.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-03 11:27:57 +02:00
dependabot[bot]
7a4a4790e5 build(deps): bump github.com/niklasfasching/go-org from 1.7.0 to 1.8.0
Bumps [github.com/niklasfasching/go-org](https://github.com/niklasfasching/go-org) from 1.7.0 to 1.8.0.
- [Commits](https://github.com/niklasfasching/go-org/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/niklasfasching/go-org
  dependency-version: 1.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-03 11:26:51 +02:00
dependabot[bot]
54065b7ef8 build(deps): bump golang.org/x/net from 0.39.0 to 0.40.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.39.0 to 0.40.0.
- [Commits](https://github.com/golang/net/compare/v0.39.0...v0.40.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.40.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-03 09:01:37 +02:00
dependabot[bot]
e333836f49 build(deps): bump github.com/yuin/goldmark from 1.7.11 to 1.7.12
Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.7.11 to 1.7.12.
- [Release notes](https://github.com/yuin/goldmark/releases)
- [Commits](https://github.com/yuin/goldmark/compare/v1.7.11...v1.7.12)

---
updated-dependencies:
- dependency-name: github.com/yuin/goldmark
  dependency-version: 1.7.12
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-02 18:18:44 +02:00
dependabot[bot]
cc7bfeea32 build(deps): bump github.com/tdewolff/minify/v2 from 2.23.5 to 2.23.8
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.23.5 to 2.23.8.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.23.5...v2.23.8)

---
updated-dependencies:
- dependency-name: github.com/tdewolff/minify/v2
  dependency-version: 2.23.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-06-02 18:18:24 +02:00
Bjørn Erik Pedersen
32eb1a8ad4 all: Replace _build with build in tests
_build is deprecated and now shows up as warning.
2025-06-02 16:35:37 +02:00
hugoreleaser
32af02cd3e releaser: Prepare repository for 0.148.0-DEV
[ci skip]
2025-05-31 12:55:24 +00:00
hugoreleaser
189453612e releaser: Bump versions for release of 0.147.7
[ci skip]
2025-05-31 12:41:12 +00: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
6334948515
Handle KaTeX warnings (#13760)
Co-authored-by: Joe Mooring <joe.mooring@veriphor.com>

Fixes #13735
2025-05-30 20:57:54 +02:00
dependabot[bot]
75259636c8 build(deps): bump golang.org/x/image from 0.26.0 to 0.27.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.26.0 to 0.27.0.
- [Commits](https://github.com/golang/image/compare/v0.26.0...v0.27.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-version: 0.27.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-30 15:13:21 +02:00
dependabot[bot]
0df9f3510f build(deps): bump golang.org/x/text from 0.24.0 to 0.25.0
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.24.0 to 0.25.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: golang.org/x/text
  dependency-version: 0.25.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-30 12:50:09 +02:00
dependabot[bot]
302e6a726b build(deps): bump github.com/spf13/cast from 1.7.1 to 1.8.0
Bumps [github.com/spf13/cast](https://github.com/spf13/cast) from 1.7.1 to 1.8.0.
- [Release notes](https://github.com/spf13/cast/releases)
- [Commits](https://github.com/spf13/cast/compare/v1.7.1...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/cast
  dependency-version: 1.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-30 08:34:09 +02:00
dependabot[bot]
202fe0d45c build(deps): bump github.com/alecthomas/chroma/v2 from 2.17.2 to 2.18.0
Bumps [github.com/alecthomas/chroma/v2](https://github.com/alecthomas/chroma) from 2.17.2 to 2.18.0.
- [Release notes](https://github.com/alecthomas/chroma/releases)
- [Changelog](https://github.com/alecthomas/chroma/blob/master/.goreleaser.yml)
- [Commits](https://github.com/alecthomas/chroma/compare/v2.17.2...v2.18.0)

---
updated-dependencies:
- dependency-name: github.com/alecthomas/chroma/v2
  dependency-version: 2.18.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-29 22:12:58 +02:00
Joe Mooring
843ffeb48d resources/page: Respect disablePathToLower for permalink tokens
Fixes #13755
2025-05-29 22:10:03 +02:00
Ruslan Semagin
bff5d19121 common/collections: Increase test coverage 2025-05-29 09:17:13 +02:00
Ruslan Semagin
da370d30de parser/pageparser: Add coverage for all IsX methods of Item
Added tests for all boolean methods on Item, increasing overall code coverage.
2025-05-28 21:53:17 +02:00
Bjørn Erik Pedersen
6bd328c584 resources: Remove unused interface 2025-05-28 19:32:28 +02:00
Bjørn Erik Pedersen
766a2e7868 Make sure that unreferenced but changed bundle resources gets republished
Fixes #13748
2025-05-28 19:32:28 +02:00
Bjørn Erik Pedersen
13e1617557 deps: Upgrade github.com/olekukonko/tablewriter v0.0.5 => v1.0.7 2025-05-28 18:07:14 +02:00
hugoreleaser
463e440c7a releaser: Prepare repository for 0.148.0-DEV
[ci skip]
2025-05-27 11:31:53 +00:00
hugoreleaser
0a5fd8ebb8 releaser: Bump versions for release of 0.147.6
[ci skip]
2025-05-27 11:17:16 +00:00
Andreas Deininger
e57dcd3795 Improve warning message on superfluous prefix when using function 'partials.Include' 2025-05-27 12:16:26 +02:00
Bjørn Erik Pedersen
eaf5ace30d Fix recent regression with cascading of params to content adapters
Fixes #13743
2025-05-26 21:26:19 +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
f47193669d commands: Make sure the browser gets refreshed on changes when --disableFastRender is set
Fixes #13727
2025-05-23 19:46:16 +02:00
Joe Mooring
013c8cfb25 tpl/transform: Expose the KaTeX strict option
Closes #13729
2025-05-23 19:21:38 +02:00
hugoreleaser
e25db38467 releaser: Prepare repository for 0.148.0-DEV
[ci skip]
2025-05-22 11:51:47 +00:00
hugoreleaser
7766fc6241 releaser: Bump versions for release of 0.147.5
[ci skip]
2025-05-22 11:37:19 +00:00
Bjørn Erik Pedersen
4a48facef4
Merge branch 'release-0.147.4' 2025-05-22 13:19:34 +02:00
Bjørn Erik Pedersen
0c7b1a3f26 Fix live reload when editing inline partials
Fixes #13723
2025-05-22 13:15:41 +02:00
dependabot[bot]
970b887ba1 build(deps): bump github.com/tdewolff/minify/v2 from 2.20.37 to 2.23.5
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.20.37 to 2.23.5.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.20.37...v2.23.5)

---
updated-dependencies:
- dependency-name: github.com/tdewolff/minify/v2
  dependency-version: 2.23.5
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-20 14:49:06 +02:00
hugoreleaser
b9b95e5aec releaser: Prepare repository for 0.148.0-DEV
[ci skip]
2025-05-20 10:55:43 +00:00
hugoreleaser
84c8426f32 releaser: Bump versions for release of 0.147.4
[ci skip]
2025-05-20 10:41:19 +00:00
Bjørn Erik Pedersen
a03a245f0c Fix it so css.TailwindCSS inlineImports options isn't always enabled
To avoid breaking existing setup and to make a better default option, the option is now `disableInlineImports` (default false).
Fixes #13719
2025-05-19 19:36:48 +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
hugoreleaser
e6574cf7a7 releaser: Prepare repository for 0.148.0-DEV
[ci skip]
2025-05-12 12:40:04 +00:00
hugoreleaser
05417512bd releaser: Bump versions for release of 0.147.3
[ci skip]
2025-05-12 12:25:03 +00: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
6def5a1ba9
Update README.md 2025-05-12 12:10:27 +02:00
Bjørn Erik Pedersen
bc98e7a80d config: Fix env override of slices
Fixes #13707
2025-05-11 19:24:24 +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
9d1d8c8899 commands: Fix description of new theme commands
Fixes #13701
2025-05-09 20:03:21 +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
Joe Mooring
325a0dba63 tpl/math: Add MaxInt64 function
Closes #13693
2025-05-07 19:40:29 +02:00
hugoreleaser
d70f828e2b releaser: Prepare repository for 0.148.0-DEV
[ci skip]
2025-05-06 11:33:36 +00:00
hugoreleaser
c7feb15d10 releaser: Bump versions for release of 0.147.2
[ci skip]
2025-05-06 11:18:55 +00:00
Bjørn Erik Pedersen
363ab48a24 Fix handling of "outputs" from content adapter pages
Fixes #13689
2025-05-06 11:40:46 +02: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
b39b249623 config: Add some more merge tests
See #13681
2025-05-02 11:15:38 +02:00
hugoreleaser
d799c045fd releaser: Prepare repository for 0.148.0-DEV
[ci skip]
2025-05-01 14:04:58 +00:00
hugoreleaser
95666fc5a4 releaser: Bump versions for release of 0.147.1
[ci skip]
2025-05-01 13:50:04 +00:00
dependabot[bot]
620fc87b56 build(deps): bump github.com/alecthomas/chroma/v2 from 2.17.0 to 2.17.2
Bumps [github.com/alecthomas/chroma/v2](https://github.com/alecthomas/chroma) from 2.17.0 to 2.17.2.
- [Release notes](https://github.com/alecthomas/chroma/releases)
- [Changelog](https://github.com/alecthomas/chroma/blob/master/.goreleaser.yml)
- [Commits](https://github.com/alecthomas/chroma/compare/v2.17.0...v2.17.2)

---
updated-dependencies:
- dependency-name: github.com/alecthomas/chroma/v2
  dependency-version: 2.17.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-01 15:44:26 +02:00
dependabot[bot]
8b2124e7c3 build(deps): bump github.com/getkin/kin-openapi from 0.131.0 to 0.132.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.131.0 to 0.132.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.131.0...v0.132.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-version: 0.132.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-05-01 13:19:22 +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
dependabot[bot]
927d1ec6c1 build(deps): bump github.com/yuin/goldmark from 1.7.10 to 1.7.11
Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.7.10 to 1.7.11.
- [Release notes](https://github.com/yuin/goldmark/releases)
- [Commits](https://github.com/yuin/goldmark/compare/v1.7.10...v1.7.11)

---
updated-dependencies:
- dependency-name: github.com/yuin/goldmark
  dependency-version: 1.7.11
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-30 22:09:10 +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
a1cb15e1cf Fix it so the owning taxonomy gets rerendered in server when new tags are added
Updates #13648
2025-04-28 21:42:16 +02:00
Joe Mooring
673a4d00eb commands/server: Display correct multihost language in console
Fixes #12564
2025-04-28 20:00:15 +02:00
Joe Mooring
31db7edf6d hugolib: Use new build key in content placeholder
Fixes #13655
2025-04-27 13:18:43 +02:00
hugoreleaser
5857b60cbc releaser: Prepare repository for 0.148.0-DEV
[ci skip]
2025-04-25 15:41:01 +00:00
hugoreleaser
7d0039b86d releaser: Bump versions for release of 0.147.0
[ci skip]
2025-04-25 15:26:28 +00: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
Joe Mooring
75b219db89 create/skeletons: Adjust template names in theme skeleton 2025-04-24 19:02:11 +02:00
Bjørn Erik Pedersen
ad4f63c92f tpl: Remove some unreached code branches 2025-04-24 14:27:59 +02:00
Bjørn Erik Pedersen
53202314ab images: Add some test cases for aligny on images.Text
See #13414
2025-04-24 14:09:13 +02:00
Pranshu Gaba
2fce0bac03 images: Add option for vertical alignment to images.Text
Add option ``aligny`` to specify the vertical alignment of the text
with respect to the ``y`` offset from the top of the image. Possible
values of ``aligny`` are ``top`` (default), ``center``, and ``bottom``.

The height of the block of text is measured from the top of the first
line to the baseline of the last line.

- ``top``: (Current behaviour) The top of the first line of the block of
  text is at an offset of ``y`` from the top of the image.

- ``center``: The vertical center of the block of text is at an offset of
  ``y`` from the top of the image.

- ``bottom``: The baseline of the last line of the text is at an offset
  of ``y`` from the top of the image.

Resolves #13414
2025-04-24 14:09:13 +02:00
Bjørn Erik Pedersen
179aea11ac config: Fix _merge issue when key doesn't exist on the left side
Fixes #13643
Fixes #13646
2025-04-24 13:56:27 +02:00
Bjørn Erik Pedersen
61a286595e
Merge commit 'b3d87dd0fd' 2025-04-24 10:23:16 +02:00
Bjørn Erik Pedersen
b3d87dd0fd Squashed 'docs/' changes from dc7a9ae12..b654fcba0
b654fcba0 content: Fix links
d44357418 content: Update GitLab Pages workflow example
33968c7e2 content: Update Netlify configuration file
a6d0c8c50 content: Update GitHub Pages workflow example
d1aabfa36 content: Fix broken link
7b50139a6 content: Miscellaneous edits
a30e2c189 Menus: add forgotten link target
5c2aa88b4 content: Updates for v0.146.7
114413c18 netlify: Hugo 0.146.7
67e9261b1 netlify: Hugo 0.146.6
efa040229 content: Update templates/embedded.md
b8f888c76 theme: Rename internal templates from partials/ to _partials/
727178cbb content: Fix broken anchor links
0f12708f1 Fix typo
380b1c163 Update Current.md
8b500f3e5 netlify: Hugo 0.146.5
e3d6b6fad netlify: Hugo 0.146.4
ac1b92713 content: Fix text formatting in templates/partial.md
719329530 content: Clarify usage of template function
a95eca524 theme: Misc adjustments for the themes site
8e6c26067 Add package.hugo.json
9691007fb netlify: Hugo 0.146.3
ec08acc59 netlify: Hugo 0.146.2
8f320a0b6 netlify: Hugo 0.146.1
d5e6cb618 content: Remove expired new-in badges
b5779d7fc content: Update templates.Current function
5df1229d5 theme: Move templates to new structure
a7a6a614d theme: Remove accidentally added template
195b368e8 content: Miscellaneous updates related to v0.146.0
0a906ad49 netlify: Hugo 0.146.0

git-subtree-dir: docs
git-subtree-split: b654fcba0d4385da1e47179ef3763f277f044242
2025-04-24 10:23:16 +02:00
Christian Oliff
6a0e04241a
all: Fix typos 2025-04-24 10:19:17 +02:00
dependabot[bot]
1bd7ac7ed9 build(deps): bump github.com/evanw/esbuild from 0.25.2 to 0.25.3
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.25.2 to 0.25.3.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.25.2...v0.25.3)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-version: 0.25.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-24 10:15:48 +02:00
dependabot[bot]
41cb880f9a build(deps): bump github.com/alecthomas/chroma/v2 from 2.16.0 to 2.17.0
Bumps [github.com/alecthomas/chroma/v2](https://github.com/alecthomas/chroma) from 2.16.0 to 2.17.0.
- [Release notes](https://github.com/alecthomas/chroma/releases)
- [Changelog](https://github.com/alecthomas/chroma/blob/master/.goreleaser.yml)
- [Commits](https://github.com/alecthomas/chroma/compare/v2.16.0...v2.17.0)

---
updated-dependencies:
- dependency-name: github.com/alecthomas/chroma/v2
  dependency-version: 2.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-24 10:11:50 +02:00
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
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
Joe Mooring
db72a1f075
parser/metadecoders: Add CSV targetType (map or slice) option to transform.Unmarshal
Closes #8859
2025-04-21 19:33:20 +02:00
dependabot[bot]
ad787614e8 build(deps): bump github.com/yuin/goldmark-emoji from 1.0.5 to 1.0.6
Bumps [github.com/yuin/goldmark-emoji](https://github.com/yuin/goldmark-emoji) from 1.0.5 to 1.0.6.
- [Release notes](https://github.com/yuin/goldmark-emoji/releases)
- [Commits](https://github.com/yuin/goldmark-emoji/compare/v1.0.5...v1.0.6)

---
updated-dependencies:
- dependency-name: github.com/yuin/goldmark-emoji
  dependency-version: 1.0.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 15:18:02 +02:00
dependabot[bot]
9c65b9e88d build(deps): bump github.com/bep/imagemeta from 0.11.0 to 0.12.0
Bumps [github.com/bep/imagemeta](https://github.com/bep/imagemeta) from 0.11.0 to 0.12.0.
- [Release notes](https://github.com/bep/imagemeta/releases)
- [Commits](https://github.com/bep/imagemeta/compare/v0.11.0...v0.12.0)

---
updated-dependencies:
- dependency-name: github.com/bep/imagemeta
  dependency-version: 0.12.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 15:17:49 +02:00
Bjørn Erik Pedersen
4eb0e4286a tpl/collections: Fix where ... not in with empty slice
Fixes #13621
2025-04-21 15:17:20 +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
dependabot[bot]
be3b147860 build(deps): bump github.com/yuin/goldmark from 1.7.9 to 1.7.10
Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.7.9 to 1.7.10.
- [Release notes](https://github.com/yuin/goldmark/releases)
- [Commits](https://github.com/yuin/goldmark/compare/v1.7.9...v1.7.10)

---
updated-dependencies:
- dependency-name: github.com/yuin/goldmark
  dependency-version: 1.7.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-21 11:56:44 +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
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
broughtupsy
a88b488181 Update watchtestscripts.sh 2025-04-16 08:28:19 +02: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
dependabot[bot]
64cf008880 build(deps): bump github.com/yuin/goldmark from 1.7.8 to 1.7.9
Bumps [github.com/yuin/goldmark](https://github.com/yuin/goldmark) from 1.7.8 to 1.7.9.
- [Release notes](https://github.com/yuin/goldmark/releases)
- [Commits](https://github.com/yuin/goldmark/compare/v1.7.8...v1.7.9)

---
updated-dependencies:
- dependency-name: github.com/yuin/goldmark
  dependency-version: 1.7.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-15 14:33:56 +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
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
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
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
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
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
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
c19f1f2363 tpl: Resolve layouts/all.html for all html output formats
Fixes #13587
2025-04-11 18:23:51 +02:00
Bjørn Erik Pedersen
9221cbca49 tpl: Fix some baseof lookup issues
We were mistakingly using the templates (e.g. list.html) descriptor to resolve the base template and not the page,
which worked fine in most cases, but not all.

Fixes #13583
2025-04-11 18:23:51 +02: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
Bjørn Erik Pedersen
3b9f2a7ded tpl: Skip dot and temp files inside /layouts
Fixes #13579
2025-04-10 18:41:01 +02: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
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
653f1c1d46
Merge commit '5be51ac3db' 2025-04-10 13:04:51 +02:00
Bjørn Erik Pedersen
5be51ac3db Squashed 'docs/' changes from d1a251933..dc7a9ae12
dc7a9ae12 content: Update JS options
07d3d8803 npm: Use tilde ranges for versions
e06362a13 Minor grammar fixes
c42db0838 content: Algolia DocSearch clarification
d67412b82 deps: Upgrade to TailwindCSS 4.1.0
da1fb12d3 theme: Update Lato font path for images.Text example
140fa3bb9 Update introduction.md
7b1fcca27 content: Fix links to embedded template source
908a55532 theme: Improve dark mode syntax highlighting background
d830e5962 Update XxHash.md
807be5dbf Update Defer.md
4b56693f6 content: Update GitHub Pages sample workflow
57b766fba Update TailwindCSS.md
64982ab6a Update TailwindCSS.md
1b6e879c6 Update TailwindCSS.md
e67cbcdd2 content: Add caching to the GitHub Pages workflow example
b7ca3b07c Update index.md
14e1a3977 Update XxHash.md
980f344ae Update XxHash.md
6b815f03e theme: Remove aria-label attribute from links
1c00bbc45 theme: Update npm dependencies
533149bf9 theme: Include section pages in related content
2b6bda6bd content: Fix typos
92ce95cbb content: Miscellaneous edits
f12936681 theme: Add a simple LRU cache for search
339ca3388 Fix the previous broken commit
8537e59e0 Make it into a non-link
e13f17d29 Add Algolia logo/link to the search listing dialog
d3e09e886 content: Fix typo
7217f64b6 content: Miscellaneous edits
51aa1ae73 content: Improve some examples
8ebaa53f9 theme: Adjust shortcodes
898870438 theme: Hide anchor until mouse-over
c933ea237 content: More front matter cleanup
f26ca047a content: Miscellaneous edits
e272b2039 theme: Fix inline partial refs
c540e6d29 content: Replace note shortcode calls with blockquote alerts
aef899bc5 theme: Add title and QR code when printing
bd46ef626 theme: Implement blockquote render hook
ddefbefaa content: Improve contributing page
f41d28ee1 content: Adjust usage of whitespace removal with action delimiters
03315336d theme: Use full title in related content sidebar
4f4076364 misc: Document the front matter fields used on this site
2f78d7632 misc: Fix gitignore file
7de6dbab3 content: Fix front matter for several function pages
5d3542ea6 config: Disable tags taxonomy
68bc28d67 content: Add linkTitle to shortcode pages
5f32c92ed theme: Restore deduplication logic for related items
a943a4bb8 theme: Implement related content tooling
fd628be6e content: Replace calls to the code shortcode with fenced code blocks
b23c9a583 content: Fix position of new-in badges
ec056f251 content: Fix typo
245351c84 theme: Adjust spacing in highlighting theme examples
2fcd21ee5 content: Remove "related" array from function and method pages
71d8426ee theme: Create code block render hook
4cdde6649 theme: Adjust number of news items to display
34ab45261 content: Miscellaneous edits
b6cae5cbc content: Consolidate configuration documentation
727ef6f66 theme: Fix overflow issue for wide tables
c4f759e01 Add es2024
93cce62c8 Update support list of more recent targets with js.Build / esbuild
974d0655f Update hosting-on-codeberg.md
b3f0ed9ce content: Add hosting instructions for Codeberg Pages
8217c0900 content: Correct the SourceHut repository URL
a8cf3d28f content: Add hosting instructions for SourceHut Pages
8c059cbe1 theme: Use content adapter for news section
03938c600 Remove some old new-in
5c50a75e8 content: Fix typo
5cf89f2f6 theme: Re-enable banner gtag outbound link tracking
3c555d5f8 One more copy button
94bce999a Add some copy buttons
9e1cc0c2b Update PortableText.md
dd26ac49f Document transform.PortableText
5f632ab32 netlify: Hugo 0.145.0
59e057bb4 Update index.md
d07e07d6c Remove some unused home page front matter
d482657b7 Add footnote about alias to the build front matter key
f0629b77c content: Fix typo
d91c4cccf theme: Fix news items URLs
ca931cd1f theme: Restore RSS feed for news section
e6b870bc9 theme: Adjust copy-to-clipboard button
071851431 Update netlify.toml
e68431034 theme: Format layouts
aa3cd839a theme: Format assets
22ad3eee3 theme: Add some more space on the right for copy buttons
f4a19083a netlify: Hugo 0.144.1
974cb8795 theme: Remove Internet Explorer configs (#2929)
4a23a1f41 content: Fix typos
d49f15d03 theme: Get the scrollspy back working
720c7ff67 config: Evict getresource cache hourly
1f62ca97e theme: Hide the Turbo progress bar
f6449ace3 Move the dark class up to the html element
074cd1a07 content: Miscellaneous edits
e098a7716 content: Miscellaneous edits
8e1e104aa content: Updates for v0.144.0
18e1aa916 theme: Add anchor links via JS
ac3b5505c Close new-in
bfa4db6b8 netlify: Hugo 0.144.0
fd6e7feee Regen CLI docs
da9d1218a Regen docs helper
5de494ded Merge branch 'tempv0.144.0'
f683e6469 theme: Minor improvements to base template
ef8bf89d8 resources/page: Revise the new contentbasename permalinks tokens
901adb07b resources/page: Add :contentbasename and :contentbasenameorslug permalink tokens
0fca8ef25 all: Change shortcode usage and design to prevent invalid HTML
c41d76613 Update RegularPagesRecursive.md
e93574748 content: Correct return type for strings.Split
3d504abba Revert "content: Add ids to the Netlify steps"
c08c8e15e content: Add ids to the Netlify steps
5a3b470a2 theme: "move" the id from content to article
b878613aa theme: Add page kind as a CSS class to body
269657e8f content: Fix formatting error
664f6c92f config: Change image cache location
fa6b719b1 theme: Reduce ToC to level 2-4
bc16341ca theme: Render mathematical markup with transform.ToMath
14bf9dc70 theme: Add aria-label attribute to search fields
ed42af5b3 theme: Adjust search field and search activation
f042e4970 dev: Add prettier-plugin-void-html
f6ec83533 content: Fix inline shortcode example
0a74210e2 theme: Remove readfile shortcode
334ca06ac theme: Fix some dark mode accessibility as reported by Axe core
02626ff92 theme: aria-lbabel => aria-label
227b76ab7 Add Prettier and config
43ab22428 content: Bump minimum required Go version to 1.23.0
03e54683f modules: Add GOAUTH to module config
9f06a3b9c js/esbuild: Add drop option
ddcd99369 Merge commit 'a024bc7d76'
733731253 helpers: Add Chroma styles to docs.yaml

git-subtree-dir: docs
git-subtree-split: dc7a9ae127717cde17840496cb0287f481c5f0ee
2025-04-10 13:02:49 +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
dependabot[bot]
18d2d2f985 build(deps): bump github.com/fsnotify/fsnotify from 1.8.0 to 1.9.0
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.8.0 to 1.9.0.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.8.0...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-version: 1.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-10 10:51:46 +02:00
dependabot[bot]
cd3e3499bd build(deps): bump golang.org/x/tools from 0.31.0 to 0.32.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.31.0 to 0.32.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.31.0...v0.32.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-version: 0.32.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-10 10:51:20 +02:00
dependabot[bot]
8cd799aac9 build(deps): bump github.com/evanw/esbuild from 0.25.1 to 0.25.2
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.25.1 to 0.25.2.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.25.1...v0.25.2)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-version: 0.25.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-10 10:51:07 +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
dependabot[bot]
af0602c343 build(deps): bump golang.org/x/image from 0.25.0 to 0.26.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.25.0 to 0.26.0.
- [Commits](https://github.com/golang/image/compare/v0.25.0...v0.26.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-version: 0.26.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-09 13:07:03 +02:00
dependabot[bot]
650fe6cd01 build(deps): bump github.com/pelletier/go-toml/v2 from 2.2.3 to 2.2.4
Bumps [github.com/pelletier/go-toml/v2](https://github.com/pelletier/go-toml) from 2.2.3 to 2.2.4.
- [Release notes](https://github.com/pelletier/go-toml/releases)
- [Changelog](https://github.com/pelletier/go-toml/blob/v2/.goreleaser.yaml)
- [Commits](https://github.com/pelletier/go-toml/compare/v2.2.3...v2.2.4)

---
updated-dependencies:
- dependency-name: github.com/pelletier/go-toml/v2
  dependency-version: 2.2.4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-09 13:06:38 +02:00
dependabot[bot]
d63491beb2 build(deps): bump github.com/alecthomas/chroma/v2 from 2.15.0 to 2.16.0
Bumps [github.com/alecthomas/chroma/v2](https://github.com/alecthomas/chroma) from 2.15.0 to 2.16.0.
- [Release notes](https://github.com/alecthomas/chroma/releases)
- [Changelog](https://github.com/alecthomas/chroma/blob/master/.goreleaser.yml)
- [Commits](https://github.com/alecthomas/chroma/compare/v2.15.0...v2.16.0)

---
updated-dependencies:
- dependency-name: github.com/alecthomas/chroma/v2
  dependency-version: 2.16.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-09 13:05:13 +02:00
Joe Mooring
24ac6a9de9 commands/new: Improve theme creation
- Update the skeleton structure to match the new template system.
- Add a --format flag to the `hugo new theme` command to control the
  format of the site configuration and default archetype files.
- Remove theme.toml. This file's presence can be confusing for new
  users, and the README in the themes repository already has an example.
- Remove the LICENSE and README files from the skeleton. These files
  are not needed for a theme to work, and they can be added later by
  the user if desired.

Closes #13489
Closes #13544
2025-04-08 16:35:46 +02:00
dependabot[bot]
e6e18e9122 build(deps): bump golang.org/x/net from 0.37.0 to 0.39.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.37.0 to 0.39.0.
- [Commits](https://github.com/golang/net/compare/v0.37.0...v0.39.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-version: 0.39.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-08 12:14:30 +02:00
dependabot[bot]
43af3bc07d build(deps): bump github.com/bep/imagemeta from 0.10.0 to 0.11.0
Bumps [github.com/bep/imagemeta](https://github.com/bep/imagemeta) from 0.10.0 to 0.11.0.
- [Release notes](https://github.com/bep/imagemeta/releases)
- [Commits](https://github.com/bep/imagemeta/compare/v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: github.com/bep/imagemeta
  dependency-version: 0.11.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-04-08 12:02:20 +02:00
Joe Mooring
10b55439a8 deps: Upgrade github.com/gohugoio/hugo-goldmark-extensions/passthrough v0.3.0 => v0.3.1 2025-04-07 21:33:06 +02:00
Joe Mooring
1e00842489 tpl/tplimpl: Update embedded pagination template 2025-04-07 21:29:53 +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
Joe Mooring
07cbe5701e tpl/time: Add time.In function
Closes #13548
2025-04-03 09:45:51 +02:00
Joe Mooring
c15ebce2fd resources: Add option to silence dependency deprecation warnings
Closes #13530
2025-03-29 19:04:53 +01:00
Joe Mooring
6f14dbe24c tpl/tplimpl: Fix full screen option in vimeo and youtube shortcodes
Closes #13531

Co-authored-by: Stefan Ritter <60473875+gideonstar-git@users.noreply.github.com>
2025-03-27 12:32:00 +01: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
dependabot[bot]
26d986fc0d build(deps): bump golang.org/x/tools from 0.30.0 to 0.31.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.30.0 to 0.31.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-25 12:02:15 +01:00
dependabot[bot]
ebc0693659 build(deps): bump github.com/getkin/kin-openapi from 0.129.0 to 0.131.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.129.0 to 0.131.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.129.0...v0.131.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-25 12:02:03 +01:00
dependabot[bot]
7ca6bb06b6 build(deps): bump github.com/spf13/afero from 1.11.0 to 1.14.0
Bumps [github.com/spf13/afero](https://github.com/spf13/afero) from 1.11.0 to 1.14.0.
- [Release notes](https://github.com/spf13/afero/releases)
- [Commits](https://github.com/spf13/afero/compare/v1.11.0...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/spf13/afero
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-25 12:00:07 +01:00
dependabot[bot]
bddd2f9001 build(deps): bump github.com/bep/imagemeta from 0.9.0 to 0.10.0
Bumps [github.com/bep/imagemeta](https://github.com/bep/imagemeta) from 0.9.0 to 0.10.0.
- [Release notes](https://github.com/bep/imagemeta/releases)
- [Commits](https://github.com/bep/imagemeta/compare/v0.9.0...v0.10.0)

---
updated-dependencies:
- dependency-name: github.com/bep/imagemeta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 10:45:08 +01:00
dependabot[bot]
1c691358f7 build(deps): bump github.com/golang-jwt/jwt/v5 from 5.2.1 to 5.2.2
Bumps [github.com/golang-jwt/jwt/v5](https://github.com/golang-jwt/jwt) from 5.2.1 to 5.2.2.
- [Release notes](https://github.com/golang-jwt/jwt/releases)
- [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md)
- [Commits](https://github.com/golang-jwt/jwt/compare/v5.2.1...v5.2.2)

---
updated-dependencies:
- dependency-name: github.com/golang-jwt/jwt/v5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 10:44:37 +01:00
dependabot[bot]
17db4edb02 build(deps): bump github.com/evanw/esbuild from 0.24.2 to 0.25.1
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.24.2 to 0.25.1.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG-2024.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.24.2...v0.25.1)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 10:44:16 +01:00
dependabot[bot]
3968f9158e build(deps): bump github.com/bep/godartsass/v2 from 2.4.0 to 2.4.1
Bumps [github.com/bep/godartsass/v2](https://github.com/bep/godartsass) from 2.4.0 to 2.4.1.
- [Release notes](https://github.com/bep/godartsass/releases)
- [Commits](https://github.com/bep/godartsass/compare/v2.4.0...v2.4.1)

---
updated-dependencies:
- dependency-name: github.com/bep/godartsass/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-24 10:43:58 +01:00
dependabot[bot]
e9bd2373a0 build(deps): bump golang.org/x/net from 0.35.0 to 0.37.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.35.0 to 0.37.0.
- [Commits](https://github.com/golang/net/compare/v0.35.0...v0.37.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-23 21:01:52 +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
Ville Vesilehto
f34cdc382a
parser/metadecoder: Improve errors for non-map XML root values
Previously, the XML decoder would panic when encountering a root element with
a non-map value due to an unsafe type assertion.

The fix adds proper type checking before the map conversion and provides
clear error messages to help users identify and fix invalid XML structures.

Example error for invalid XML like:
<root>just text</root>

Will now return:
"XML root element 'root' must be a map/object, got string"
2025-03-22 18:48:23 +01:00
Bjørn Erik Pedersen
52561d561a identity: Use clear to clear the finder seen map
Faster:

```
Finder/Find_one-10    172.8n ± 26%   129.3n ± 2%  -25.18% (p=0.002 n=6)
Finder/Find_none-10   174.0n ±  1%   130.6n ± 0%  -24.94% (p=0.002 n=6)
```
2025-03-15 19:05:45 +01:00
dependabot[bot]
f4f21f5ea3 build(deps): bump github.com/bep/godartsass/v2 from 2.3.2 to 2.4.0
Bumps [github.com/bep/godartsass/v2](https://github.com/bep/godartsass) from 2.3.2 to 2.4.0.
- [Release notes](https://github.com/bep/godartsass/releases)
- [Commits](https://github.com/bep/godartsass/compare/v2.3.2...v2.4.0)

---
updated-dependencies:
- dependency-name: github.com/bep/godartsass/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-15 18:37:33 +01:00
Joe Mooring
a98ec3bd01 commands/gen: Set url in command pages to /docs/reference/commands/ 2025-03-14 21:11:46 +01:00
khayyam
d28c84a871
cache: Apply httpcache defaults for polling config
Previously, compiling the config with partial or missing poll configs
would introduce a panic. This ensures that the default poll configs
are applied in such scenarios to ensure config is valid.

Fixes #13471
2025-03-14 14:37:26 +01:00
dependabot[bot]
61c39ae63b build(deps): bump golang.org/x/image from 0.24.0 to 0.25.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.24.0 to 0.25.0.
- [Commits](https://github.com/golang/image/compare/v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-13 16:17:49 +01:00
Bjørn Erik Pedersen
2037137fbf deps: Upgrade golang.org/x/mod v0.23.0 => v0.24.0
Closes #13484
2025-03-12 16:24:48 +01:00
dependabot[bot]
d78d4cf161 build(deps): bump github.com/bep/overlayfs from 0.9.2 to 0.10.0
Bumps [github.com/bep/overlayfs](https://github.com/bep/overlayfs) from 0.9.2 to 0.10.0.
- [Release notes](https://github.com/bep/overlayfs/releases)
- [Commits](https://github.com/bep/overlayfs/compare/v0.9.2...v0.10.0)

---
updated-dependencies:
- dependency-name: github.com/bep/overlayfs
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-11 21:03:49 +01:00
dependabot[bot]
f9aae1581b build(deps): bump github.com/bep/lazycache from 0.7.0 to 0.8.0
Bumps [github.com/bep/lazycache](https://github.com/bep/lazycache) from 0.7.0 to 0.8.0.
- [Release notes](https://github.com/bep/lazycache/releases)
- [Commits](https://github.com/bep/lazycache/compare/v0.7.0...v0.8.0)

---
updated-dependencies:
- dependency-name: github.com/bep/lazycache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-11 21:03:27 +01:00
Joe Mooring
b9add1c702 tpl/tplimpl: Add loading attribute to Vimeo shortcode
Closes #13445
2025-03-11 21:02:12 +01:00
dependabot[bot]
b0686712ba build(deps): bump github.com/bep/imagemeta from 0.8.4 to 0.9.0
Bumps [github.com/bep/imagemeta](https://github.com/bep/imagemeta) from 0.8.4 to 0.9.0.
- [Release notes](https://github.com/bep/imagemeta/releases)
- [Commits](https://github.com/bep/imagemeta/compare/v0.8.4...v0.9.0)

---
updated-dependencies:
- dependency-name: github.com/bep/imagemeta
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-11 16:51:32 +01:00
dependabot[bot]
93d9c0533a build(deps): bump github.com/bep/simplecobra from 0.5.0 to 0.6.0
Bumps [github.com/bep/simplecobra](https://github.com/bep/simplecobra) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/bep/simplecobra/releases)
- [Commits](https://github.com/bep/simplecobra/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: github.com/bep/simplecobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-11 16:51:19 +01:00
Joe Mooring
93df17661f commands: Add --omitEmpty flag to gen chromastyles
Closes #13475
2025-03-11 16:50:59 +01:00
Will Faught
eebea9ec41 tpl: Add trailing newline to robots.txt template 2025-03-05 15:02:50 +01:00
Bjørn Erik Pedersen
3f2e1c08e3 commands: Skip flaky test on Windows
Closes #13465
2025-03-03 12:50:33 +01:00
Hannes Braun
3a11d22da3
resources/image: Mark loong64 as FMA-using architecture 2025-02-26 21:17:06 +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
margau
e5eecbd9bc
github: Build docker image with both extended and withdeploy tags 2025-02-26 16:33:22 +01:00
coliff
4094a1e12c all: Typo fixes 2025-02-26 15:10:28 +01:00
Bjørn Erik Pedersen
6927e6f048 deps: Upgrade github.com/rogpeppe/go-internal v1.13.1 => v1.14.1
Closes #13449
2025-02-26 14:43:03 +01: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
dependabot[bot]
b7ae24b9c2 build(deps): bump github.com/yuin/goldmark-emoji from 1.0.4 to 1.0.5
Bumps [github.com/yuin/goldmark-emoji](https://github.com/yuin/goldmark-emoji) from 1.0.4 to 1.0.5.
- [Release notes](https://github.com/yuin/goldmark-emoji/releases)
- [Commits](https://github.com/yuin/goldmark-emoji/compare/v1.0.4...v1.0.5)

---
updated-dependencies:
- dependency-name: github.com/yuin/goldmark-emoji
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-26 10:56:23 +01:00
Christian Oliff
2f4e666d7e
tpl: HTTPS the instagram Shortcode JS
This JavaScript will always load over HTTPS so it's best to specify that. Protocol-less loaded resources are an anti-pattern (REF: https://www.paulirish.com/2010/the-protocol-relative-url/)
2025-02-26 09:27:31 +01:00
dependabot[bot]
1a4851f138 build(deps): bump github.com/google/go-cmp from 0.6.0 to 0.7.0
Bumps [github.com/google/go-cmp](https://github.com/google/go-cmp) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/google/go-cmp/releases)
- [Commits](https://github.com/google/go-cmp/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: github.com/google/go-cmp
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-25 19:41:18 +01:00
dependabot[bot]
d1f23309bf build(deps): bump github.com/tetratelabs/wazero from 1.8.2 to 1.9.0
Bumps [github.com/tetratelabs/wazero](https://github.com/tetratelabs/wazero) from 1.8.2 to 1.9.0.
- [Release notes](https://github.com/tetratelabs/wazero/releases)
- [Commits](https://github.com/tetratelabs/wazero/compare/v1.8.2...v1.9.0)

---
updated-dependencies:
- dependency-name: github.com/tetratelabs/wazero
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-25 19:40:01 +01:00
Bjørn Erik Pedersen
04f21b4d80 Add transform.PortableText
Using this in a content adapter could look like this:

```handlebars
{{ $projectID := "<myproject>" }}
{{ $useCached := true }}
{{ $api := "api" }}
{{ if $useCached }}
  {{/* See https://www.sanity.io/docs/api-cdn */}}
  {{ $api = "apicdn" }}
{{ end }}
{{ $url := printf "https://%s.%s.sanity.io/v2021-06-07/data/query/production"  $projectID $api }}

{{/* prettier-ignore-start */ -}}
{{ $q :=  `*[_type == 'post']{
  title, publishedAt, summary, slug, body[]{
    ...,
    _type == "image" => {
      ...,
      asset->{
        _id,
        path,
        url,
        altText,
        title,
        description,
        metadata {
          dimensions {
            aspectRatio,
            width,
            height
          }
        }
      }
    }
  },
  }`
}}
{{/* prettier-ignore-end */ -}}
{{ $body := dict "query" $q | jsonify }}
{{ $opts := dict "method" "post" "body" $body }}
{{ $t := debug.Timer "sanity.get" }}
{{ $r := resources.GetRemote $url $opts }}
{{ $t.Stop }}
{{ $m := $r | transform.Unmarshal }}
{{ $result := $m.result }}
{{ $t := debug.Timer "sanity.parse" }}
{{ range $result }}
  {{ if not .slug }}
    {{ continue }}
  {{ end }}
  {{ $markdown := transform.PortableText .body }}
  {{ $t.Stop }}
  {{ $content := dict
    "mediaType" "text/markdown"
    "value" $markdown
  }}
  {{ $params := dict
    "portabletext" (.body | jsonify (dict "indent" " "))
  }}
  {{ $page := dict
    "content" $content
    "kind" "page"
    "path" .slug.current
    "title" .title
    "date" (.publishedAt | time )
    "summary" .summary
    "params" $params
  }}
  {{ $.AddPage $page }}
{{ end }}
```
2025-02-25 19:35:47 +01:00
Martey Dodoo
ab9e545760 readme: Fix relative links in Editions section
Make relative gohugo.io links used in Editions section of README
absolute so that they resolve successfully.
2025-02-25 18:26:05 +01:00
Bjørn Erik Pedersen
381c0da85d Fix some related content issues with content adapters
Fixes #13443
2025-02-25 14:14:56 +01:00
Bjørn Erik Pedersen
227e429267 Fix potential nilpointer in httpcache config 2025-02-24 18:42:50 +01:00
Joe Mooring
d0ce942190 hugolib: Deprecate _build front matter key in favor of build
We effectively aliased "_build" to "build" in v0.123.0, and
removed "_build" from the documentation at the same time.
2025-02-24 10:13:53 +01:00
Joe Mooring
4fd7f3233f
snap: Update Node.js to 22.x 2025-02-22 07:49:02 -08:00
Bjørn Erik Pedersen
c3d435acfa Fix --printPathWarnings when site calls templates.Defer
This issue was introduced recently in eb7a5aabaa.

Fixes #13420
2025-02-19 12:59:40 +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
Bjørn Erik Pedersen
494e88abf6 markup/goldmark: Fix panic on empty Markdown header
Fixes #13416
2025-02-18 11:12:39 +01: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
85c1727748
markup/goldmark: Fix panic on stray attribute nodes 2025-02-17 17:19:53 +01:00
Bjørn Erik Pedersen
641403f7de Fix Position for passthrough hooks
Fixes #13406
2025-02-17 12:23:49 +01:00
Bjørn Erik Pedersen
24cc25552f Fix auto generated header ids so they don't contain e.g. hyperlink destinations (note)
This makes the header ids match the newly added dt ids.

Also make sure newlines are preserved in hooks' `.PlainText`.

Fixes #13405
Fixes #13410
2025-02-17 12:23:49 +01:00
dependabot[bot]
a2ca95629a build(deps): bump github.com/spf13/cobra from 1.8.1 to 1.9.1
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.8.1 to 1.9.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.8.1...v1.9.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-17 12:08:14 +01:00
dependabot[bot]
367fe526e2 build(deps): bump github.com/sanity-io/litter from 1.5.7 to 1.5.8
Bumps [github.com/sanity-io/litter](https://github.com/sanity-io/litter) from 1.5.7 to 1.5.8.
- [Changelog](https://github.com/sanity-io/litter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sanity-io/litter/compare/v1.5.7...v1.5.8)

---
updated-dependencies:
- dependency-name: github.com/sanity-io/litter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-17 12:06:55 +01:00
Joe Mooring
5de3913ed4 config/allconfig: Deprecate :filename and :slugorfilename tokens 2025-02-17 12:06:32 +01:00
Bjørn Erik Pedersen
7b7a0f3624 resources/page: Revise the new contentbasename permalinks tokens
* Make it work for all pages, including those created from content adapters and not backed by a file.
* Allow the `slug` to win, so the new tokens are:

`:contentbasename`:

1. ContentBaseName

`:slugorcontentbasename`:

1. Slug
2. ContentBaseName

Note that a page will always have a `ContentBaseName`, so no need to fall back to e.g. the title.

Closes #11722
2025-02-17 09:41:49 +01:00
Henrique Dias
cb7a4339b7 resources/page: Add :contentbasename and :contentbasenameorslug permalink tokens
See #11722
2025-02-17 09:41:49 +01:00
Bjørn Erik Pedersen
157d3703c3 Add autoID for definition terms
Fixes #13403
See #11566

Co-authored-by: Joe Mooring <joe@mooring.com>
2025-02-16 20:55:27 +01:00
dependabot[bot]
9c2f8ec61b build(deps): bump github.com/sanity-io/litter from 1.5.5 to 1.5.7
Bumps [github.com/sanity-io/litter](https://github.com/sanity-io/litter) from 1.5.5 to 1.5.7.
- [Changelog](https://github.com/sanity-io/litter/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sanity-io/litter/compare/v1.5.5...v1.5.7)

---
updated-dependencies:
- dependency-name: github.com/sanity-io/litter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-14 14:25:11 +01:00
dependabot[bot]
bd77944ba2 build(deps): bump github.com/gohugoio/hugo-goldmark-extensions/extras
Bumps [github.com/gohugoio/hugo-goldmark-extensions/extras](https://github.com/gohugoio/hugo-goldmark-extensions) from 0.2.0 to 0.3.0.
- [Release notes](https://github.com/gohugoio/hugo-goldmark-extensions/releases)
- [Commits](https://github.com/gohugoio/hugo-goldmark-extensions/compare/extras/v0.2.0...extras/v0.3.0)

---
updated-dependencies:
- dependency-name: github.com/gohugoio/hugo-goldmark-extensions/extras
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-14 14:24:04 +01:00
Peter Weston
c1f4228d61
config: Fix server.redirects.fromRe being ignored unless server.redirects.from is also set 2025-02-14 10:21:19 +01:00
Joe Mooring
503dcf6252 internal/warpc: Enable KaTeX mhchem extension 2025-02-14 10:04:15 +01:00
Joe Mooring
5dd0ba00f7 Update README.md
- Include section about editions
- Bump minimum required Go version for building from source
- Include instructions for building the extended/deploy edition
- Update dependency list
2025-02-13 17:17:59 +01:00
dependabot[bot]
2e835d0841 build(deps): bump golang.org/x/tools from 0.29.0 to 0.30.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.29.0 to 0.30.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.29.0...v0.30.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-13 15:01:51 +01:00
Bjørn Erik Pedersen
2c77719cd6 modules: Add GOAUTH to module config
Closes #13385
2025-02-13 15:01:28 +01:00
dependabot[bot]
d89b9d891c build(deps): bump github.com/aws/aws-sdk-go-v2/service/cloudfront
Bumps [github.com/aws/aws-sdk-go-v2/service/cloudfront](https://github.com/aws/aws-sdk-go-v2) from 1.44.9 to 1.44.10.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/macie2/v1.44.9...service/s3control/v1.44.10)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/service/cloudfront
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-13 13:48:54 +01:00
dependabot[bot]
8721a35202 build(deps): bump google.golang.org/api from 0.206.0 to 0.221.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.206.0 to 0.221.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.206.0...v0.221.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-13 13:47:55 +01:00
Bjørn Erik Pedersen
fd38aee694 Support menus as maps in content adapters
Fixes #13384
2025-02-13 13:29:24 +01:00
Bjørn Erik Pedersen
d25f7ec172 js/esbuild: Add drop option
Fixes #13362
2025-02-13 13:26:46 +01:00
Bjørn Erik Pedersen
a024bc7d76 Squashed 'docs/' changes from 73a01565c..d1a251933
d1a251933 theme: Optimize for printing
d906488d5 theme: Add border to highlighted code blocks within list items
9630c38cb theme: Display short command on commands list
7f81dd997 content: Regen commands markup
a84008e99 content: Cleanup primary list page
0874b03e9 content: Publish QR code examples to the images/qr directory
ef1ce3498 Restore static/img
489a68458 content: Restore KeyCDN screen captures
7d6e6184b theme: Move search button in navbar to the right on smaller screens
b03b96082 theme: Misc style adjustments
ecad97821 theme: Misc fixes
cf5e07b0f content: Restore example data and images
c7265041f content: Reformat css.TailwindCSS setup steps
3226e668f theme: Make the search button more compact on mobile
1f6614ee8 content: Update css.TailwindCSS example
49a2e7d71 theme: Improve search output
7e6b81ffa misc: Create issue template
826740223 theme: Misc search improvements
75f32b2f6 theme:  Remove the search alert
fd3de4ac2 config: Enable link render hook warnings
769e387cd Adjust logic to mark current section for Algolia
ba73ce646 Adjust markup to make it easier to match in Algolia
5accec5f1 Misc adjustments
eb5842566 Some content adjustments
bdf97b7b4 Add new theme
b19d68ee5 Remove old theme
a04e96e55 Rewrite the css.TailwindCSS page
1c46f1864 Update deprecation notes
aedcb444c Fix typo
c3290b876 Changes related to release of v0.144.0
a0012fcce netlify: Hugo 0.143.1
9e4d73e87 Include sections in quick-reference page collection
4591058f5 Miscellaneous edits
612b8528f glossary: More edits
1f0c54e60 Fit typo
6f14084c1 Move glossary to quick reference section
2d94905be Improve branch bundle admonition
2ea56bef3 Fix typos found with codespell
71c5fe951 Close shortcode
e95d06592 Document the responseHeaders option for resources.GetRemote
da7c12aaa Deprecate gist shortcode
c2d3e2c25 netlify: Bump to 0.143.0
367d3a7ab Improve new-in shortcode
1a7413a16 Clean up shortcode documentation
d847892aa Improve glossary
6a7fd42ff Update pages describing Store methods and functions
fa7643d1b Revert "Improve link render hook performance"
fe4c86ec4 Reformat MathJax example
cea44922a Update MathJax example to use safe mode
0b6d0292c Update KaTeX example to use latest version
fd4508645 Improve link render hook performance
23aeb5bd0 Update purgecss example
f7ef83e56 Refer each Hugo Pipe page to the corresponding function
81b91ef4e Remove related pages from pages for deprecated functions and methods
53c7627d5 Remove body from deprecated functions and methods
d9cf034c8 Consolidate css.ToCSS information
b7ed108f9 Improve js.Build example and presentation of options
86a4a5088 Improve babel example and description of options
d1874c5f5 Consistently use "edition" when referring to standard, extended, etc.
92f03a350 Revise description of privacy settings
152a92d80 Update Last.md
82a2365bd Add print-only QR code example
d22cadc25 Update mathematics.md
b8160af03 Delete page self-reference in page/type.md
ce24fe4e0 Update param.md
51cb92180 Improve description of output format template selection
78bcf358e Update Tailwind CSS npm package version to 4.0
2ca9da4af Include winget command to uninstall

git-subtree-dir: docs
git-subtree-split: d1a2519330f3647447053c89c49d6098af29519f
2025-02-13 10:40:34 +01:00
Bjørn Erik Pedersen
304a7e5e74
Merge commit 'a024bc7d76' 2025-02-13 10:40:34 +01:00
dependabot[bot]
c054e18827 build(deps): bump github.com/bep/imagemeta from 0.8.3 to 0.8.4
Bumps [github.com/bep/imagemeta](https://github.com/bep/imagemeta) from 0.8.3 to 0.8.4.
- [Release notes](https://github.com/bep/imagemeta/releases)
- [Commits](https://github.com/bep/imagemeta/compare/v0.8.3...v0.8.4)

---
updated-dependencies:
- dependency-name: github.com/bep/imagemeta
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-13 09:02:59 +01:00
Joe Mooring
34dcac53bf config: Remove unused code 2025-02-13 08:40:49 +01:00
Joe Mooring
ee438606dd commands: Use punctuation consistently in short description 2025-02-13 08:40:26 +01:00
Bjørn Erik Pedersen
fd8b0fbf8a Upgrade to Go 1.24
Fixes #13381
2025-02-12 22:01:25 +01: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
e6feb9e0be commands: Move the CHMOD event filter up
To prevent ghost rebuilds (from VSCode and possibly others).

Fixes #13373
2025-02-10 17:02:06 +01:00
dependabot[bot]
5e4ffa0e89 build(deps): bump golang.org/x/image from 0.22.0 to 0.24.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.22.0 to 0.24.0.
- [Commits](https://github.com/golang/image/compare/v0.22.0...v0.24.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 12:46:06 +01:00
dependabot[bot]
0cdcc2b584 build(deps): bump golang.org/x/mod from 0.22.0 to 0.23.0
Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.22.0 to 0.23.0.
- [Commits](https://github.com/golang/mod/compare/v0.22.0...v0.23.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 11:43:49 +01:00
dependabot[bot]
a591c4406a build(deps): bump github.com/gohugoio/hashstructure from 0.3.0 to 0.5.0
Bumps [github.com/gohugoio/hashstructure](https://github.com/gohugoio/hashstructure) from 0.3.0 to 0.5.0.
- [Release notes](https://github.com/gohugoio/hashstructure/releases)
- [Commits](https://github.com/gohugoio/hashstructure/compare/v0.3.0...v0.5.0)

---
updated-dependencies:
- dependency-name: github.com/gohugoio/hashstructure
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-10 11:43:11 +01:00
dependabot[bot]
2d86a0512c build(deps): bump github.com/bep/simplecobra from 0.4.0 to 0.5.0
Bumps [github.com/bep/simplecobra](https://github.com/bep/simplecobra) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/bep/simplecobra/releases)
- [Commits](https://github.com/bep/simplecobra/compare/v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: github.com/bep/simplecobra
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-09 23:31:45 +01:00
Dominik Süß
f02da7fbce
parser: Handle org-mode filetags as slice
This adds support for filetags by slicing them according to [the org mode tag
specification](https://orgmode.org/guide/Tags.html).

Can be used to create taxonomies based on org-mode tags
2025-02-09 22:40:28 +01:00
dependabot[bot]
22ee0918f3 build(deps): bump github.com/aws/aws-sdk-go-v2/service/cloudfront
Bumps [github.com/aws/aws-sdk-go-v2/service/cloudfront](https://github.com/aws/aws-sdk-go-v2) from 1.41.0 to 1.44.9.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/s3/v1.41.0...service/macie2/v1.44.9)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/service/cloudfront
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-08 15:46:45 +01:00
dependabot[bot]
b50ab04031 build(deps): bump github.com/aws/aws-sdk-go-v2 from 1.32.4 to 1.36.1
Bumps [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2) from 1.32.4 to 1.36.1.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Changelog](https://github.com/aws/aws-sdk-go-v2/blob/main/changelog-template.json)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.32.4...v1.36.1)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-08 10:33:03 +01:00
dependabot[bot]
b772f0e3d2 build(deps): bump github.com/getkin/kin-openapi from 0.123.0 to 0.129.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.123.0 to 0.129.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.123.0...v0.129.0)

---
updated-dependencies:
- dependency-name: github.com/getkin/kin-openapi
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-08 10:32:42 +01:00
dependabot[bot]
d58c0198d3 build(deps): bump github.com/spf13/pflag from 1.0.5 to 1.0.6
Bumps [github.com/spf13/pflag](https://github.com/spf13/pflag) from 1.0.5 to 1.0.6.
- [Release notes](https://github.com/spf13/pflag/releases)
- [Commits](https://github.com/spf13/pflag/compare/v1.0.5...v1.0.6)

---
updated-dependencies:
- dependency-name: github.com/spf13/pflag
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-08 10:31:42 +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
Joe Mooring
f0c1852978 helpers: Add Chroma styles to docs.yaml
Closes #13360
2025-02-08 00:30:05 +01:00
Joe Mooring
a352e69b02 commands: Validate style argument passed to gen chromastyles
Closes #13357
2025-02-07 22:44:22 +01:00
Bjørn Erik Pedersen
1dd27be81a
Update CONTRIBUTING.md 2025-02-07 22:25:19 +01:00
Bjørn Erik Pedersen
eb7a5aabaa Move "print unused templates" after renderDeferred
Fixes #13355
2025-02-07 18:04:12 +01:00
Bjørn Erik Pedersen
029d1e0ced Add some more server options/improvements
New options:

* `FromHeaders`: Server header matching for redirects
* `FromRe`: Regexp with group support, i.e. it replaces $1, $2 in To with the group matches.

Note that if both `From` and `FromRe` is set, both must match.

Also

* Allow redirects to non HTML URLs as long as the Sec-Fetch-Mode is set to navigate on the request.
* Detect and stop redirect loops.

This was all done while testing out InertiaJS with Hugo. So, after this commit, this setup will support the main parts of the protocol that Inertia uses:

```toml
[server]
    [[server.headers]]
        for = '/**/inertia.json'
        [server.headers.values]
            Content-Type = 'text/html'
            X-Inertia    = 'true'
            Vary         = 'Accept'

    [[server.redirects]]
        force       = true
        from        = '/**/'
        fromRe      = "^/(.*)/$"
        fromHeaders = { "X-Inertia" = "true" }
        status      = 301
        to          = '/$1/inertia.json'
```

Unfortunately, a provider like Netlify does not support redirects matching by request headers. It should be possible with some edge function, but then again, I'm not sure that InertiaJS is a very good fit with the common Hugo use cases.

But this commit should be generally useful.
2025-02-05 18:14:15 +01:00
Bjørn Erik Pedersen
e865d59844 Fix shortcode name in error message on self-closing shortcodes with no .Inner
Fixes #13344
2025-02-05 16:35:02 +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
Bjørn Erik Pedersen
760c13a7ac Fix RSS with baseURL with sub dir when render hooks is enabled
Fixes #13332
2025-02-03 19:00:12 +01:00
Oleksandr Redko
3bd73d262d
mage: Simplify magefile 2025-02-03 18:34:16 +01:00
Joe Mooring
7104de83ce common/hugo: Adjust deprecation timing and message
Closes #13333
2025-02-03 18:32:30 +01:00
Bjørn Erik Pedersen
835579b338 Re-introduce the LRU-evicted identities in change set calculation
This is a follow up to db28695ff5 -- that commit dropped the cache items evicted in the LRU process. This was done as performance optimization for large Hugo sites.

That made much sense, but now there's a slight chance that we miss out on a change when rebuilding.

This commit fixes this by applying the same logic to the evicted items as if they were still in the cache. This should preserve the performance gains in db28695ff5 and close the hole for the possible false negatives.
2025-02-02 15:55:11 +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
db28695ff5 Fix some server/watch rebuild issues
Two issues:

1. Fixe potential edit-loop in server/watch mode (see below)
2. Drain the cache eviction stack before we start calculating the change set. This should allow more fine grained rebuilds for bigger sites and/or in low memory situations.

The fix in 6c68142cc1 wasn't really fixing the complete problem.

In Hugo we have some steps that takes more time than others, one example being CSS building with TailwindCSS.

The symptom here is that sometimes when you:

1. Edit content or templates that does not trigger a CSS rebuild => Snappy rebuild.
2. Edit stylesheet or add a CSS class to template that triggers a CSS rebuild => relatively slow rebuild (expected)
3. Then back to content editing or template edits that should not trigger a CSS rebuild => relatively slow rebuild (not expected)

This commit fixes this by pulling the dynacache GC step up and merge it with the cache buster step.

Fixes #13316
2025-02-01 16:29:14 +01:00
Bjørn Erik Pedersen
778f0d9002 Don't re-render aliases on server rebuilds
This can lead to stale aliases when rebuilding, but that's a trade-off we need to take for snappier rebuilds on bigger sites.

Note that it should be possible to detect alias changes, but I'm not sure it's worth it.
2025-02-01 15:23:36 +01:00
Alex Shpak
13b208e2f7 tpl/tplimpl: Remove leading whitespaces produced by Youtube shortcode 2025-01-31 09:29:10 +01: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
Joe Mooring
33b46d8a41 resources: Remove debug statement
Closes #13320
2025-01-30 11:32:57 +01:00
Bjørn Erik Pedersen
6c68142cc1 Fix TailwindCSS related server rebuild issue
Fixes #13316
2025-01-29 18:46:12 +01:00
Joe Mooring
e08d9af21e markup/goldmark: Trim space from blockquote render hook text
Closes #13302
2025-01-24 19:58:45 +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
Guilherme Soares
c939c33fd3 parser/pageparser: Don't allow parameters after closing tag in shortcodes
Problem:
Previously, the following self-closing shortcode syntax was incorrectly allowed:
{{% sc / param %}}

Solution:
Only allow parameters before the self-closing tag
2025-01-24 15:31:44 +01:00
Bjørn Erik Pedersen
bb7b3d3cdb Fix cascade with overlapping sections
Fixes #12465
2025-01-24 15:25:54 +01:00
Joe Mooring
873a5cda1a tpl/tplimpl: Improve shortcode test coverage 2025-01-24 09:10:45 +01:00
Joe Mooring
f42a4b6af5 tpl/tplimpl: Deprecate gist shortcode
Closes #13211
2025-01-23 20:12:36 +01:00
Bjørn Erik Pedersen
a5637831cd
resources: Remove conditional used for debugging 2025-01-23 17:53:38 +01:00
Bjørn Erik Pedersen
68586c891c resources: Add responseHeaders option to resources.GetRemote
* These response headers will be included in `.Data.Headers` if found.
* The header name matching is case insensitive.
* `Data.Headers` is of type `map[string][]string`
* In most cases there will be only one value per header key, but e.g. `Set-Cookie` commonly has multiple values.

Fixes #12521
2025-01-23 15:20:03 +01:00
Bjørn Erik Pedersen
51bb2fedab
tpl/tplimpl: Skip TestTemplateFuncsExamples on s390x
Closes #13204
2025-01-23 10:18:43 +01:00
Bjørn Erik Pedersen
43307b07f8
Merge commit '346b60358d' 2025-01-23 09:47:46 +01:00
Bjørn Erik Pedersen
346b60358d Squashed 'docs/' changes from 4429eeeea..73a01565c
73a01565c Remove comment shortcode documentation
0ca7ccd30 Replace usage of comment shortcode with HTML comments
fe10d9899 Remove expired new-in labels
11e89dfcb [editorial] Link to proper render-hook page in relref.md
11a581c2f netlify: Hugo 0.142.0
1a4fcf7f7 Miscellaneous edits
2c7a3165f Markdown linting and cleanup
69d7a781b Replace links to glossary terms with custom render hook syntax
441752d2d Refactor glossary lookup portion of link render hook
80109a14f Fix glossary term linking for plural form
cd95f0f34 Update link render hook to support glossary links
53eadb430 Remove the glossary template
1d40a7f3b Improve transform.ToMath examples
586970df2 Misc edits
6a06a8de7 Add glossary link shortcode
4171c0eb7 Improve description of masking with non-transparent images
41c8feb64 Fix example of image.Mask filter
704a81656 Add alignx option to images.Text usage example
7c03eb0cc Clarify context in example of using the try statement
56d9c9b71 Refactor glossary of terms
042a6846b Add expiry dates to deprecated methods pages
365ab345f Remove services key from instagram shortcode page
b7fe31e07 Reorder options list for images.Text filter
8051ff818 Format directory names, file names, and file paths as code
d09a14623 Update version refs for Hugo and Dart Sass
3bb006974 Add NODE_VERSION to Netlify config examples
3a0f2531e Fix typo
7e3198eaf Fix typo
cf56452a3 Fix typo
a9f51d13e Fix typo
82bfdd8c3 Fix typo
a5c41a053 Fix typo
abcfed7a5 Fix typo
8c1debf3a Remove outdated new-in badges
809ddf9ef Update theme
63867d56f Use warnf instead of errorf in try-catch example
dee3e5f09 Update theme
9791f7057 Remove TODO from comment shortcode examples
a346ca1fd Elevate embedded shortcode documentation to its own section
8fa19b50f hugoreleaser.toml =>  hugoreleaser.yaml
575d60345 Update docs for v0.141.0
a0a442d62 netlify: Hugo 0.141.0
6667cbcd8 Merge commit '81a7b63900'
f36fc013e docs: Regen CLI docs
365a47ded tpl/images: Change signature of images.QR to images.QR TEXT OPTIONS
ae8f8af0a images.Text: Add "alignx" option for horizontal alignment
8f45ccca6 docs: Regen CLI docs
f0e6304f4 Merge commit 'e9fbadacc3'
cb9bec2b2 tpl/images: Add images.QR function

git-subtree-dir: docs
git-subtree-split: 73a01565c5ba0774d65aa6f2384c44804fefa37d
2025-01-23 09:46:02 +01:00
Bjørn Erik Pedersen
7f0f50b133 Make cascade front matter order deterministic
Fixes #12594
2025-01-23 09:45:47 +01:00
Joe Mooring
77a8e347bc tpl/tplimpl: Deprecate comment shortcode 2025-01-22 19:38:02 +01:00
Patrice Chalin
f704d75699
markup/goldmark: Fix typo in func comment 2025-01-22 14:57:24 +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
Bjørn Erik Pedersen
6aa72acaf9 Fix render hook's PlainText with typographer extension enabled
Fixes #13286
Fixes #13292
2025-01-22 12:49:25 +01:00
Bjørn Erik Pedersen
9885e7020d Improve assert 2025-01-22 09:44:26 +01:00
Bjørn Erik Pedersen
91101d24f2 Improve assertions 2025-01-22 09:44:26 +01:00
Bjørn Erik Pedersen
637995ba8f Also handle inline HTML comments 2025-01-22 09:44:26 +01:00
Bjørn Erik Pedersen
f1de5d2a04 Do not warn on potentially unsafe HTML comments when unsafe=false
We will still not render these comments, so from a safety perspective this is the same, but HTML comments are very common also inside Markdown and too useful to throw away.

Updates #13278
2025-01-22 09:44:26 +01: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
Joe Mooring
8de4ffb294 tpl/tplimpl: Fix context in shortcode error messages
Fixes #13279
2025-01-20 16:17:55 +01:00
Bjørn Erik Pedersen
1f5a15aba0 resources: Fix 2 image file cache key issues
* Always include the content hash in the cache key for unprocessed images.
* Always include the image config hash in the cache key.

This is also a major cleanup/simplification of the implementation in this area.

Note that this, unfortunately, forces new hashes/filenames for generated images.

Fixes #13273
Fixes #13272
2025-01-18 12:23:18 +01:00
Nicolas Friedli
8897113666
tpl: Add loading attribute to qr shortcode 2025-01-17 19:06:54 +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
Bjørn Erik Pedersen
1fad3832a9 tpl/tplimpl: Simplify some test assertions 2025-01-16 11:29:24 +01:00
Jack Baldry
8b52626915
common/paths: Fix docstring 2025-01-16 10:58:18 +01:00
Bjørn Erik Pedersen
81a7b63900 Squashed 'docs/' changes from f0f4bcb24..4429eeeea
4429eeeea Update image render hooks examples to conform with Commonmark
5391dddea Add class attribute to heading render hook examples

git-subtree-dir: docs
git-subtree-split: 4429eeeea84bfa4b9e636deaab5c9620ccf776a6
2025-01-16 10:35:07 +01:00
Bjørn Erik Pedersen
5c5508817f
Merge commit '81a7b63900' 2025-01-16 10:35:07 +01:00
Bjørn Erik Pedersen
88ecc3b753
docs: Regen CLI docs 2025-01-16 10:34:52 +01:00
Joe Mooring
1191467c05 tpl/tplimpl: Deprecate twitter shortcode in favor of x shortcode
Closes #13214
2025-01-16 10:33:34 +01:00
Bjørn Erik Pedersen
60c24fc5ee
commands: Fix spelling in comment 2025-01-15 22:31:52 +01:00
Bjørn Erik Pedersen
41137077bc
commands: Set up the glboal logger early
Fixes #13265
2025-01-15 22:31:08 +01:00
Bjørn Erik Pedersen
5bb1564575 commands: Add --printZero to the config command
Will include zero config values (e.g. "", 0, false) in the output and will be more verbose, but useful if you cant to discover all available config options.
2025-01-15 22:48:14 +02:00
Bjørn Erik Pedersen
76993369a0 For render hooks, only fallback to HTML (or the defaultOutputFormat) template
Closes #13242
2025-01-15 19:59:58 +02:00
Bjørn Erik Pedersen
de7137cc35 tpl/collections: Use MapRange/SetIterKey/SetIterValue for Where, Sort and Merge
Some relevant benchmarks:

Where with maps:

```
cpu: Apple M1 Pro
            │ master.bench │         fix-mapkeys.bench          │
            │    sec/op    │   sec/op     vs base               │
WhereMap-10    79.26µ ± 1%   26.58µ ± 1%  -66.46% (p=0.002 n=6)

            │ master.bench │         fix-mapkeys.bench         │
            │     B/op     │    B/op     vs base               │
WhereMap-10   56685.0 ± 0%   111.0 ± 1%  -99.80% (p=0.002 n=6)

            │ master.bench  │         fix-mapkeys.bench         │
            │   allocs/op   │ allocs/op   vs base               │
WhereMap-10   2003.000 ± 0%   4.000 ± 0%  -99.80% (p=0.002 n=6)
```

Merge:

```
         │ master.bench │         fix-mapkeys.bench          │
         │    sec/op    │   sec/op     vs base               │
Merge-10    3.285µ ± 0%   2.268µ ± 1%  -30.96% (p=0.002 n=6)

         │ master.bench │          fix-mapkeys.bench          │
         │     B/op     │     B/op      vs base               │
Merge-10   3.079Ki ± 0%   1.891Ki ± 0%  -38.58% (p=0.002 n=6)

         │ master.bench │         fix-mapkeys.bench         │
         │  allocs/op   │ allocs/op   vs base               │
Merge-10     64.00 ± 0%   26.00 ± 0%  -59.38% (p=0.002 n=6)
```
Sort:

```
cpu: Apple M1 Pro
           │ master.bench │         fix-mapkeys.bench         │
           │    sec/op    │   sec/op     vs base              │
SortMap-10   1008.0n ± 1%   915.5n ± 0%  -9.18% (p=0.002 n=6)

           │ master.bench │         fix-mapkeys.bench         │
           │     B/op     │    B/op     vs base               │
SortMap-10     640.0 ± 0%   512.0 ± 0%  -20.00% (p=0.002 n=6)

           │ master.bench │        fix-mapkeys.bench         │
           │  allocs/op   │ allocs/op   vs base              │
SortMap-10     16.00 ± 0%   15.00 ± 0%  -6.25% (p=0.002 n=6)
```
2025-01-13 16:24:48 +02: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
Bjørn Erik Pedersen
956f915f77
tpl/collections: Add BenchmarkWhereMap 2025-01-13 12:57:48 +02:00
Bjørn Erik Pedersen
a2a4166f6d
tpl/collections: Add BenchmarkSortMap 2025-01-13 10:38:12 +02:00
Bjørn Erik Pedersen
39f582f9f4
tpl/collections: Add Merge benchmark 2025-01-13 10:32:41 +02:00
Bjørn Erik Pedersen
2501de7aab resources/images: Refactor golden image tests to locate them closer to the implementation 2025-01-11 18:27:53 +02:00
Bjørn Erik Pedersen
06cc8673fa resources/images: Add some mask tests
Closes #13244
2025-01-11 12:20:11 +02:00
Markus Kienast
71fae99189 resources/images: Add images.Mask
See #13244
2025-01-11 12:20:11 +02:00
Joe Mooring
8af04745fb tpl/tplimpl: Use plain text for image render hook alt attribute
Co-authored-by: Heracles <email@heracl.es>
2025-01-10 19:44:39 +02:00
Bjørn Erik Pedersen
dde9d9d544 Adjust error handling in ToMath vs try (note)
Closes #13239
2025-01-09 11:47:19 +01:00
Bjørn Erik Pedersen
892b49110e resources/images: Add some golden tests for images.QR 2025-01-09 08:02:43 +01:00
Bjørn Erik Pedersen
c5a63a3b4f Fix branch resource overlapping bundle path
Fixes #13228
2025-01-09 08:00:30 +01:00
Bjørn Erik Pedersen
61d3d20129 templates: Fix handling of multiple defers in the same template
Fixes #13236
2025-01-09 07:59:25 +01:00
Joe Mooring
b13d0a68e6 tpl/images: Change signature of images.QR to images.QR TEXT OPTIONS
Closes #13230
2025-01-08 19:59:39 +01:00
Bjørn Erik Pedersen
d9594a96fc resources/images: Add some golden tests for images.Text 2025-01-08 18:56:26 +01:00
Julius Künzel
4a5cc2dd26 images.Text: Add "alignx" option for horizontal alignment
Add an "alignx" option to the images.Text to control whether the value of the "x" option is the left border of the text (current behaviour), the center of each line or the right border.

Fixes #10849
2025-01-08 17:23:46 +01:00
Bjørn Erik Pedersen
9cad8d38ca images: Rework the golden tests 2025-01-08 17:11:27 +01:00
Bjørn Erik Pedersen
cfa0801815 Fix NPX issue with TailwindCSS v4
This allows the `tailwindcss` CLI binary to live in the `PATH` for NPM-less projects.

Fixes #13221
2025-01-07 13:12:08 +01:00
dependabot[bot]
f024a5050e build(deps): bump golang.org/x/tools from 0.28.0 to 0.29.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.28.0 to 0.29.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.28.0...v0.29.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-07 10:46:27 +01:00
dependabot[bot]
80704bc9a1 build(deps): bump golang.org/x/net from 0.33.0 to 0.34.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.33.0 to 0.34.0.
- [Commits](https://github.com/golang/net/compare/v0.33.0...v0.34.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-07 10:46:04 +01:00
Joe Mooring
3682027a51
snap: Always package latest stable version of Go 2025-01-06 12:50:40 -08:00
Bjørn Erik Pedersen
44628616af
docs: Regen CLI docs 2025-01-06 18:12:20 +01:00
Bjørn Erik Pedersen
0fc86783ee
Merge commit 'e9fbadacc3' 2025-01-06 18:11:07 +01:00
Bjørn Erik Pedersen
e9fbadacc3 Squashed 'docs/' changes from 8390a4a3a..f0f4bcb24
f0f4bcb24 Update Batch.md
15a8b1de6 Update Batch.md
eb841ce66 Update theme
751097f24 Use CI_PAGES_URL in GitLab Pages workflow
8584a0581 Fix typos
b030a7149 Update configuration.md
f7ec2ee9c Revert "Update shortcode.md"
f8188f1c8 Update shortcode.md
083fc39c6 Update shortcode.md
d4bdfb96b Update Filter.md
ef00649db Document wrapperClass highlighting option
e227dc422 Hugo 0.140.2
b95d28444 Fix description of the the hugo server command
41ca381b0 Fix documentation of Fragments
73a6cd966 Update theme
2573fd120 netlify: Hugo 0.140.1
90b19ec0d Merge branch 'tempv0.140.1'
ad2e9aeec Update gocloud and docs for S3-Compatible Endpoints
34b30bad2 Remove indentation from include shortcode examples
97b4ef544 Update related.md
7234e0189 Update related.md
32cc191f6 Clarify Name and Title menu entry methods
bce733c63 Update theme
2f1843d10 Use .Page.GetPage in examples of an include shortcode
9e1c85bbd Revert "Document PAGE.String"
bb30e7c08 Document PAGE.String
2d151d77f Fix link
fbe2d442f Miscellaneous updates for v0.140.0
4d3195223 Update JS docs vs Hugo v0.140
8c190aabc netlify: Hugo 0.140.0
826005ffe Merge branch 'tempv0.140.0'
107289a2c Update theme (again)
9884425f9 Update theme
ff0a358d3 Update Go tool version in hugo.work
c9b23cf6d tpl/tplimpl: Update details shortcode
f29f19aff tpl/tplimpl: Add details shortcode

git-subtree-dir: docs
git-subtree-split: f0f4bcb243776d0552396d12758bd38cda779b62
2025-01-06 18:09:20 +01:00
Bjørn Erik Pedersen
2a7bb1c7c9 create: Respect --noBuildLock in hugo new 2025-01-06 17:59:24 +01:00
dependabot[bot]
b7b49fb0f8 build(deps): bump github.com/evanw/esbuild from 0.24.0 to 0.24.2
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.24.0 to 0.24.2.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.24.0...v0.24.2)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-06 15:07:05 +01:00
Bjørn Erik Pedersen
5f2adad2c7 tpl/images: Format the QR hashes as hex
Slightly shorter, and it looks more like a ... hash.
2025-01-06 15:05:03 +01:00
dependabot[bot]
a837976731 build(deps): bump github.com/alecthomas/chroma/v2 from 2.14.0 to 2.15.0
Bumps [github.com/alecthomas/chroma/v2](https://github.com/alecthomas/chroma) from 2.14.0 to 2.15.0.
- [Release notes](https://github.com/alecthomas/chroma/releases)
- [Changelog](https://github.com/alecthomas/chroma/blob/master/.goreleaser.yml)
- [Commits](https://github.com/alecthomas/chroma/compare/v2.14.0...v2.15.0)

---
updated-dependencies:
- dependency-name: github.com/alecthomas/chroma/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-06 13:38:55 +01:00
Bjørn Erik Pedersen
0918e087ec resources: Replace error handling in GetRemote with try (note)
Closes #13216
2025-01-06 12:22:17 +01:00
Joe Mooring
4ea94c451d tpl/images: Add images.QR function
Closes #13205
2025-01-06 12:05:59 +01:00
Bjørn Erik Pedersen
5d2cbee989 Add try
Updates #9737
2025-01-05 15:32:21 +01:00
Bjørn Erik Pedersen
723e3f4342 resources: Add FromOpts for more effective resource creation
E.g. when the targetPath already contains a hash or if the resource content is expensive to create.
2025-01-05 12:43:37 +01:00
Bjørn Erik Pedersen
d913f46a8b Fix server refresh on 404 template changes
Fixes #13209
2025-01-02 11:21:25 +01:00
Joe Mooring
2db43f841c markup/highlight: Remove noHl option
Closes #9885
2024-12-31 15:46:46 +01:00
hugoreleaser
46ce1f191b releaser: Prepare repository for 0.141.0-DEV
[ci skip]
2024-12-30 15:16:00 +00:00
hugoreleaser
aae02ca612 releaser: Bump versions for release of 0.140.2
[ci skip]
2024-12-30 15:01:53 +00:00
Diwas Rimal
83cec785cf Print cli usage of hugo gen chromastyles alongside css 2024-12-30 15:06:35 +01:00
dependabot[bot]
4e52be8b90 build(deps): bump golang.org/x/net from 0.32.0 to 0.33.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.32.0 to 0.33.0.
- [Commits](https://github.com/golang/net/compare/v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-30 10:57:04 +01:00
Joe Mooring
7888ac585c config/allconfig: Fix slice of language configs
Fixes #13201
2024-12-30 10:54:56 +01:00
Joe Mooring
eb1dbe0709 config/allconfig: Throw error when output format is not defined
Fixes #13199
2024-12-29 21:38:46 +01:00
Bjørn Erik Pedersen
77824d704c Fix same resource file published more than once
This may still happen, though, in low memory situations or very big sites, but I'm not sure it's worth spending time on fixing that. Writing the same file more than once isn't harmful, the negative effect is the false path warning.
 We may find a way to detect that situation if this becomes a real problem.

Fixes #13164
2024-12-27 18:55:24 +01:00
Bjørn Erik Pedersen
ec0caaec7c markup/highlight: Add wrapperClass option
The need comes from Tailwind's typography plugin. There's currently no way to turn that off outside of the markup, see https://github.com/tailwindlabs/tailwindcss-typography/pull/363
2024-12-25 19:31:47 +01:00
Bjørn Erik Pedersen
845b8885de
Update README.md 2024-12-23 18:57:19 +01:00
hugoreleaser
43385d6aeb releaser: Prepare repository for 0.141.0-DEV
[ci skip]
2024-12-23 16:40:37 +00:00
hugoreleaser
a9b0b95ef4 releaser: Bump versions for release of 0.140.1
[ci skip]
2024-12-23 16:26:35 +00:00
Chris Moultrie
e229f4b387 Update gocloud and docs for S3-Compatible Endpoints 2024-12-22 22:58:36 +01:00
Bjørn Erik Pedersen
020253904f js/esbuild: Don't try to resolve packages in /assets marked as external
Fixes #13183
2024-12-22 21:29:18 +01:00
Bjørn Erik Pedersen
4a5e94087b Fix union, complement, symdiff, and intersect for transient resources
Fixes #13181
2024-12-22 19:25:03 +01:00
Bjørn Erik Pedersen
48a7aee961
release: Add withdeploy deb extended archives
Also refactor and get the config up to date for new version of Hugoreleaser.

Closes #13166
2024-12-22 16:55:52 +01:00
Joe Mooring
6c583e3227 common/loggers: Write PrintTimerIfDelayed output to stdErr
Closes #13171
2024-12-19 19:52:13 +01:00
dependabot[bot]
5d64b492f4 build(deps): bump github.com/spf13/cast from 1.7.0 to 1.7.1
Bumps [github.com/spf13/cast](https://github.com/spf13/cast) from 1.7.0 to 1.7.1.
- [Release notes](https://github.com/spf13/cast/releases)
- [Commits](https://github.com/spf13/cast/compare/v1.7.0...v1.7.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cast
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-19 12:08:10 +01:00
Joe Mooring
b3f32949cb hugolib: Fix fallbacks for menu entry Name and Title
Closes #13161
2024-12-19 08:47:53 +01:00
hugoreleaser
55ecd3a90e releaser: Prepare repository for 0.141.0-DEV
[ci skip]
2024-12-17 14:37:51 +00:00
hugoreleaser
3f35721fb2 releaser: Bump versions for release of 0.140.0
[ci skip]
2024-12-17 14:20:55 +00:00
Bjørn Erik Pedersen
5c80cb0d20
js/esbuild: Add missing es2024 target 2024-12-17 14:35:13 +01:00
Bjørn Erik Pedersen
a5e5be234c Fix panic on server rebuilds when using both base templates and template.Defer
Fixes #12963
2024-12-16 18:03:04 +01:00
Bjørn Erik Pedersen
565c30eac9 js: Fix js.Batch for multihost setups
Note that this is an unreleased feature.

Fixes #13151
2024-12-16 11:52:18 +01:00
Joe Mooring
48dd6a918a parser/pageparser: Fix Org Mode summary delimiter assignment
Closes #13152
2024-12-16 10:30:27 +01:00
Bjørn Erik Pedersen
744b8566ec Fix a rebuild on resource rename case 2024-12-16 08:33:10 +01:00
Bjørn Erik Pedersen
7de5317aef js/esbuild: Add runners after scripts 2024-12-16 08:33:10 +01:00
Bjørn Erik Pedersen
4cbd4ef991 js/esbuild: Batch: Avoid nil Instances slice
Ranging over a nil slice in Go works great, but is a hassle onced passed to JS.
2024-12-16 08:33:10 +01:00
Joe Mooring
a32c889a7b
tpl/tplimpl: Fix title attribute in details shortcode 2024-12-13 10:50:17 -08:00
Joe Mooring
852d868549 tpl/tplimpl: Update youtube shortcode
Pass a map instead of a slice to the collections.Querify function.
2024-12-13 15:16:55 +01:00
Joe Mooring
1e34e5b26d tpl/tplimpl: Update details shortcode
- Remove localization of default summary value
- Add title attribute
- Reformat to be consistent with other embedded templates
- Simplify and improve integration test
- Update documentation
2024-12-13 14:21:13 +01:00
Joe Mooring
641d2616c7 tpl/collections: Allow querify to accept a map argument
Closes #13131
2024-12-13 13:30:55 +01:00
Bjørn Erik Pedersen
a834bb9f7e js/esbuild: Build groups in order of their ID
We already do this for scripts e.g. inside a group.

This makes sure that group A's entry points gets added before B's, which can be an important property, see https://github.com/evanw/esbuild/issues/399#issuecomment-1458680887
2024-12-13 13:29:35 +01:00
racehd
4f130f6e4f tpl/tplimpl: Add details shortcode
- Add new shortcode to render details HTML element.
- Implement integration tests to check: default state, custom summary, open state,  attribute sanitization, allowed attributes, and localization of default summary text.
- Update docs to include details shortcode.

Closes # 13090
2024-12-13 09:24:20 +01:00
Bjørn Erik Pedersen
9dfa112617
Write all logging (INFO, WARN, ERROR) to stderr
The old setup tried to log >= warning to stderr, the rest to stdout.

However, that logic was flawed, so warnings ended up in stdout, which makes `hugo list all` etc. hard to reason about from scripts.

This commit fixes this by making all logging (info, warn, error) log to stderr and let stdout be reserved for program output.

Fixes #13074
2024-12-13 09:23:09 +01:00
Bjørn Erik Pedersen
ec1933f79d js/esbuild: Add platform option
Closes #13136
2024-12-12 22:53:15 +01:00
Bjørn Erik Pedersen
75ad9cdaab Add config option disableDefaultLanguageRedirect
Fixes #13133
2024-12-12 21:47:03 +01:00
Bjørn Erik Pedersen
e293e7ca6d Add js.Batch
Fixes #12626
Closes #7499
Closes #9978
Closes #12879
Closes #13113
Fixes #13116
2024-12-12 21:43:17 +01:00
dependabot[bot]
157d86414d build(deps): bump golang.org/x/crypto from 0.30.0 to 0.31.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.30.0 to 0.31.0.
- [Commits](https://github.com/golang/crypto/compare/v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-12 12:19:49 +01:00
Bjørn Erik Pedersen
6be253000f
Upgrade to Go 1.23.4
Closes #13130
2024-12-12 10:39:59 +01:00
dependabot[bot]
947e4e66b5 build(deps): bump golang.org/x/tools from 0.27.0 to 0.28.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.27.0 to 0.28.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-12 09:25:40 +01:00
Bjørn Erik Pedersen
989b299b55
Remove some old and unused shell scripts 2024-12-11 13:15:09 +01:00
dependabot[bot]
5f897868c0 build(deps): bump github.com/hairyhenderson/go-codeowners
Bumps [github.com/hairyhenderson/go-codeowners](https://github.com/hairyhenderson/go-codeowners) from 0.6.1 to 0.7.0.
- [Release notes](https://github.com/hairyhenderson/go-codeowners/releases)
- [Changelog](https://github.com/hairyhenderson/go-codeowners/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hairyhenderson/go-codeowners/compare/v0.6.1...v0.7.0)

---
updated-dependencies:
- dependency-name: github.com/hairyhenderson/go-codeowners
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-11 10:10:14 +01:00
Bjørn Erik Pedersen
e477373487 Squashed 'docs/' changes from 227aab619..8390a4a3a
8390a4a3a Add Void Linux installation instructions
d6099aae8 Update link to PostCSS plugins
25dad4693 netlify: Hugo 0.139.4
2b1fa118c Fix typo
3ef1eb505 Update hosting-on-aws-amplify
c0f6d35d6 Fix typo
aa54d4301 Correct directory name
98aa26bdb Improve instructions for hosting with AWS Amplify
a07638a80 Add new-in badges
6ad018055 netlify: Hugo 0.139.3
1050835d6 Update title of hugo.Store page
ebbd2e851 Clarify the shortcode Ordinal method
b7716ed95 Revise code block render hook for Mermaid diagrams
f1da9b6ea netlify: Hugo 0.139.2
d8ac9f428 Downgrade the Go toolchain in go.mod to a slightly older Go version
254b3c4f2 netlify: Hugo 0.139.1
03e666038 Add hugo.Store, site.Store and Shortcode.Store
157e8983b Update Anchorize.md
59fa9f214 Document the PageRef menu entry method
bda544cce docs(transform.Unmarshal): match lang attribute to title language in examples
1985886bd Adjust front matter of shared Markdown snippets
da5bd70d1 Fix typo
431b65d6b Update theme
b63ef69f5 Update style guidance
d50ed3422 Remove old new-in badges
12bfb9933 Update docs.yaml
0b936cacd netlify: Hugo 0.139.0
ab7668b4d dartsass: Add silenceDeprecations option
154df9bfc Merge commit '838bd312b1'
efa80477c docs: Regen CLI docs
ad99e4a7a docs: Regenerate CLI docs

git-subtree-dir: docs
git-subtree-split: 8390a4a3ac36094f4cf47170af23b636608c420e
2024-12-11 09:53:33 +01:00
Bjørn Erik Pedersen
b47376586a
Merge commit 'e477373487' 2024-12-11 09:53:33 +01:00
Bjørn Erik Pedersen
5ab38de363
Fix Sass imports on the form index.{scss,sass}
Fixes #13123
2024-12-10 13:33:27 +01:00
dependabot[bot]
7b69218489 build(deps): bump golang.org/x/net from 0.31.0 to 0.32.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.31.0 to 0.32.0.
- [Commits](https://github.com/golang/net/compare/v0.31.0...v0.32.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-10 09:49:56 +01:00
Joe Mooring
34373407b7 markup/goldmark: Fix blockquote render hook text parsing
Fixes #12913
Fixes #13119
2024-12-10 09:43:33 +01:00
hugoreleaser
3afe91d4b1 releaser: Bump versions for release of 0.139.4
[ci skip]
2024-12-09 17:45:23 +00:00
Joe Mooring
54398f8d57
tpl/tplimpl: Escape Markdown attributes in render hooks and shortcodes 2024-12-09 17:58:57 +01:00
Bjørn Erik Pedersen
b8c15f245b deps: Upgrade github.com/bep/godartsass/v2 v2.3.1 => v2.3.2
See https://github.com/bep/godartsass/issues/31 for some context.
2024-12-06 14:37:51 +01:00
Oleksandr Redko
d0dc518844 common/maps: Simplify TestScratchSetInMap/DeleteInMap 2024-12-05 12:40:59 +01:00
Joe Mooring
b529859008 markup/tableofcontents: Cast Fragments.ToHTML args to int
Closes #13107
2024-12-04 21:37:06 +01:00
hugoreleaser
487bb96474 releaser: Prepare repository for 0.140.0-DEV
[ci skip]
2024-11-29 15:51:07 +00:00
hugoreleaser
2f6864387c releaser: Bump versions for release of 0.139.3
[ci skip]
2024-11-29 15:36:56 +00:00
Bjørn Erik Pedersen
c1dc35dd71 Fix server edits of resources included in shortcode/hooks
Fixes #13093
2024-11-29 14:22:39 +01:00
huajin tong
fc3d1cbadb
Fix some typos 2024-11-28 11:20:02 +01:00
dependabot[bot]
7e130e34f2 build(deps): bump github.com/bep/godartsass/v2 from 2.3.0 to 2.3.1
Bumps [github.com/bep/godartsass/v2](https://github.com/bep/godartsass) from 2.3.0 to 2.3.1.
- [Release notes](https://github.com/bep/godartsass/releases)
- [Commits](https://github.com/bep/godartsass/compare/v2.3.0...v2.3.1)

---
updated-dependencies:
- dependency-name: github.com/bep/godartsass/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-28 11:06:11 +01:00
dependabot[bot]
88b7868fbd build(deps): bump github.com/tetratelabs/wazero from 1.8.1 to 1.8.2
Bumps [github.com/tetratelabs/wazero](https://github.com/tetratelabs/wazero) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/tetratelabs/wazero/releases)
- [Commits](https://github.com/tetratelabs/wazero/compare/v1.8.1...v1.8.2)

---
updated-dependencies:
- dependency-name: github.com/tetratelabs/wazero
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-27 23:50:07 +01:00
Bjørn Erik Pedersen
dea158c885
commands: Fix flaw in the livereload logic
I guess most commonly an issue with TailwindCSS editing in templates:

* Build changes both CSS and index.html => reload OK.
* Build changes both CSS and index.html and some other files => only CSS reloaded.

The above would fix itself with one more edit, but that's annoying.
2024-11-25 10:39:17 +01:00
hugoreleaser
467444ef64 releaser: Prepare repository for 0.140.0-DEV
[ci skip]
2024-11-23 15:46:37 +00:00
hugoreleaser
770f548b47 releaser: Bump versions for release of 0.139.2
[ci skip]
2024-11-23 15:33:51 +00:00
Bjørn Erik Pedersen
0ab81896d9
modules: Skip empty lines in modules.txt
Closes #13084
2024-11-23 16:29:32 +01:00
hugoreleaser
e00fdae456 releaser: Prepare repository for 0.140.0-DEV
[ci skip]
2024-11-23 14:26:42 +00:00
hugoreleaser
21299a7a67 releaser: Bump versions for release of 0.139.1
[ci skip]
2024-11-23 14:13:46 +00:00
Bjørn Erik Pedersen
aa3dd197f7 Revert "build(deps): bump github.com/tdewolff/minify/v2 from 2.20.37 to 2.21.1"
This reverts commit 7a2f04ee8c.

Closes #13082
2024-11-23 15:11:09 +01:00
Bjørn Erik Pedersen
5a50eee9da minifiers: Add failing test for upstream bug
See #13082
2024-11-23 15:11:09 +01:00
Bjørn Erik Pedersen
8d017a60fb dartsass: Fix nilpointer on Close when Dart Sass isn't installed
Fixes #13076
2024-11-21 20:00:36 +01:00
wangjingcun
8fcd3c1487
common: Fix some GoDoc typos 2024-11-19 11:29:19 +01:00
Bjørn Erik Pedersen
2d4c0c6c8d
readme: Update dependency list 2024-11-19 10:05:42 +01:00
hugoreleaser
59a55a1f9e releaser: Prepare repository for 0.140.0-DEV
[ci skip]
2024-11-18 16:32:01 +00:00
hugoreleaser
dacef0df92 releaser: Bump versions for release of 0.139.0
[ci skip]
2024-11-18 16:17:45 +00:00
Bjørn Erik Pedersen
8d92042ab9
dartsass: Fix error message
Closes #13065
2024-11-18 17:14:56 +01:00
Bjørn Erik Pedersen
e917401c71 Make sure term is always set
Fixes #13063
2024-11-18 16:20:25 +01:00
dependabot[bot]
eb298144b6 build(deps): bump github.com/aws/aws-sdk-go-v2/service/cloudfront
Bumps [github.com/aws/aws-sdk-go-v2/service/cloudfront](https://github.com/aws/aws-sdk-go-v2) from 1.38.4 to 1.41.0.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/service/s3/v1.38.4...service/s3/v1.41.0)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2/service/cloudfront
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 13:41:31 +01:00
Bjørn Erik Pedersen
3b6eaf9b1f dartsass: Add silenceDeprecations option
Fixes #13045
2024-11-18 13:41:12 +01:00
Bjørn Erik Pedersen
1fd845eee4 dartsass: Remove support for v1 of the protocol/binary (note)
People who stil use a very old binary named `dart-sass-embedded` need to upgrade.

See https://gohugo.io/functions/css/sass/#dart-sass
2024-11-18 12:32:39 +01:00
dependabot[bot]
61e2ce2a49 build(deps): bump google.golang.org/api from 0.191.0 to 0.206.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.191.0 to 0.206.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.191.0...v0.206.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 10:51:33 +01:00
dependabot[bot]
2d503f82ac build(deps): bump github.com/aws/aws-sdk-go-v2 from 1.30.3 to 1.32.4
Bumps [github.com/aws/aws-sdk-go-v2](https://github.com/aws/aws-sdk-go-v2) from 1.30.3 to 1.32.4.
- [Release notes](https://github.com/aws/aws-sdk-go-v2/releases)
- [Commits](https://github.com/aws/aws-sdk-go-v2/compare/v1.30.3...v1.32.4)

---
updated-dependencies:
- dependency-name: github.com/aws/aws-sdk-go-v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 10:51:04 +01:00
dependabot[bot]
3a6b2e6b14 build(deps): bump github.com/fsnotify/fsnotify from 1.7.0 to 1.8.0
Bumps [github.com/fsnotify/fsnotify](https://github.com/fsnotify/fsnotify) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/fsnotify/fsnotify/releases)
- [Changelog](https://github.com/fsnotify/fsnotify/blob/main/CHANGELOG.md)
- [Commits](https://github.com/fsnotify/fsnotify/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: github.com/fsnotify/fsnotify
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 10:50:22 +01:00
Bjørn Erik Pedersen
bbbfeb340a
Merge commit '838bd312b1' 2024-11-18 10:11:18 +01:00
Bjørn Erik Pedersen
838bd312b1 Squashed 'docs/' changes from 159c843fd..227aab619
227aab619 Update configuration-markup.md
019ff776c Fix grammatical error
c889827bf Remove old new-in
39807c5bc Remove duplicate yaml key

git-subtree-dir: docs
git-subtree-split: 227aab61905c0f778d173ed9e38621df4d7c429a
2024-11-18 10:11:17 +01:00
Bjørn Erik Pedersen
6bde8abaad deps: Upgrade github.com/bep/imagemeta v0.8.1 => v0.8.3 2024-11-17 12:05:37 +01:00
Bjørn Erik Pedersen
66dd6ecab2
docs: Regen CLI docs 2024-11-16 20:34:00 +01:00
Bjørn Erik Pedersen
ad43d137d5 Remove deprecations <= v0.122.0 (note)
These have, once we release this, been logging ERROR for 6 minor versions.
2024-11-16 20:32:43 +01:00
Bjørn Erik Pedersen
f7fc6ccd59
release: Add missing withdeploy archive for arm64 Linux
Closes #13029
2024-11-16 18:29:13 +01:00
Bjørn Erik Pedersen
d4de780edc Fix extra newline/paragraphs issue with .RenderShortcodes
Fixes #13051
2024-11-16 17:51:11 +01:00
dependabot[bot]
2c54c32986 build(deps): bump golang.org/x/tools from 0.26.0 to 0.27.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.26.0 to 0.27.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.26.0...v0.27.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 11:46:07 +01:00
dependabot[bot]
7a2f04ee8c build(deps): bump github.com/tdewolff/minify/v2 from 2.20.37 to 2.21.1
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.20.37 to 2.21.1.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.20.37...v2.21.1)

---
updated-dependencies:
- dependency-name: github.com/tdewolff/minify/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 10:04:07 +01:00
dependabot[bot]
7921777da1 build(deps): bump github.com/fatih/color from 1.17.0 to 1.18.0
Bumps [github.com/fatih/color](https://github.com/fatih/color) from 1.17.0 to 1.18.0.
- [Release notes](https://github.com/fatih/color/releases)
- [Commits](https://github.com/fatih/color/compare/v1.17.0...v1.18.0)

---
updated-dependencies:
- dependency-name: github.com/fatih/color
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 10:02:13 +01:00
dependabot[bot]
33e964d40b build(deps): bump golang.org/x/image from 0.21.0 to 0.22.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.21.0 to 0.22.0.
- [Commits](https://github.com/golang/image/compare/v0.21.0...v0.22.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-15 10:01:30 +01:00
Bjørn Erik Pedersen
5e3133a7d8
Run go mod tidy 2024-11-14 16:45:21 +01:00
Bjørn Erik Pedersen
58a3c91a7f
docs: Regenerate CLI docs 2024-11-14 16:10:38 +01:00
Bjørn Erik Pedersen
ac6962d284 commands: Add -O flag to server to open browser
Fixes #13040
2024-11-14 15:59:23 +01:00
KN4CK3R
23d21b0d16 Preserve input type. 2024-11-14 15:05:37 +01:00
Bjørn Erik Pedersen
588c9019cf deps: Upgrade github.com/yuin/goldmark v1.7.4 => v1.7.8
Closes #12958
2024-11-14 14:31:04 +01:00
Bjørn Erik Pedersen
ce9cf882a5 server: Strip ANSI escape codes from browser error log
Fixes #13037
2024-11-14 14:25:07 +01:00
dependabot[bot]
46e17053c8 build(deps): bump golang.org/x/sync from 0.8.0 to 0.9.0
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.8.0 to 0.9.0.
- [Commits](https://github.com/golang/sync/compare/v0.8.0...v0.9.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-14 14:02:35 +01:00
dependabot[bot]
cb6580d008 build(deps): bump github.com/hairyhenderson/go-codeowners
Bumps [github.com/hairyhenderson/go-codeowners](https://github.com/hairyhenderson/go-codeowners) from 0.6.0 to 0.6.1.
- [Release notes](https://github.com/hairyhenderson/go-codeowners/releases)
- [Changelog](https://github.com/hairyhenderson/go-codeowners/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hairyhenderson/go-codeowners/compare/v0.6.0...v0.6.1)

---
updated-dependencies:
- dependency-name: github.com/hairyhenderson/go-codeowners
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-14 14:01:41 +01:00
Bjørn Erik Pedersen
8aba6dc661
parser/metadecoders: Add benchmark 2024-11-13 14:57:18 +01:00
Bjørn Erik Pedersen
a7df536a52 Add site.Store and hugo.Store and Shortcode.Store
Closes #13021
2024-11-13 12:41:16 +01:00
Bjørn Erik Pedersen
de0df119b5 Squashed 'docs/' changes from ccb1b97cb..159c843fd
159c843fd Fix front matter menu entry example
c3a476a19 Document soft deprecation of PAGE.Scratch
cdead9785 netlify: Hugo 0.138.0
9169b4da4 Update version references
3bc6bf431 Update embedded.md
5c7743b2e Update creation instructions for the emoji quick reference
109efe3eb Document the comment shortcode
83d7d3005 Update theme
d3c205054 netlify: Hugo 0.137.1
545290351 Handle inline HTML content
0204be97d Update theme
18d09235e Remove JS and CSS that prevents FOUC with client side math rendering
63d9dd876 Update RenderShortcodes.md
064b95539 Update output-format-definition.md
3744f3be2 Describe and refer to the extended/deploy edition
3d3302308 netlify: Hugo 0.137.0
b53aedcea Update RenderShortcodes.md
b5f289165 Replace HTML comments in markdown with the new comment shortcode
c673880b6 Remove superfluous right bracket
f80b0c61e Update faq.md
2ede707eb Document installation on NixOS
09b114914 Update theme
76a9f90b2 Update passthrough.md
9f3355630 Update Scratch.md
bc080ecaa Update Store.md
1507ede32 Update Scratch.md
54a90f569 Update Store.md
7c9145c43 Fix broken link
dd15f183b Update ToMath.md
2b021c34b Move the [build] documentation to its own page
cbb6677ec Fix typo
ac0969063 Update ToMath.md
7fbdfd7c8 netlify: Hugo 0.136.5
17f54223c Update ToMath.md
4c9c3bb06 Update multilingual.md
1432da7bd Make site and page language methods linkable
fd5b746cb Update urls.md
a746f1b3a Update urls.md
abf8738e2 netlify: Hugo 0.136.4
bd8759996 Update TrimSpace.md
6103c1e84 Documents strings.TrimSpace
533dd3a7b netlify: Hugo 0.136.3
30f3f97cf Update quick-start.md
b0d7b41a0 Update configuration-markup.md
760e5e4f0 Update quick-start.md
17daeb866 Update quick-start.md
1e158e723 netlify: Hugo 0.136.2
d32530839 Update theme
edb9bee02 Update description of url front matter field
e1c576e18 netlify: Hugo 0.136.1
1ad28e1e0 Describe how to configure uglyURLs per section
cbbd4c4fe netlify: Hugo 0.136.0
bb7f35e99 Merge branch 'tempv0.136.0'
706110736 docs: Regen CLI docs
bf0c7821f Update urls.md
8c544e6c0 Update quick-start.md
8d02733d0 Update Paginator.md
a45327aac Update Paginate.md
1377ed4de Clarify date parsing
e19fb8043 Document front matter date field aliases
a39951847 Update Tailwind CSS installation instructions
3be164c35 Remove duplicate token
05fc815f7 commands: Add "hugo build" as an alias for "hugo"
cb3cb504c Update table render hook example
efbee0bff Clarify resources.GetRemote 404 handling
4312d49c9 Update compare.Conditional documentation
4a46d53b6 Update theme
93e542d4f netlify: Hugo 0.135.0
b4da1c104 Remvoe some old new-in shortcodes
4c316f051 Update TailwindCSS.md
c2fe91509 Update introduction.md
906b7c66b Update configuration.md
5ab6b3cdd Update documentation.md
26fb4bb4c Update documentation.md
e9e917f37 Update version refs
83ce07f24 netlify: Hugo 0.134.3
8cb32f802 Update front-matter.md
94d7f576a Update faq.md
fafc1d8d9 netlify: Hugo 0.134.2
bfe9cdc3d Update content-adapters.md
9e49ae3e1 Document ignoreLogs configuration setting
6b47a1d57 Update configuration.md
fd98a0372 Document CLI options that can be set in configuration
07c2400d8 Document alternative to Summary method
d053fa163 Update to reflect changes in v0.134.1
137dc3241 Update ContentWithoutSummary.md
e8f6427d9 netlify: Hugo 0.134.1

git-subtree-dir: docs
git-subtree-split: 159c843fd79e94a0f49bee74c272cd0cc4a848a2
2024-11-13 11:07:57 +01:00
Bjørn Erik Pedersen
3477d9fcec
Merge commit 'de0df119b5' 2024-11-13 11:07:57 +01:00
Andreas Deininger
e79ee0d516
markup/goldmark: Fix typo in error message 2024-11-13 10:12:26 +01:00
Joe Mooring
2b97a2a8bf markup/goldmark: Improve the raw HTML omitted warning
Closes #13023
2024-11-07 23:00:09 +02:00
hugoreleaser
35afe6fe2a releaser: Prepare repository for 0.139.0-DEV
[ci skip]
2024-11-06 11:36:12 +00:00
hugoreleaser
ad82998d54 releaser: Bump versions for release of 0.138.0
[ci skip]
2024-11-06 11:22:34 +00:00
Bjørn Erik Pedersen
95e2d5beb8 Fix concurrent map read and map write in short page lookups
Regression introduced in Hugo `v0.137.0`.

Fixes #13019
2024-11-06 12:17:30 +01:00
Bjørn Erik Pedersen
2c3efc8106 Alias Page.Scratch to Page.Store (note)
Fixes #13016
2024-11-06 09:49:23 +01:00
hugoreleaser
df8bd4af4f releaser: Prepare repository for 0.138.0-DEV
[ci skip]
2024-11-05 12:04:27 +00:00
hugoreleaser
17e15b2148 releaser: Bump versions for release of 0.137.1
[ci skip]
2024-11-05 11:49:09 +00:00
Bjørn Erik Pedersen
ca4fc587c3 common/hugo: Add withdeploy to the version string printed in hugo version 2024-11-05 11:40:42 +01:00
Bjørn Erik Pedersen
4faaaf9c2f markup: Goldmark log "Raw HTML omitted" warning also for inline HTML
Fixes #13013
2024-11-05 11:40:42 +01:00
Bjørn Erik Pedersen
94b46c36b4 build: Add missing withdeploy archive for Windows
Fixes #13009
2024-11-05 11:40:42 +01:00
Bjørn Erik Pedersen
2b0b3b8584 commands: Print the "deploy not available" error message even if flags provided
Fixes #13012
2024-11-05 11:40:42 +01:00
Joe Mooring
801035bb7a tpl/tplimpl: Create an embedded comment shortcode
Closes #13010
2024-11-04 21:05:07 +01:00
hugoreleaser
b7861e586e releaser: Prepare repository for 0.138.0-DEV
[ci skip]
2024-11-04 16:19:39 +00:00
hugoreleaser
59c1158135 releaser: Bump versions for release of 0.137.0
[ci skip]
2024-11-04 16:04:06 +00:00
Bjørn Erik Pedersen
fcdc454cc5 Do not watch directories with no mounted files in it
Fixes #12912
Fixes #13007
2024-11-04 12:44:07 +01:00
Bjørn Erik Pedersen
6cf23bf882 markup/goldmark: Only log Raw HTML omitted WARN on block entering
Updates #12997
2024-11-04 10:13:53 +01:00
Bjørn Erik Pedersen
62a96cef7f markup/goldmark: Add warning (using Warnidf) on Goldmark <!-- raw HTML omitted -->
Fixes #12997
2024-11-03 14:17:10 +01:00
Bjørn Erik Pedersen
30d9aea860 Fix stale pages on rebuilds in GetPage with short refs
Fixes #13004
2024-11-03 13:33:31 +01:00
Bjørn Erik Pedersen
1f23b4949c Fix some RenderShortcodes error cases
This issue fixes two cases where `{{__hugo_ctx` artifacts were left in the rendered output:

1. Inclusion when `.RenderShortcodes` is wrapped in HTML.
2. Inclusion of Markdown file without a trailing newline in some cases.

Closes #12854
Updates #12998
2024-11-03 13:33:31 +01:00
Joe Mooring
5fc1639035
Update README.md 2024-11-01 21:10:52 -07:00
Joe Mooring
889308dd85 resources: Address Dart Sass deprecation of global built-in functions
See https://github.com/sass/dart-sass/releases/tag/1.80.0

Fixes #12961
2024-11-01 14:05:27 +01:00
Joe Mooring
72352f205a github: Adjust test workflow to install Dart Sass v1.80.3 2024-11-01 13:37:45 +01:00
Bjørn Erik Pedersen
e3304db617 deps: Upgrade github.com/bep/godartsass/v2 v2.1.0 => v2.2.0 2024-11-01 12:37:55 +01:00
Bjørn Erik Pedersen
1ec6fa36c0
Update README.md 2024-11-01 10:16:05 +01:00
Bjørn Erik Pedersen
89bd025ebf Build without the deploy feature by default
Build tags setup changed to:

* !nodeploy => withdeploy
* nodeploy => !withdeploy

Also move the deploy feature out into its own release archives.

See #12994 for the primary motivation for this change. But this also greatly reduces the number of dependencies in Hugo when you don't need this feature and cuts the binary size greatly.

Fixes #12994
2024-10-30 11:46:40 +01:00
Bjørn Erik Pedersen
62567d3820 deps: Upgrade github.com/bep/lazycache v0.6.0 => v0.7.0 2024-10-27 12:43:36 +01:00
Bjørn Erik Pedersen
e10915f80a dynacache: Fix potential deadlocks on panics in GetOrCreate 2024-10-26 18:27:10 +02:00
hugoreleaser
ec3890affe releaser: Prepare repository for 0.137.0-DEV
[ci skip]
2024-10-24 12:41:02 +00:00
hugoreleaser
46cccb021b releaser: Bump versions for release of 0.136.5
[ci skip]
2024-10-24 12:26:27 +00:00
Bjørn Erik Pedersen
cb6e27b32a hugolib/commands: Fix stuck server error issues
Fixes #11378
2024-10-24 13:34:11 +02:00
Joe Mooring
5bbe95f9c5 tpl/transform: Revert unmarshal whitespace removal
Fixes #12977
2024-10-22 09:42:40 +02:00
hugoreleaser
31d19b505d releaser: Prepare repository for 0.137.0-DEV
[ci skip]
2024-10-21 13:46:41 +00:00
hugoreleaser
bfa2fd683e releaser: Bump versions for release of 0.136.3
[ci skip]
2024-10-21 13:31:54 +00:00
David Karlsson
88d598a049
docker: Fix permission issues in Dockerfile
Closes #12971
Closes #12970
2024-10-21 15:28:36 +02:00
Bjørn Erik Pedersen
352be5ba87 Make sure that HugoSites is always closed when done
Including all the integration tests.
2024-10-20 13:04:58 +02:00
Joe Mooring
d37606d2c2 tpl/strings: Add TrimSpace function
Closes #12962
2024-10-19 21:10:00 +02:00
Bjørn Erik Pedersen
f5e54d9c7d
common/herrors: Fix the deferred error message cleaner regexp
Make it less gready.
2024-10-19 10:00:01 +02:00
Bjørn Erik Pedersen
42f37b4e98
tpl/transform: Don't fail on "no data to transform"
Fixes #12964
2024-10-18 10:30:36 +02:00
hugoreleaser
e971b7d866 releaser: Prepare repository for 0.137.0-DEV
[ci skip]
2024-10-17 14:44:10 +00:00
hugoreleaser
ad985550a4 releaser: Bump versions for release of 0.136.2
[ci skip]
2024-10-17 14:30:05 +00:00
David Karlsson
b5852d0e68
docker: Fix Dart Sass ARM64 arch mismatch, /cache permissions
Also improve the final build step.

Closes #12956
Closes #12957
Closes #12960
2024-10-17 15:42:41 +02:00
hugoreleaser
b5801d8b6a releaser: Prepare repository for 0.137.0-DEV
[ci skip]
2024-10-16 16:18:44 +00:00
hugoreleaser
64d1865c1e releaser: Bump versions for release of 0.136.1
[ci skip]
2024-10-16 16:05:18 +00:00
Bjørn Erik Pedersen
e4ad0c5271 Never sanitize when url set in front matter
Fixes #12954
2024-10-16 18:01:11 +02:00
Bjørn Erik Pedersen
a2f666b586 Remove erroneously permalink validation
Fixes #12948
2024-10-16 10:14:48 +02:00
Joe Mooring
b1b3bbcdbd create/skeletons: Add delimiters to archetype front matter
Fixes #12945
2024-10-15 21:37:26 +02:00
hugoreleaser
1cfe9741b9 releaser: Prepare repository for 0.137.0-DEV
[ci skip]
2024-10-15 13:31:16 +00:00
hugoreleaser
2939270a3b releaser: Bump versions for release of 0.136.0
[ci skip]
2024-10-15 13:17:24 +00:00
Bjørn Erik Pedersen
5db27b19c1
circleci: Use default docker image 2024-10-15 15:15:12 +02:00
Bjørn Erik Pedersen
b7d62d76c5
docs: Regen CLI docs 2024-10-15 10:30:35 +02:00
Bjørn Erik Pedersen
6e1c5b61b3 resources/page: Adjust the permalinks colon implementation a little
Mostly to get back to an attribute regexp that's reasonably simle to read/understand.

Updates #12918
2024-10-15 10:28:00 +02:00
n1xx1
e7d0757f95 resources/page: Allow colons in permalinks to be escaped
Updates #12918
2024-10-15 10:28:00 +02:00
Rohan Hasabe
6b5e117a12 commands: Use consistent style when describing subcommands
Closes #12897

Change-Id: Ib27a4a7b540d45243e6252db769d4b9fb7447718
Signed-off-by: Rohan Hasabe <rohanhasabe8@gmail.com>
2024-10-15 08:51:53 +02:00
dependabot[bot]
4985be1a4a build(deps): bump github.com/tetratelabs/wazero from 1.8.0 to 1.8.1
Bumps [github.com/tetratelabs/wazero](https://github.com/tetratelabs/wazero) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/tetratelabs/wazero/releases)
- [Commits](https://github.com/tetratelabs/wazero/compare/v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/tetratelabs/wazero
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-14 15:54:41 +02:00
dependabot[bot]
db653a8485 build(deps): bump golang.org/x/image from 0.20.0 to 0.21.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.20.0 to 0.21.0.
- [Commits](https://github.com/golang/image/compare/v0.20.0...v0.21.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-14 14:53:06 +02:00
dependabot[bot]
05bbd2c515 build(deps): bump github.com/yuin/goldmark-emoji from 1.0.3 to 1.0.4
Bumps [github.com/yuin/goldmark-emoji](https://github.com/yuin/goldmark-emoji) from 1.0.3 to 1.0.4.
- [Release notes](https://github.com/yuin/goldmark-emoji/releases)
- [Commits](https://github.com/yuin/goldmark-emoji/compare/v1.0.3...v1.0.4)

---
updated-dependencies:
- dependency-name: github.com/yuin/goldmark-emoji
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-14 14:52:12 +02:00
Bjørn Erik Pedersen
21366e0411 config: Imrove uglyurls section test
Updates #12926
2024-10-14 10:03:44 +02:00
Akkuman
ea633dd809 config: Fix uglyurls map parse
Fixes #12926
2024-10-14 10:03:44 +02:00
Joe Mooring
57151a5e91 create/skeletons: Honor --format flag when creating default archetype
Closes #12666
2024-10-14 09:54:29 +02:00
Julia Evans
5bb22b6b4e hugolib: Make .Site.Author deprecation warning clearer
Fixes #12269
2024-10-14 09:16:11 +02:00
Bjørn Erik Pedersen
41f69a7255 Upgrade to latest Go version + Some Docker image improvements (note)
* Rename /site to /project
* Add ldflags
* Add go and node to the default image
* Add Dart Sass to the default image
* Build the extended version by default
* Add "npm i" install support with custom entry script override
* Adjust cache logic to speed up CGO rebuilds

Closes #12920
See #12885
2024-10-13 20:01:37 +02:00
David Karlsson
4a79956276 ci: Build multi-platform image with cross-compilation
The previous build workflow used emulation to build the Docker image,
which results in a somewhat complicated push-by-digest and merge
workflow to create a multi-platform image.

This commit changes the Docker build to use cross-compilation instead,
resulting in a faster and more straightforward build.

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-10-13 20:01:37 +02:00
Patrice Chalin
039845804f
tpl/tplimpl: Trim descriptions rather than just chomp 2024-10-12 22:41:42 +02:00
dependabot[bot]
9b635522e2 build(deps): bump golang.org/x/tools from 0.23.0 to 0.26.0
Bumps [golang.org/x/tools](https://github.com/golang/tools) from 0.23.0 to 0.26.0.
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](https://github.com/golang/tools/compare/v0.23.0...v0.26.0)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-11 15:41:03 +02:00
dependabot[bot]
3223a65c9b build(deps): bump github.com/rogpeppe/go-internal from 1.12.0 to 1.13.1
Bumps [github.com/rogpeppe/go-internal](https://github.com/rogpeppe/go-internal) from 1.12.0 to 1.13.1.
- [Release notes](https://github.com/rogpeppe/go-internal/releases)
- [Commits](https://github.com/rogpeppe/go-internal/compare/v1.12.0...v1.13.1)

---
updated-dependencies:
- dependency-name: github.com/rogpeppe/go-internal
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-11 15:39:22 +02:00
dependabot[bot]
bc6fc47727 build(deps): bump github.com/evanw/esbuild from 0.23.1 to 0.24.0
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.23.1 to 0.24.0.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.23.1...v0.24.0)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-11 15:36:02 +02:00
dependabot[bot]
ffb41d1111 build(deps): bump github.com/hairyhenderson/go-codeowners
Bumps [github.com/hairyhenderson/go-codeowners](https://github.com/hairyhenderson/go-codeowners) from 0.5.0 to 0.6.0.
- [Release notes](https://github.com/hairyhenderson/go-codeowners/releases)
- [Changelog](https://github.com/hairyhenderson/go-codeowners/blob/main/CHANGELOG.md)
- [Commits](https://github.com/hairyhenderson/go-codeowners/compare/v0.5.0...v0.6.0)

---
updated-dependencies:
- dependency-name: github.com/hairyhenderson/go-codeowners
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-09 10:34:59 +02:00
Joe Mooring
5b0b663ec3 tailwind: Pin Tailwind 4 test to alpha 26 or later 2024-10-06 22:15:17 +02:00
Joe Mooring
3f68309148 resources/page: Treat null dates as zero dates
Closes #12906
2024-10-06 20:35:25 +02:00
Joe Mooring
ab03588db9 resources/page: Improve front matter date validation
Improve the error message and treat empty strings as zero dates.

Closes #12898
2024-10-05 15:29:57 +02:00
Bjørn Erik Pedersen
0450d69fc6 commands: Add "hugo build" as an alias for "hugo"
Closes #11391
2024-09-30 10:36:29 +02:00
Joe Mooring
1158e63072 markup/goldmark: Change default cell alignment in table render hook
Change the default table cell alignment from "left" to an empty string.

Closes #12886
2024-09-30 08:44:14 +02:00
Joe Mooring
d1ba52f3c3 tests: Address deprecation warnings and errors 2024-09-29 10:49:26 +02:00
hugoreleaser
d0dca65625 releaser: Prepare repository for 0.136.0-DEV
[ci skip]
2024-09-27 13:32:22 +00:00
hugoreleaser
f30603c47f releaser: Bump versions for release of 0.135.0
[ci skip]
2024-09-27 13:17:08 +00:00
dependabot[bot]
12c9ce34bb build(deps): bump golang.org/x/mod from 0.19.0 to 0.21.0
Bumps [golang.org/x/mod](https://github.com/golang/mod) from 0.19.0 to 0.21.0.
- [Commits](https://github.com/golang/mod/compare/v0.19.0...v0.21.0)

---
updated-dependencies:
- dependency-name: golang.org/x/mod
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-27 14:03:14 +02:00
dependabot[bot]
47b055589c build(deps): bump github.com/bep/helpers from 0.4.0 to 0.5.0
Bumps [github.com/bep/helpers](https://github.com/bep/helpers) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/bep/helpers/releases)
- [Commits](https://github.com/bep/helpers/compare/v0.4.0...v0.5.0)

---
updated-dependencies:
- dependency-name: github.com/bep/helpers
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-27 12:24:02 +02:00
dependabot[bot]
e56ea40666 build(deps): bump golang.org/x/net from 0.28.0 to 0.29.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.28.0 to 0.29.0.
- [Commits](https://github.com/golang/net/compare/v0.28.0...v0.29.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-27 12:22:52 +02:00
Joe Mooring
4c02a52f7c resources/page: Validate predefined front matter dates
Closes #10717
2024-09-27 11:19:27 +02:00
dependabot[bot]
578442f892 build(deps): bump golang.org/x/image from 0.19.0 to 0.20.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.19.0 to 0.20.0.
- [Commits](https://github.com/golang/image/compare/v0.19.0...v0.20.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-27 11:07:23 +02:00
Bjørn Erik Pedersen
0d390d7eb8
github: Trigger image workflow on release.published
Updates #12753
2024-09-27 10:59:45 +02:00
Bjørn Erik Pedersen
da72ac2db9
tailwind: Pin Tailwind 4 test to alpha 24
See #12880
2024-09-27 10:36:25 +02:00
Joe Mooring
0ea796dad1 tpl/compare: Use any data type for compare.Conditional condition
Improves #5792
2024-09-22 16:53:11 +02:00
Khayyam Saleem
1e690c0f23 deps: Upgrade github.com/gobuffalo/flect v1.0.2 => v1.0.3
Closes #12827
2024-09-21 19:10:34 +02:00
hugoreleaser
a619deec18 releaser: Prepare repository for 0.135.0-DEV
[ci skip]
2024-09-19 14:42:46 +00:00
hugoreleaser
5fb333b9f5 releaser: Bump versions for release of 0.134.3
[ci skip]
2024-09-19 14:28:20 +00:00
Bjørn Erik Pedersen
e07028cb90 tpl: Remove RSS deprecation site.Author check
The check itself creates a warning which I guess was not intended.

We could possibly make that work, but it has been deprecated since Hugo 0.98, so just remove the usage.
2024-09-19 13:39:40 +02:00
Bjørn Erik Pedersen
22a9f3fc98 modules: Improve console output on hugo mod init
Replace some of the stderr output from the Go command to match the Hugo commands needed:

```
go: creating new go.mod: module github.com/bep/foo
hugo: to add module requirements and sums:
hugo mod tidy
```

See #11458
2024-09-19 12:26:04 +02:00
Bjørn Erik Pedersen
e363964f2f commands: Ignore "module does not exist" errors in hugo mod init
Closes #11458
2024-09-19 12:26:04 +02:00
David Else
c260cb28a9
Add exclusion for helix .bck files
Updates #12677
2024-09-18 10:53:18 +02:00
Bjørn Erik Pedersen
e079145373
hugolib: Move hugolib/site_new.go into hugolib/site.go 2024-09-17 10:15:14 +02:00
Joe Mooring
5b442b3cce libsass: Resolve directory paths to directory index files
Closes #12851
2024-09-16 09:34:14 +02:00
Joe Mooring
2bc27657d8 dartsass: Resolve directory paths to directory index files
Closes #12849
2024-09-15 20:32:11 +02:00
Bjørn Erik Pedersen
28f621d4a7 internal/warpc: Improve the JS plugin API
* Move the error handling into commons and make sure the error returned also returns message errors
* Make the protocol version an int so it can be more easily compared
2024-09-12 13:51:37 +02:00
hugoreleaser
fe7e137e28 releaser: Prepare repository for 0.135.0-DEV
[ci skip]
2024-09-10 11:00:15 +00:00
hugoreleaser
1c74abd260 releaser: Bump versions for release of 0.134.2
[ci skip]
2024-09-10 10:46:33 +00:00
Bjørn Erik Pedersen
3d6baedaec Don't count HTML markup in auto summaries
This commit also fixes a bug where a `</picture>` end tag was wrongly used to detect a end paragraph. This should be very rare, though.

Closes #12837
2024-09-10 11:03:47 +02:00
hugoreleaser
84ee00bbc2 releaser: Prepare repository for 0.135.0-DEV
[ci skip]
2024-09-05 10:32:40 +00:00
hugoreleaser
2f89169baa releaser: Bump versions for release of 0.134.1
[ci skip]
2024-09-05 10:17:50 +00:00
Bjørn Erik Pedersen
66a3a11001 Fix stray end p tag in Obsidian callout titles
Also remove test references to deprecated funcs now in ERROR.

Closes #12828
2024-09-05 12:12:24 +02:00
Bjørn Erik Pedersen
8f2eac0195 Make ContentWithoutSummary return Content when summary is fetched from front matter
Fixes #12822
2024-09-05 12:12:24 +02:00
Bjørn Erik Pedersen
b570a5f118
Merge commit '39fd3b5570' 2024-09-04 18:57:34 +02:00
Bjørn Erik Pedersen
39fd3b5570 Squashed 'docs/' changes from a49697e53..ccb1b97cb
ccb1b97cb Update blockquotes.md
a5f51431c Add new-in label
39dac5838 Document ContentWithoutSummary
de3c75694 Clarify blockquote render hook Markdown syntax
d32f7856d Document change to data type returned by render hook Text methods
83fe7ccc3 Document table render hooks
601234147 netlify: Hugo 0.134.0
a583640a0 Add support for Obsidian type blockquote alerts
3e0080861 Merge commit 'dec8cd4ada'
2dde06576 output: Fix docshelper template lookup order for AMP pages

git-subtree-dir: docs
git-subtree-split: ccb1b97cbb11e60aab0108b33a270cccdd2218f6
2024-09-04 18:52:05 +02:00
hugoreleaser
aacff7aff4 releaser: Prepare repository for 0.135.0-DEV
[ci skip]
2024-09-03 10:14:44 +00:00
hugoreleaser
77df7bbbff releaser: Bump versions for release of 0.134.0
[ci skip]
2024-09-03 09:54:22 +00:00
Aymen Rachdi
ae3815898f Update Dockerfile 2024-09-02 21:56:33 +02:00
Bjørn Erik Pedersen
504a23184f
markup/goldmark/blockquotes: Improve some tests 2024-09-01 18:25:10 +02:00
Bjørn Erik Pedersen
e651d29801 Add support for Obsidian type blockquote alerts
* Make the alert type parsing more flexible to support more types
* Add `AlertTitle` and `AlertSign` (for folding)

Note that GitHub will not render callouts with alert title/sign.

See https://help.obsidian.md/Editing+and+formatting/Callouts

Closes #12805
Closes #12801
2024-09-01 18:12:26 +02:00
Bjørn Erik Pedersen
dec8cd4ada Squashed 'docs/' changes from fcc3ed651..a49697e53
a49697e53 Add private use subtag requirements to multilingual page
a5c6bb4da Add INFINI Pizza search engine
45b732efa Fix template lookup order for AMP pages
30c672d0b netlify: Hugo 0.133.1
7c766e724 Update page resources documentation
ca802fbec Document how to enable AsciiDoc syntax highlighting
c3350f4cf Update definition of falsy to include zero time.Time values
b0e5ab051 Fir typo
60f6cb63b Update migrations.md
ec52c7ba1 Improve formatting of example code
e5681ad01 Improve formatting of example code
bdf3ffc73 Clarify the various next/prev methods
b5505d22a Clarify template lookup order for shortcodes
cf8dd7034 Improve embedded.md
e5dee2651 Update transform.ToMath
4d419a128 Update pagination configuration to use new struct
05d4fd597 Update PrevInSection.md
fd33370ed Add new-in 0.133.0
f9062042f Add the new page config section
205645e97 Remove out-dated  new-in
3ed3673f7 Fix typo
41df91659 Document the 'else with' construct introduced with Go 1.23
9c4697ab3 netlify: Hugo 0.133.0
62506b052 Merge branch 'temp133'
877e1bfcd Add config options page.nextPrevSortOrder/nextPrevInSectionSortOrder
eb159fe62 Update menu.md
efa7795a0 Update theme
dbe8911ad netlify: Hugo 0.132.2
2f793d328 Document passthrough render hooks
a7ce9a5e8 netlify: Hugo 0.132.1
2c137cb48 Update blockquotes.md
e0fa2f0d1 Add new-in badge to blockquote render hook page
bf42bbe6b Update references to render hooks
85a3d9958 Update theme
2dae72128 Document blockquote render hooks
8f5afb55d Update plainify return type
160f22d0e netlify: Hugo 0.132.0
82b5586fb Document transform.ToMath
1efcbcddb tpl/transform: Make Plainify and ToMath return template.HTML
31727be2e docs: Regen docshelper
88a421426 Merge commit 'a6e635ca7d'

git-subtree-dir: docs
git-subtree-split: a49697e536ee0d477ab4e552cfa8dc74debeff27
2024-09-01 14:51:15 +02:00
Bjørn Erik Pedersen
0c453420e6
Merge commit 'dec8cd4ada' 2024-09-01 14:51:15 +02:00
Bjørn Erik Pedersen
469124823c
Rename hstring.RenderedHTML => hstring.HTML
And add a comment about why it exists.
2024-09-01 10:04:20 +02:00
Bjørn Erik Pedersen
96afea4acc github: Try to fix "no space left on device" on MacOS 2024-08-31 21:05:58 +02:00
Bjørn Erik Pedersen
6d97ee711e Make all renderhook Text methods return template.HTML 2024-08-31 21:05:58 +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
Joe Mooring
b63f24adc7 create/skeletons: Clean up lang attribute in base template 2024-08-31 17:02:47 +02:00
Andreas Deininger
8fb933550f Fix deprecation warning for resources.ToCSS 2024-08-30 22:26:29 +02:00
Joe Mooring
a3684c8361 tpl/resources: Improve resources.Concat error message
Closes #7428
2024-08-30 08:39:29 +02:00
Patrice Chalin
53a8de21b8
tpl: Trim whitespace from google_analytics.html 2024-08-29 21:32:46 +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
2b5c335e93 deps: Upgrade github.com/bep/golibsass v1.1.1 => v1.2.0
Fixes #12649
2024-08-28 17:02:19 +02:00
dependabot[bot]
12a28ef773 build(deps): bump github.com/evanw/esbuild from 0.23.0 to 0.23.1
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.23.0 to 0.23.1.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.23.0...v0.23.1)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-28 13:05:57 +02:00
dependabot[bot]
4ded32d077 build(deps): bump github.com/pelletier/go-toml/v2 from 2.2.2 to 2.2.3
Bumps [github.com/pelletier/go-toml/v2](https://github.com/pelletier/go-toml) from 2.2.2 to 2.2.3.
- [Release notes](https://github.com/pelletier/go-toml/releases)
- [Changelog](https://github.com/pelletier/go-toml/blob/v2/.goreleaser.yaml)
- [Commits](https://github.com/pelletier/go-toml/compare/v2.2.2...v2.2.3)

---
updated-dependencies:
- dependency-name: github.com/pelletier/go-toml/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-28 13:05:42 +02:00
Joe Mooring
1ecd0596a3 output: Fix docshelper template lookup order for AMP pages
Fixes #12797
2024-08-28 13:05:28 +02:00
Bjørn Erik Pedersen
371246de25
hugolib: Add a test for overriding _internal templates 2024-08-28 08:17:16 +02:00
hugoreleaser
aa0f66b290 releaser: Prepare repository for 0.134.0-DEV
[ci skip]
2024-08-26 14:13:52 +00:00
hugoreleaser
47d00202e7 releaser: Bump versions for release of 0.133.1
[ci skip]
2024-08-26 13:58:46 +00:00
Bjørn Erik Pedersen
261d7a03ae
Revert "Adjust Circleci workflow to make the Docker images build"
This reverts commit 445283a593.
2024-08-26 15:56:39 +02:00
Bjørn Erik Pedersen
445283a593 Adjust Circleci workflow to make the Docker images build
Closes #12753
2024-08-26 14:19:22 +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
e1becf1dfe
deps: Upgraded github.com/bep/imagemeta v0.8.0 => v0.8.1
Closes #12793
2024-08-24 18:52:03 +02:00
Joe Mooring
7792392a6f config: Fix pagination deprecation messages 2024-08-21 22:01:59 +02:00
Bjørn Erik Pedersen
46484bff84
Revert "releaser: Rework the run conditions"
This reverts commit 702b1e8b81.
2024-08-18 19:12:03 +02:00
Bjørn Erik Pedersen
0e5a26057c
Revert "circleci: Upgrade to version 2.1 of the schema"
This reverts commit c8f850ae17.
2024-08-18 19:12:02 +02:00
Bjørn Erik Pedersen
c8f850ae17
circleci: Upgrade to version 2.1 of the schema
Updates #12753
2024-08-18 18:49:42 +02:00
Bjørn Erik Pedersen
702b1e8b81 releaser: Rework the run conditions
Now after actually reading the CircleCI docs...

Closes #12753
2024-08-18 18:46:56 +02:00
Bjørn Erik Pedersen
73d32e7737
Revert "releaser: Rework the run conditions"
This reverts commit 777534b2a4.

Circle ci throws validation errors:

```
Config does not conform to schema: {:workflows {:release {:jobs [{:prepare_release (not (map? nil)), :when {:and disallowed-key}} nil nil nil]}}}
```
2024-08-18 12:00:47 +02:00
Bjørn Erik Pedersen
777534b2a4
releaser: Rework the run conditions
Closes #12753
2024-08-18 11:47:51 +02:00
hugoreleaser
c054cba042 releaser: Prepare repository for 0.134.0-DEV
[ci skip]
2024-08-17 20:11:05 +00:00
hugoreleaser
c9777473d1 releaser: Bump versions for release of 0.133.0
[ci skip]
2024-08-17 19:57:41 +00:00
Bjørn Erik Pedersen
01008ba512 Add config options page.nextPrevSortOrder/nextPrevInSectionSortOrder
See #12776
2024-08-17 16:47:50 +02:00
dependabot[bot]
53c0ddfcb4 build(deps): bump gocloud.dev from 0.38.0 to 0.39.0
Bumps [gocloud.dev](https://github.com/google/go-cloud) from 0.38.0 to 0.39.0.
- [Release notes](https://github.com/google/go-cloud/releases)
- [Commits](https://github.com/google/go-cloud/compare/v0.38.0...v0.39.0)

---
updated-dependencies:
- dependency-name: gocloud.dev
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-15 12:14:59 +02:00
Bjørn Erik Pedersen
133eeafeb4 deps: Upgrade github.com/tetratelabs/wazero v1.7.4-0.20240805170331-2b12e189eeec => v1.8.0 2024-08-15 12:14:49 +02:00
Bjørn Erik Pedersen
2168c5b125 Upgrade to Go 1.23
Fixes #12763
2024-08-15 10:18:19 +02:00
hugoreleaser
b3ad58fa04 releaser: Prepare repository for 0.133.0-DEV
[ci skip]
2024-08-14 16:31:14 +00:00
hugoreleaser
3fd26c70df releaser: Bump versions for release of 0.132.2
[ci skip]
2024-08-14 16:17:21 +00:00
Bjørn Erik Pedersen
d72607adb9 markup/goldmark/blockquotes: Fix handling of lower/mixed case GitHub alerts
Fixes #12767
2024-08-14 18:09:04 +02:00
Bjørn Erik Pedersen
83235262d0 tpl/transform: Don't run ToMath tests in parallel
Closes #12765
2024-08-14 16:58:49 +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
b2d4f67a88
loggers: Omit map nil check 2024-08-13 20:10:43 +02:00
Bjørn Erik Pedersen
a99716bf04
github: Add workflow_dispatch to the Docker workflow
Closes #12753
2024-08-13 16:28:33 +02:00
Bjørn Erik Pedersen
98aa53648a
github: Simplify Docker workflow / only trigger on new tags
See #12753
2024-08-13 16:17:56 +02:00
Bjørn Erik Pedersen
9231a7f110
github: Simplify Docker workflow
See #12753
2024-08-13 16:16:45 +02:00
hugoreleaser
736e8a4d08 releaser: Prepare repository for 0.133.0-DEV
[ci skip]
2024-08-13 10:24:54 +00:00
hugoreleaser
1bde700dfc releaser: Bump versions for release of 0.132.1
[ci skip]
2024-08-13 10:10:10 +00:00
Bjørn Erik Pedersen
77304a3cd3 github: Adjust image workflow
See #12753
2024-08-13 12:06:26 +02:00
Bjørn Erik Pedersen
bef9214e11 Fix nilpointer regression with empty blockquotes
Fixes #12756
2024-08-13 11:46:25 +02:00
hugoreleaser
caa90e6a12 releaser: Prepare repository for 0.133.0-DEV
[ci skip]
2024-08-12 15:36:03 +00:00
hugoreleaser
005e895a38 releaser: Bump versions for release of 0.132.0
[ci skip]
2024-08-12 15:21:36 +00:00
Bjørn Erik Pedersen
2192cf7ec1
internal/warpc: Add license headers 2024-08-12 15:50:29 +02:00
Bjørn Erik Pedersen
e1e1baa1bd Improve Katex error handling and fix handling of large expressions
* Make throwOnError=true the new default
* Handle JS errors as part of the RPC request/response flow
* Return a new Result type with .Err on it

This enables constructs on the form:

```handlebars
{{ with transform.ToMath "c = \\foo{a^2 + b^2}" }}
	{{ with .Err }}
	 	{{ warnf "error: %s" . }}
	{{ else }}
		{{ . }}
	{{ end }}
{{ end }}
```

Note that the new `Result` type behaves like `template.HTML` (or a string if needed) when printed, but it will panic if in a error state.

Closes #12748
2024-08-12 13:50:18 +02:00
Bjørn Erik Pedersen
e42263529c
Add katex option ThrowOnError
As an internal option for now. Katex misbehaves in error situations without a value set.
2024-08-11 20:57:15 +02:00
Bjørn Erik Pedersen
891aa00fe1 Add some more KaTeX options
And fix the options handling.

Closes #12745
Fixes #12746
2024-08-11 19:03:27 +02:00
Bjørn Erik Pedersen
946e6af0bb tpl/transform: Make Plainify and ToMath return template.HTML
None of these are useful as plain strings in the templates, which forces the users to do `transform.Plainify "foo" | safeHTML`.

If people have trust issues with the output of these functions, they need to just stop using them.

Closes #8732
2024-08-11 15:16:16 +02:00
Bjørn Erik Pedersen
5d84f64759 deps: Upgrade github.com/bep/imagemeta v0.7.6 => v0.8.0
Fixes #12741
2024-08-10 14:00:43 +02:00
Bjørn Erik Pedersen
fbfccb394b Fix compare of uints and ints in eq, gt etc.
Fixes #12733
2024-08-10 14:00:21 +02:00
Bjørn Erik Pedersen
ef2e30eca3
docs: Regen docshelper 2024-08-09 19:34:13 +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
0c3a1c7288
github: Turn off the image workflow for pull request
We need to fix it so it does not publish anything to the remote repo before we can enable that.
2024-08-09 16:47:17 +02:00
Bjørn Erik Pedersen
ceed812458 github: Update image actions versions and some adjustments
Co-authored-by: morre <morre@mor.re>
2024-08-09 16:26:22 +02:00
Morre
b08de70cca github: Build and publish Docker image on release
Fixes #10760
2024-08-09 16:26:22 +02:00
Bjørn Erik Pedersen
a6e635ca7d Squashed 'docs/' changes from 9b06f951e..fcc3ed651
fcc3ed651 Remove some expired new-in
a9c5981f5 Fix cascade example
82bb250fa Add some lines about permalinks tokens in front matter
328fe564e Remove some outdated new-in
fb140b153 Hide showcase menu entry
42d9d1c79 Update image formats from which EXIF data can be extracted
09ad56b6e netlify: Hugo 0.130.0
1d503f846 Merge branch 'tempv0.130.0'
e2458074d math: Add trigonometric functions and some angle helper functions
392afc8f9 Disable the showcase section for now
0300750f2 Improve example of image render hook
60a9306af Improve description of the .Site.RegularPages method
8d759175d Fix typos
55daa4554 Update XxHash.md
397c81cb7 Add namespace for hash functions
70fe8d2f0 netlify: Bump Hugo 0.129.0
5a9771aff Merge branch 'tempv0.129.0'
f9146575b Fix typo
e6e1fea49 Fix typo in Hugo docs | functions | partial
732d10ec4 source: Expose GitInfo Body
34c97e639 netlify: Hugo 0.128.2
3270587e9 Fix typo
727c5396e netlify: Hugo 0.128.1
80b6ae99c Update GitHub Pages workflow file example
027134102 Update GitHub Pages workflow file example
2600a8a2e Miscellaneous edits
3fdd5819b Update Build.md
7764005c3 Improve example of render hook directory structure
5e3941d82 Fix typos
748bf065f Restructure templates section
fafbf6566 Update Defer.md
012162e0d Document changes to template functions in v0.128.0
0990ce35b quick-reference: Update emojis
6677a30ef Update Goldmark configuration documentation
4449d530d Document new pagination config
0af8be439 Update Defer.md
56348196d netlify: Hugo 0.128.0
d67b6d82e Update content/en/functions/templates/Defer.md
23d996b3d Update content/en/functions/templates/Defer.md
7f7fb2f27 Document templates.Defer
5ada1e9d5 Fix docs merge (remove shortcode)
d27ee6156 Merge branch 'tempv0.128.0'
5d7317c84 Fix typo
7c18ee546 Update theme
83bfea63b Update theme
b274b3238 Merge commit '8b9803425e'
ff34a035a deploy: Add stripIndexHtml target option
d9e964bdb markup/goldmark: Add the Hugo Goldmark Extras "delete" extension
ac5bd16d2 deps: Upgrade github.com/alecthomas/chroma v2.13.0 => v2.14.0
25377171b config: Remove extraneous BuildConfig setting
0d2044f6d docs: Regen docshelper
a2548dac9 markup/goldmark: Support extras extension
9d0c86ee8 commands: Add gen chromastyles --lineNumbersTableStyle flag

git-subtree-dir: docs
git-subtree-split: fcc3ed651a1b6431303c2f88f20fa38531c52b3d
2024-08-09 15:17:43 +02:00
Bjørn Erik Pedersen
e99eba39e7
Merge commit 'a6e635ca7d' 2024-08-09 15:17:43 +02:00
Bjørn Erik Pedersen
dbff48e6c3 github: Update GitHub actions versions 2024-08-09 11:17:24 +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
4c162deb03 markup/goldmark/codeblocks: Simplify codeblcok hook code 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
dependabot[bot]
1781b18427 build(deps): bump golang.org/x/net from 0.27.0 to 0.28.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.27.0 to 0.28.0.
- [Commits](https://github.com/golang/net/compare/v0.27.0...v0.28.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-07 12:26:01 +02:00
dependabot[bot]
d6d9dddff3 build(deps): bump golang.org/x/image from 0.18.0 to 0.19.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.18.0 to 0.19.0.
- [Commits](https://github.com/golang/image/compare/v0.18.0...v0.19.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-07 11:14:31 +02:00
Bjørn Erik Pedersen
10891f305e tpl/cast: Improve float
Make it support the new upstream rational number type in Exif.

See #12718
2024-08-06 22:26:43 +02:00
Bjørn Erik Pedersen
c07e94fa6d
Skip TestEchoParam
Is deprecated, will be remvoved soon.
2024-08-06 19:13:35 +02:00
dependabot[bot]
8f8d12ab2f
build(deps): bump github.com/bep/imagemeta from 0.7.5 to 0.7.6 (#12720)
Bumps [github.com/bep/imagemeta](https://github.com/bep/imagemeta) from 0.7.5 to 0.7.6.
- [Release notes](https://github.com/bep/imagemeta/releases)
- [Commits](https://github.com/bep/imagemeta/compare/v0.7.5...v0.7.6)

---
updated-dependencies:
- dependency-name: github.com/bep/imagemeta
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Closes #12718
2024-08-06 12:05:52 +02:00
Bjørn Erik Pedersen
69455fa422
Fix deprecation errors 2024-08-05 19:23:53 +02:00
hugoreleaser
2fcc53780f releaser: Prepare repository for 0.132.0-DEV
[ci skip]
2024-08-02 09:18:21 +00:00
hugoreleaser
bfbee17932 releaser: Bump versions for release of 0.131.0
[ci skip]
2024-08-02 09:03:48 +00:00
Bjørn Erik Pedersen
944fcc216f Fix images.AutoOrient regression
Broken in v0.130.0. Added a integration test to avoid future breakage.

Fixes #12712
2024-08-02 10:36:06 +02:00
n1xx1
914fa13efd revamp pagegroup tests with quicktest 2024-08-02 10:03:20 +02:00
n1xx1
51f09b17fd allow nested params when using Pages.GroupByParam and Pages.GroupByParamDate 2024-08-02 10:03:20 +02:00
dependabot[bot]
be643580dd build(deps): bump github.com/bep/godartsass/v2 from 2.0.0 to 2.1.0
Bumps [github.com/bep/godartsass/v2](https://github.com/bep/godartsass) from 2.0.0 to 2.1.0.
- [Release notes](https://github.com/bep/godartsass/releases)
- [Commits](https://github.com/bep/godartsass/compare/v2.0.0...v2.1.0)

---
updated-dependencies:
- dependency-name: github.com/bep/godartsass/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-02 00:36:13 +02:00
dependabot[bot]
20e4dd2ee3 build(deps): bump google.golang.org/api from 0.152.0 to 0.189.0
Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.152.0 to 0.189.0.
- [Release notes](https://github.com/googleapis/google-api-go-client/releases)
- [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.152.0...v0.189.0)

---
updated-dependencies:
- dependency-name: google.golang.org/api
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 19:57:38 +02:00
dependabot[bot]
f41149979a build(deps): bump github.com/spf13/cobra from 1.8.0 to 1.8.1
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](https://github.com/spf13/cobra/compare/v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 16:34:22 +02:00
dependabot[bot]
47fee839f6 build(deps): bump gocloud.dev from 0.36.0 to 0.38.0
Bumps [gocloud.dev](https://github.com/google/go-cloud) from 0.36.0 to 0.38.0.
- [Release notes](https://github.com/google/go-cloud/releases)
- [Commits](https://github.com/google/go-cloud/compare/v0.36.0...v0.38.0)

---
updated-dependencies:
- dependency-name: gocloud.dev
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 16:33:35 +02:00
dependabot[bot]
99665ef227 build(deps): bump github.com/gorilla/websocket from 1.5.1 to 1.5.3
Bumps [github.com/gorilla/websocket](https://github.com/gorilla/websocket) from 1.5.1 to 1.5.3.
- [Release notes](https://github.com/gorilla/websocket/releases)
- [Commits](https://github.com/gorilla/websocket/compare/v1.5.1...v1.5.3)

---
updated-dependencies:
- dependency-name: github.com/gorilla/websocket
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 16:32:47 +02:00
dependabot[bot]
eb2eeee687 build(deps): bump github.com/kyokomi/emoji/v2 from 2.2.12 to 2.2.13
Bumps [github.com/kyokomi/emoji/v2](https://github.com/kyokomi/emoji) from 2.2.12 to 2.2.13.
- [Release notes](https://github.com/kyokomi/emoji/releases)
- [Commits](https://github.com/kyokomi/emoji/compare/v2.2.12...v2.2.13)

---
updated-dependencies:
- dependency-name: github.com/kyokomi/emoji/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 16:31:38 +02:00
Bjørn Erik Pedersen
bea5a46de4 deps: Upgrade github.com/hairyhenderson/go-codeowners v0.4.0 => v0.5.0 2024-08-01 14:46:54 +02:00
dependabot[bot]
f1a7f3d01a build(deps): bump github.com/fatih/color from 1.16.0 to 1.17.0
Bumps [github.com/fatih/color](https://github.com/fatih/color) from 1.16.0 to 1.17.0.
- [Release notes](https://github.com/fatih/color/releases)
- [Commits](https://github.com/fatih/color/compare/v1.16.0...v1.17.0)

---
updated-dependencies:
- dependency-name: github.com/fatih/color
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 14:46:13 +02:00
dependabot[bot]
08243be1d2 build(deps): bump github.com/evanw/esbuild from 0.21.4 to 0.23.0
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.21.4 to 0.23.0.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/main/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.21.4...v0.23.0)

---
updated-dependencies:
- dependency-name: github.com/evanw/esbuild
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 13:43:28 +02:00
dependabot[bot]
0490a8a162 build(deps): bump github.com/tdewolff/minify/v2 from 2.20.36 to 2.20.37
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.20.36 to 2.20.37.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.20.36...v2.20.37)

---
updated-dependencies:
- dependency-name: github.com/tdewolff/minify/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-08-01 13:14:38 +02:00
Bjørn Erik Pedersen
d795cacd71
Revert "deps: Set toolchain go1.21.0 in go.mod"
This reverts commit 78c9a18b0c.
2024-08-01 13:04:29 +02:00
Bjørn Erik Pedersen
a5db76fe62
Run go mod tidy 2024-08-01 12:22:27 +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
92573012e8 Bump to go 1.21 in go.mod 2024-08-01 12:07:27 +02:00
Bjørn Erik Pedersen
071f8b4466 tpl: Sync Go template packages with the Go 1.22.5 source 2024-08-01 12:07:27 +02:00
Bjørn Erik Pedersen
ae9d5e7d83 Upgrade to Go 1.22.5 2024-08-01 12:07:27 +02:00
Bjørn Erik Pedersen
78c9a18b0c deps: Set toolchain go1.21.0 in go.mod
To hopefully resolve dependabot issues.
2024-07-31 19:47:41 +02:00
Bjørn Erik Pedersen
79aa2ab618 deps: Upgrade golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d => v0.23.0
Main motivation is to try to get dependabot running again.
2024-07-31 18:52:13 +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
d5eda13cb2 Replace the MD5 hashing of images with xxHash
Note that we only use this for change detection.

The previous implementation invoked `MD5FromReaderFast` that created a MD5 has from 8 64 bytes chunks in the file, which is obviously very fast. The new implementation creates the hash from the entire file and ... seems to be even more effective:

```
name          old time/op    new time/op    delta
HashImage-10    9.45µs ±21%   10.89µs ± 1%     ~     (p=0.343 n=4+4)

name          old alloc/op   new alloc/op   delta
HashImage-10      144B ± 0%        8B ± 0%  -94.44%  (p=0.029 n=4+4)

name          old allocs/op  new allocs/op  delta
HashImage-10      4.00 ± 0%      1.00 ± 0%  -75.00%  (p=0.029 n=4+4)
```
2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
8b5d796989 resources: Add BenchmarkHashImage 2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
c9d7577cb4 deps: Replace github.com/mitchellh/hashstructure/v2 with github.com/gohugoio/hashstructure
The old repo is archived and no longer maintained.

See #11644
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
78db8aebca identity: Upgrade to github.com/mitchellh/hashstructure/v2 v2.0.2
```
name                 old time/op    new time/op    delta
HashString/n28-10       131ns ± 7%     133ns ±19%   ~     (p=0.343 n=4+4)
HashString/n112-10      237ns ± 5%     241ns ± 3%   ~     (p=0.229 n=4+4)
HashString/n448-10      688ns ± 3%     687ns ± 1%   ~     (p=0.886 n=4+4)
HashString/n1792-10    2.51µs ± 3%    2.56µs ± 3%   ~     (p=0.200 n=4+4)
HashString/n7168-10    10.1µs ± 2%    10.0µs ± 4%   ~     (p=0.686 n=4+4)

name                 old alloc/op   new alloc/op   delta
HashString/n28-10       80.0B ± 0%     80.0B ± 0%   ~     (all equal)
HashString/n112-10       160B ± 0%      160B ± 0%   ~     (all equal)
HashString/n448-10       496B ± 0%      496B ± 0%   ~     (all equal)
HashString/n1792-10    1.84kB ± 0%    1.84kB ± 0%   ~     (all equal)
HashString/n7168-10    8.24kB ± 0%    8.24kB ± 0%   ~     (all equal)

name                 old allocs/op  new allocs/op  delta
HashString/n28-10        4.00 ± 0%      4.00 ± 0%   ~     (all equal)
HashString/n112-10       4.00 ± 0%      4.00 ± 0%   ~     (all equal)
HashString/n448-10       4.00 ± 0%      4.00 ± 0%   ~     (all equal)
HashString/n1792-10      4.00 ± 0%      4.00 ± 0%   ~     (all equal)
HashString/n7168-10      4.00 ± 0%      4.00 ± 0%   ~     (all equal)
```

Closes #11644
2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
3140e0b994 identity: Add BenchmarkHashString 2024-07-31 16:44:06 +02:00
Bjørn Erik Pedersen
9989404d97 deps: Upgrade github.com/bep/imagemeta v0.7.4 => v0.7.5 2024-07-31 15:35:18 +02:00
Bjørn Erik Pedersen
b81ba2a0f0 deps: Upgrade github.com/aws/aws-sdk-go-v2 v1.26.1 => v1.30.3 2024-07-31 14:22:20 +02:00
Bjørn Erik Pedersen
afdd87db59 deps: Upgrade to github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.7.0 2024-07-31 12:53:27 +02:00
hugoreleaser
e45eae4d67 releaser: Prepare repository for 0.131.0-DEV
[ci skip]
2024-07-29 14:06:20 +00:00
hugoreleaser
9b1b11c8a5 releaser: Bump versions for release of 0.130.0
[ci skip]
2024-07-29 13:51:56 +00:00
raoulb
9d2b5f98d0
math: Add trigonometric functions and some angle helper functions
This commit adds these new template functions in the `math` namespace:

math.Acos
math.Asin
math.Atan
math.Atan2
math.Cos
math.Pi
math.Sin
math.Tan
math.ToDegrees
math.ToRadians

Co-authored-by: Joe Mooring <joe@mooring.com>
2024-07-29 11:05:36 +02:00
Bjørn Erik Pedersen
0e00561620
deps: Upgrade github.com/bep/imagemeta v0.7.3 => v0.7.4 2024-07-23 20:46:05 +02:00
Bjørn Erik Pedersen
71842140d0 deps: Upgrade github.com/bep/imagemeta v0.7.1 => v0.7.3 2024-07-21 21:44:48 +02:00
Bjørn Erik Pedersen
cb95a033c1
readme: Pull the star history down a little 2024-07-20 17:46:48 +02:00
Bjørn Erik Pedersen
3240511153
deps: Upgraded github.com/bep/imagemeta v0.7.0 => v0.7.1
Fixes #12669
2024-07-20 17:28:47 +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
a28bed0817
readme: Add Star History 2024-07-20 15:37:22 +02:00
hugoreleaser
979423f4d5 releaser: Prepare repository for 0.130.0-DEV
[ci skip]
2024-07-17 13:42:58 +00:00
hugoreleaser
e85be29867 releaser: Bump versions for release of 0.129.0
[ci skip]
2024-07-17 13:29:16 +00:00
Bjørn Erik Pedersen
4d8bfa7f1c
tpl: Use xxHash instead of MD5 to hash the deferred templates
Motivation is performance. These templates are typically very small, so the win is minor, I guess.
2024-07-17 12:51:49 +02:00
Bjørn Erik Pedersen
f0ed91caba Throw error if resources.PostProcess is used in a deferred template
That just doesn't work.

See #12655
2024-07-17 12:47:25 +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
439f07eac4 deps: Go mod tidy 2024-07-08 23:53:23 +02:00
Bjørn Erik Pedersen
ce5a2ce001 deps: Upgraded github.com/tdewolff/minify/v2 v2.20.20 => v2.20.36 2024-07-08 23:53:23 +02:00
Bjørn Erik Pedersen
0f42d975e0 deps: Upgrade to golang.org/x/image v0.18.0 2024-07-08 23:53:23 +02:00
Bjørn Erik Pedersen
cc2d19e19b commands: Fix --navigateToChanged server behavior when editing headless content
Fixes #12648
2024-07-07 14:42:46 +02:00
Bjørn Erik Pedersen
094f746751 commands: Simplify the browser live reload logic
And improve the logging for live reload.

Closes #12643
2024-07-07 14:42:46 +02:00
Bjørn Erik Pedersen
fb8909d5b0
Use xxHash for the change detector
Much faster compared to MD5:

```
name          old time/op    new time/op    delta
HashingFs-10    21.3µs ± 2%     3.2µs ±17%  -84.96%  (p=0.029 n=4+4)

name          old alloc/op   new alloc/op   delta
HashingFs-10    12.9kB ± 0%    12.8kB ± 1%   -1.31%  (p=0.029 n=4+4)

name          old allocs/op  new allocs/op  delta
HashingFs-10      10.0 ± 0%       7.0 ± 0%  -30.00%  (p=0.029 n=4+4)
```

Updates #12643
2024-07-06 16:57:16 +02:00
PeskyPotato
0ee2610d7c source: Expose GitInfo Body
Updated bep/gitmap to v1.4.0, to get commit message's Body.
Added Body to GitInfo struct. Docs upated with commit body example.

Fixes #10905
2024-07-06 16:28:11 +02:00
Bjørn Erik Pedersen
251a23ef76
commands: Fix hugo mod get -u ./...
Fixes #12625
2024-07-06 15:38:21 +02:00
Bjørn Erik Pedersen
644d55475d Add hash.XxHash
Also move the non crypto hash funcs into this new package.

This is much faster than e.g. MD5, especially for larger inputs:

```
BenchmarkXxHash/xxHash_43-10         	 9917955	       112.2 ns/op	      56 B/op	       4 allocs/op
BenchmarkXxHash/mdb5_43-10           	 6017239	       204.1 ns/op	      96 B/op	       3 allocs/op
BenchmarkXxHash/fnv32a_43-10         	14407333	        82.30 ns/op	      16 B/op	       1 allocs/op
BenchmarkXxHash/xxHash_4300-10       	 2916892	       409.7 ns/op	      56 B/op	       4 allocs/op
BenchmarkXxHash/mdb5_4300-10         	  159748	      7491 ns/op	    4912 B/op	       3 allocs/op
BenchmarkXxHash/fnv32a_4300-10       	  218210	      5510 ns/op	      16 B/op	       1 allocs/op
```

Fixes #12635
2024-07-06 14:08:15 +02:00
hugoreleaser
edeed52fc5 releaser: Prepare repository for 0.129.0-DEV
[ci skip]
2024-07-04 08:27:37 +00:00
hugoreleaser
de36c1a95d releaser: Bump versions for release of 0.128.2
[ci skip]
2024-07-04 08:13:25 +00: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
hugoreleaser
82af94d1f5 releaser: Prepare repository for 0.129.0-DEV
[ci skip]
2024-07-02 07:00:44 +00:00
hugoreleaser
0ff542b4b9 releaser: Bump versions for release of 0.128.1
[ci skip]
2024-07-02 06:46:41 +00:00
Cyrus Yip
a95fe50616 create/skeletons: Fix languageCode region subtag
Region subtag should be in ALLCAPS
2024-07-02 08:43:19 +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
Joe Mooring
932ab4c058 Update README.md 2024-06-27 23:35:56 +02:00
hugoreleaser
95479fc2d0 releaser: Prepare repository for 0.129.0-DEV
[ci skip]
2024-06-25 16:30:14 +00:00
hugoreleaser
e6d2712ee0 releaser: Bump versions for release of 0.128.0
[ci skip]
2024-06-25 16:15:48 +00:00
Joe Mooring
79da24a0eb deps: Upgrade github.com/yuin/goldmark v1.7.2 => v1.7.4 2024-06-25 18:04:45 +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
eddcd2bac6 Clean up the css related template funcs package structure
Deprecate and move:

* resources.ToCSS => css.SASS
* resources.PostProcess => css.PostProcess
* resources.Babel => js.Babel

Updates #12618
2024-06-25 15:48:02 +02:00
Bjørn Erik Pedersen
1687a9a585
Delete unused release hook script
Closes #12378
2024-06-25 15:09:35 +02:00
Bjørn Erik Pedersen
16e4662b7d
modules: Remove newly introduced "mount source" does not exist warning 2024-06-25 15:04:07 +02:00
Joe Mooring
b187c0658e deps: Upgrade github.com/yuin/goldmark-emoji v1.0.2 => v1.0.3 2024-06-24 15:51:02 +02:00
Bjørn Erik Pedersen
c880faa998
tpl/debug: Fix reset of debug timers when running the server
Fixes #12621
2024-06-24 12:49:35 +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
3b724462c2
Update README.md 2024-06-22 16:45:22 +02:00
Bjørn Erik Pedersen
1c85830bc7 common/hexec: Fall back to the binary in PATH if npx fails
Closes #12486
2024-06-22 12:25:02 +02:00
Bjørn Erik Pedersen
af0cb57aaf
Merge commit '8b9803425e' 2024-06-21 09:41:24 +02:00
Bjørn Erik Pedersen
8b9803425e Squashed 'docs/' changes from 8c46b304a..9b06f951e
9b06f951e Update theme
aa24b5319 Improve quick start example
08e4e626d Update index.md
f4c1a8ce1 Update Disqus comments implementation notes (#2631)
aac3c0279 Update data sources
6ac3d7617 Fix typo
017da70a0 Ensure consistent use of method instead of variable
820881dcf Fix typo
dc6fa5ac6 Document LiveReload debugging
18b8c79f3 Improve url function examples
89e6997f1 Improve url function examples
53134e05c Remove static files page
27645a90f Improve data file/source documentation
f86b95bd4 Correct manual summary divider example
f0e95c8d1 Add examples to comparison operators
c5c6aa798 Document Pager methods
015049af9 Fix typos
ea6a9fa3f Remove new-in label
0359c4a1e Fix links
3ab8bb4e3 Update performance.md
b5393c65d Update configuration.md
ca9697630 Update Sections.md
927c90562 Document HTTP cache config
6da219643 netlify: Hugo 0.127.0
de236b58b Deprecate .Sites.First in favor of .Sites.Default
076067b47 netlify: Hugo 0.126.3
c37dd680e Change GetPage examples to single argument
24282c554 Clarify cardinalityThreshold
a4ce1a2d2 Revert "Update summaries.md"
466bc7e0f Update summaries.md
168800d5a Fix typo
65f6ca106 content adapters: Use --printPathWarnings to detect page collisions
9c7a700ea Update CLI docs
993aa40d3 netlify: Hugo 0.126.2
0242ec396 Replace file tree image with text
7670da499 rel and relref: Add note about which language version is picked
5dbd7ee26 Add cautionary note to virus scanner exclusion instructions
3c52fab72 Fix typo
868620bcd Improve content summary page
6bca7bc77 Rework safe functions
e30d17947 Rework index function
b76e81697 Miscellaneous edits
35849e55a Update formats.md
8f939ed5d Update menus.md
ea2fd0384 Update docs.yaml (#2592)
2f5d1712b Add security.http.mediaTypes to security page
d218b9c44 Change twitter.com to x.com
cb2255821 content adapters: Note to exclude file extension when specifying page path
2d5a1690f Indicate that .Page.Sites.First returns the site corresponding to the default content language
60071d923 Indicate that .Site.Sites.First returns the site corresponding to the default content language
0a115cfda Add content adapters section to features summary
011742c24 timer: Adjust output example
977101061 Describe possibility of page collisions with content adapters
d57b8a8cf Document virus scanning performance impact and remedy
dd5c3af04 netlify: Hugo 0.126.1
0b16c842d Update description of Markdown content format
e42ff7609 Fix typo
a120ccd0d Update Scratch and Store descriptions
cbb2294e3 Update content-adapters.md
c39aa4e25 netlify: Upgrade to Hugo 0.126.0
58b9554b7 Update version references
6140802d8 Update docs.yaml
5ee96971a Document content adapters
653069a0d Document the Goldmark extras extension
b8ca2833d Update sample data
efad994ee Describe .Language.LanguageCode fallback value
3336532fe Update Colors.md
40b49a1f4 Update embedded.md
f31741b47 Remove references to symlinks
1d5f40c90 Update sample data
fb76580f8 Update function signatures
463adcf26 Use key-value consistently throughout documentation
d03ed1887 Update sample data
fc59e1f6f Remove examples of LanguageCode fallback
b608f3165 Clarify purpose of multilingual site `title`
b677f9424 use-modules: clarify the example of initializing a new module
774d64a4d Update theme
417e869f0 Update site configuration docs
1dbe9ee20 Update sample data file
fa494af4b Move sample data file
300b4a319 Add sample data file
b4fc35c3e Change transform.Unmarshal remote data examples (#2557)
4b79599b9 netlify: Hugo 0.125.6
e8cb250f3 Improve external learning resources
9b0c02e46 Rework content formats
886f952e0 Clarify descriptions of permalink tokens
2f0d8c98c Fix a misused word
3b3b0693d Update Dart Sass version refs
c5d0fbcb0 netlify: Hugo 0.125.5
bf7d4f4fd Add Discourse to the comment system list
86a29bd43 Clarify language key format
6126c901a Update multilingual.md
6ec03c2c7 Update WorkingDir: Add new-in
d48f40ded Document multilingual 404 redirects
b161cc0c5 Update version references
02732fe91 Remove layouts directory
5befe5f28 Vendor theme
21247df4e Update link render hook
7d2fd8647 Update link render hook
af9e6bbe7 Update Colors.md
0442f8264 Document images.Color.Luminance and images.Color.ColorHex
d58b0b2f5 Update views.md
48ef3ad18 netlify: Hugo 0.125.4
b5721dff2 Update cross-references.md
27905febb Fix typo
d16acd658 netlify: Hugo 0.125.3 o
28a1b9dce Update Parse.md
842b20d2c Update YouTube shortcode argument description
a133a4828 Clarify that generated syntax highlighter css overrides markup.highlight.style
6e739fcbf Fix alias in /about/security.md
a9859e4e2 netlify: Hugo 0.125.2
326fcb518 Update CLI docs
1d3afb6b0 Fix netlify.toml examples in hosting-on-netlify
f4628189a Document front matter params expected by embedded templates
8a12d3c48 Fix typo
4b411d3fb Fix typo
a7fa25d7f Update CLI docs
7c9a1b864 Add related funcs/methods to time.Round and time.Truncate
79f22ead4 Update strings.Diff description
8085d85e3 Document time.Truncate and time.Round
76a1263e7 netlify: Hugo 0.125.1
6ea4cb709 Update introduction.md
e59a8805b Fix typo
eace2624a Fix PageInner reference links
ba66d6b90 Fix typo
3dcf32e25 Update debug.Dump
38d6731e2 netlify: Hugo 0.125.0
34362b62f Merge branch 'tempv0.125.0'
2221162fa Update privacy defaults and description
3873cf209 Remove "same path" restriction when using resources.Copy
66237fe12 Update youtube shortcode args
961639dfa Document additional changes in v0.125.0
3aa75ee74 Document taxonomies Page method
7f26f69e8 docs: Regen docshelper
05494b7d2 Fix conflicting text for global site function
264fe788e Add missing example to TOC page
de8d008e4 Update formats.md
8559c70c3 Update comments.md
987f9424e Update comments.md
b77011c93 Improve function descriptions
ae663793b all: Fix duplicate words in comments
585095cf8 Fix home page feed
37c6954ac Improve RSS feeds
6cd1b77af Update front-matter.md
3d95ad715 Fix RSS last build date
2c6153461 Improve RSS feed for news section (#2521)
898d7c261 Fix typo
0241936e1 Add installation instructions for Exherbo
62df9bd73 Add missing links to warnidf function
c9551d433 Fix a typo in templates docs
09ff1f27c Update YearDay.md
4b278d920 Fix literal usage of manual summary divider
8dec28c50 Fix literal usage of manual summary divider
16102faa8 Add introduction video
b276bb17f Fix default data type
61319af7a Fix file extension typo in page-bundles.md
ea74d798a Update shortcodes.md
9d18e239f tpl/tplimpl: Optionally exclude content from sitemap
4fe2efc76 Update page-bundles.md
34f099e1e Revise page bundle descriptions
021eea7b1 Update link to Modules page of Go Wiki
6972a9a83 Fix reference link
5ebfdea40 Fix configuration file tree example
12bebaaea Fixing typos
b179f3b7f Update segments example
ad3e26cec Update segments example
6970a9eeb Fix typo
194139ce7 Update configuration-markup.md
8fb8af286 tpl/tplimpl: Update Google Analytics template and config
4f8fd82ad Add wp2hugo migration tool
39261556a Update directory-structure.md
1e2c0b880 netlify: Hugo 0.124.1
55d5a2787 Update partial function example
e26b4634f Fix typo
bdada4361 Fix typo and capitalization
4a1fcfc29 Miscellaneous edits
6d6092058 Rework the about section
77ec9d696 Fix typo
6efbf5a39 Update configuration.md
dc1fe4405 Update configuration.md
3d1cd3383 Miscellaneous updates
8049e7701 Update IsMultihost method
939281f3a Update version references
5e9567046 Add segments documentation
8e267d780 Update MultiLingual and MultiHost methods/functions
c6aeeb747 netlify: Hugo 0.124.0
9fcd40fb5 Merge branch 'tempv0.124.0'
2f7a4ed68 docs: Regen CLI docs
5162805d7 docs: Regen docshelper
e1fa18bf8 Update versions in GitHub hosting example
70653e4b2 Add PubCrank to list of front ends
5f81464d5 Update opengraph configuration example
cc8a99633 Update hosting-on-gitlab.md
3af715f77 Clarify .Page.File behavior when page is not backed by a file
cab417dee Update cspell rules
29f4dde19 Rename section menu entries from "Overview" to "In this section"
e04291a99 Miscellaneous edits towards the goal of consistent language
f9fc2d5d6 Update page collection quick reference
a4893d9ba Update multilingual.md
ed81ac6b0 Fix typo
1f522e32e Fix typo
c4611eab5 Rework introduction to templating
64154fb8f Fix typo
ad71bdfbf Miscellaneous multilingual edits
016adc81b Sync CLI docs
346a5fb02 netlify: Hugo 0.123.8
ff0bedd97 Document hugo.IsMultihost
0e234715c docs: Fix hyphens and grammar in synopsis of command 'hugo server'
c8ef1da97 Add the Hugo dedicated Quiqr CMS
59dfe253b Fix grammatical error
1c6ca8022 Standardize usage of the term open-source
e6fd6e68c Update Translations.md
f6728e79b Update AllTranslations.md
18812d030 Fix typo
3b2d738c9 Correct isCJKLanguage description
a1188fe28 Bump version references
b51bd5548 Sync and vendor theme
da3ba4902 Replace the github logo png with svg
f75112195 Add diego to developer tools
a4b001470 netlify: Hugo 0.123.7
c37107fda Fix typo
37c1d9c92 Fix typo
48a5ac213 Correct description of MENUENTRY.Title
f434e25e8 Correct RESOURCE.Title example
de03cd28c netlify: Hugo 0.123.5
3c103d0f9 Revise and improve RESOURCE.Name and RESOURCE.Title examples
4aafbb2f4 netlify: Hugo 0.123.4
f2bf6c365 Clarify archetype context
98ddc91a2 List page kinds to which a taxonomy term may be applied
6094e59bb Remove refs to RESOURCE.Key
208d44a04 Update Key.md
46dd28266 Document the capitalizeListTitles site config option
2ed3b7732 netlify: Hugo 0.123.3
73d35c02f Merge branch 'tempv0.123.3'
93eb216ca js: Support JSX and JSXImportSourceOptions
c0cd22cc8 netlify: Hugo 0.123.2
94256ecd0 Add "comma" to list of comments solutions
6a4f38fc3 Update RESOURCE.Name examples
8cf5046f5 netlify: Hugo 0.123.1
c11c8e0da Fix link to embedded code block render hook for GoAT diagrams
08c4af7af Fix typos
1c20eb91a Update all transform.Unmarshal examples
d41da7450 Clarify functionality of sectionPagesMenu
5bb3752f7 Update list of methods that use logical path
fcab32c62 Update version strings
5770d37c0 Add new-in badge to images.Dither
9f9a9315f Remove variables section
313b1d85e Define and describe the concept of a logical path
97a8d2963 Document HUGO_MEMORYLIMIT
c60cd20a8 Capitalize the word Markdown throughout the documentation
f9b5938dd Create links to referenced embedded templates
df31318d1 Improve quick start guide
a76fa0de4 Rework Netlify hosting instructions and examples
a3184764d Provide examples of content rendering before accessing Scratch or Store
0206b9699 Include examples of building from source
ab268c395 Create FAQ reqarding file watcher
c89cf2baa More updates for v0.123.00
b8d5383f7 Replace links to variable pages with links to method pages
ad4a124c0 Updates for v0.123.0
24eda1cb0 netlify: Hugo 0.123.0
f7436b6a3 Merge commit '2658a71e1b'
da2d6ba11 docs: Regen docshelper
411374a58 Add images.Dither filter
36937d58d docs: Regen CLI docs
7c4b77317 docs: Regenerate docshelper
a9f56bf9b Merge commit '6efb279bfa'
b3346da53 docs: Make null booleans falsy in the docs helper
88286d1ea docs: Regen docs helper
a8ad989c6 Merge commit '9b0050e9aa' as 'docs'
fc7de7136 docs: Prepare for new sub tree
1083bf7c0 releaser: Prepare repository for 0.123.0-DEV
b9a03bd59 releaser: Bump versions for release of 0.122.0
e0021f496 build(deps): bump golang.org/x/tools from 0.16.0 to 0.17.0
d25902c0d build(deps): bump github.com/rogpeppe/go-internal from 1.11.0 to 1.12.0
50042ee1f docs: Regen docshelper
3758456b3 Merge commit '7125ad401a'
7125ad401 Squashed 'docs/' changes from 4dd2d6415..3b1a8579d
d0d2c6795 markup/goldmark: Support passthrough extension
2dd608378 build(deps): bump github.com/pelletier/go-toml/v2 from 2.1.0 to 2.1.1
45f52be7f build(deps): bump github.com/evanw/esbuild from 0.19.8 to 0.19.12
87bf2b968 tpl/tplimpl: Fix incorrect lastBuildDate
f281ef8a4 tpl: fix incorrect lastBuildDate
46f618756 parser/metadecoders: Accumulate org keywords into arrays
891534307 deps: Update github.com/tdewolff/minify/v2 v2.20.9 => v2.20.13
a541e3b4d Upgrade to Go 1.21.6
912c6576b parser/metadecoders: Add CSV lazyQuotes option to transform.Unmarshal
911bc60a7 README: Update minimum Go version to 1.20
5ff632332 releaser: Prepare repository for 0.122.0-DEV
6d5b44305 releaser: Bump versions for release of 0.121.2
1ccd3147a build(deps): bump golang.org/x/crypto from 0.16.0 to 0.17.0
e40b9fbbc tpl/math: Add math.Rand template function
9cd8fbb33 Adjust site benchmark
abcc61002 Simplify baseline benchmark
648d00c7d resources/images: Create AutoOrient image filter
8adba648c all: Remove unused code
6f13430d4 releaser: Prepare repository for 0.122.0-DEV
00b46fed8 releaser: Bump versions for release of 0.121.1
eb9f1eb65 Upgrade to Go 1.21.5
5186e762a releaser: Prepare repository for 0.122.0-DEV
e321c3502 releaser: Bump versions for release of 0.121.0
255e0a971 docs: Regen docshelper
558f3258a build(deps): bump github.com/alecthomas/chroma/v2 from 2.11.1 to 2.12.0
6580cd30a docs: Adjust last merge from docs repository
7617de86c docs: Regen docs helper
d19ed4d4e Merge commit '35dec7c96f'
35dec7c96 Squashed 'docs/' changes from 4d936aee6..4dd2d6415
9f978d387 Pull in the latest code from Go's template packages (#11771)
14d85ec13 tpl: Allow using page resources on the images page parameter for `opengraph`, `schema` and `twitter_cards` templates
171836cdf hugolib: Apply titleCaseStyle to automatic section pages
9ea7103db tpl/urls: Retain query and fragment with absURL and absLangURL
3fc42da3d markup: Add Level to Heading struct
d24da1712 tpl/fmt: Print suppression help with erroridf
4583b4130 tpl/transform: Display Chroma highlighting errors
507f4e356 build(deps): bump github.com/tdewolff/minify/v2 from 2.20.8 to 2.20.9
a7e721e02 build(deps): bump github.com/spf13/cast from 1.5.1 to 1.6.0
2627b91d3 build(deps): bump github.com/getkin/kin-openapi from 0.121.0 to 0.122.0
6d4b01241 github: Fix CI build on Windows
e536d461a build(deps): bump golang.org/x/image from 0.13.0 to 0.14.0
bfc325f56 deps: Update github.com/tdewolff/minify/v2 v2.20.7 => v2.20.8
36a60f65d build(deps): bump github.com/spf13/afero from 1.10.0 to 1.11.0
de2fcc5e1 build(deps): bump github.com/evanw/esbuild from 0.19.7 to 0.19.8
26a8ec207 Fix handling of dropped error in test
9ca889ba4 build(deps): bump google.golang.org/api from 0.151.0 to 0.152.0
e2a624dd6 common/para: Skip flaky test on CI
4fb40ee87 deps: Upgrade to libwebp 1.3.2
bc93a3613 build(deps): bump github.com/aws/aws-sdk-go from 1.48.4 to 1.48.6
3e5bc6f3b build(deps): bump golang.org/x/tools from 0.15.0 to 0.16.0
7c47036f1 build(deps): bump github.com/getkin/kin-openapi from 0.120.0 to 0.121.0
4d07e1fe8 build(deps): bump github.com/bep/logg from 0.3.0 to 0.4.0
1c41232e6 deps: Upgrade to github.com/bep/simplecobra v0.4.0
f11ca0fad build(deps): bump github.com/aws/aws-sdk-go from 1.48.2 to 1.48.4
30a18e882 watcher: Skip flaky test for now
d7a2f3f98 build(deps): bump golang.org/x/tools from 0.14.0 to 0.15.0
b4c5df42f tpl/transform: Add transform.XMLEscape template function
ef12d169c build(deps): bump github.com/gorilla/websocket from 1.5.0 to 1.5.1
a62bbfa9e build(deps): bump github.com/fatih/color from 1.15.0 to 1.16.0
8d32ca223 tpl/tplimpl: Remove superfluous type attr on script elements
5887230b7 build(deps): bump golang.org/x/net from 0.17.0 to 0.18.0
a4a66b821 build(deps): bump github.com/evanw/esbuild from 0.19.5 to 0.19.7
813390b5a build(deps): bump github.com/alecthomas/chroma/v2 from 2.10.0 to 2.11.1
d528bbd6d build(deps): bump github.com/tdewolff/minify/v2 from 2.20.5 to 2.20.7
af7f6c8b3 build(deps): bump google.golang.org/api from 0.138.0 to 0.151.0
e70849ea7 build(deps): bump github.com/aws/aws-sdk-go from 1.45.14 to 1.48.2 (#11724)
dd6cd6268 resources/resource: Fix GroupByParamDate with raw TOML dates
27620daa2 common/para: Skip flaky tests on Windows
80d2fdbaa navigation: Unexport menu entry methods
805cc1773 markup/goldmark: Sync image render hook code with Goldmark
0bde6931a helpers: Fix TrimShortHTML used by markdownify and RenderString
ac7cffa7e releaser: Prepare repository for 0.121.0-DEV
f11bca5fe releaser: Bump versions for release of 0.120.4
9315a2d2c Upgrade to go 1.21.4
cee3a56a9 Add a new test helper
da2a8e640 releaser: Prepare repository for 0.121.0-DEV
a4892a07b releaser: Bump versions for release of 0.120.3
cb98e9061 tpl/tplimpl: Fix deprecation logic in embedded templates
5fa97ee96 Remove some old and unused deprecation code
4d38f4725 Add a field prefix to the deprecated log statements
80f793c38 Avoid double printing INFO deprecation messages
a9079d7a6 build(deps): bump github.com/tdewolff/parse/v2 from 2.7.1 to 2.7.3
4914b7f18 build(deps): bump github.com/tdewolff/minify/v2 from 2.20.1 to 2.20.5
9e06fd339 releaser: Prepare repository for 0.121.0-DEV
9c2b2414d releaser: Bump versions for release of 0.120.2
ab2143368 Fix deprecation printing on info level
23fcfb7f7 tpl/tplimpl: Fix deprecation logic in RSS template
47bf2fcbe releaser: Prepare repository for 0.121.0-DEV
16fb2cae8 releaser: Bump versions for release of 0.120.1
2bedcf3d1 deps: Update github.com/tdewolff/minify/v2 v2.20.0 => v2.20.1
935999e2f releaser: Prepare repository for 0.121.0-DEV
20c3bae2c releaser: Bump versions for release of 0.120.0
29b6e133a docs: Regen docshelper
7f8ab7468 Add Solaris build
59bcc098c build(deps): bump github.com/fsnotify/fsnotify from 1.6.0 to 1.7.0
e26ba752d build(deps): bump github.com/google/go-cmp from 0.5.9 to 0.6.0
bcf07fa63 build(deps): bump github.com/alecthomas/chroma/v2 from 2.9.1 to 2.10.0
b6a756813 Make site.BaseURL and $pager.URL a string
acf01bfb7 create/skeletons: Fix menu template
27b22cd87 commands/new: Remove format flag from new content cmd
a2488b1c9 hugolib: Display correct markup identifier in error message
8f60c0c1e livereloadinject: Save some allocations
9dc608084 livereloadinject: Use more robust injection method
a349aafb7 tpl/urls: Return strings from URL functions
b8fbd4a57 transform/livereloadinject: Add benchmark
e2b2092ce build(deps): bump golang.org/x/tools from 0.13.0 to 0.14.0
f4df7b88b build(deps): bump github.com/tdewolff/minify/v2 from 2.12.9 to 2.20.0
3d9bd404e build(deps): bump github.com/mattn/go-isatty from 0.0.19 to 0.0.20
5f5e55aa8 build(deps): bump golang.org/x/image from 0.12.0 to 0.13.0
aaaf1c8df Squashed 'docs/' changes from 417593493..4d936aee6
0baa4f983 Merge commit 'aaaf1c8df5'
d3d4ab41a docs: Regenerate docshelper
28d844642 Revert "modules: Throttle the "downloading modules …" log entries"
eb5fd3127 Revert "modules: Adjust the log throttle logic a little"
3ed28e4bf resources/images: Create padding image filter
db14238ba markup/goldmark: Update the CJK extension to allow specifying line break styles
3f64b5a3d modules: Adjust the log throttle logic a little
66904097e modules: Throttle the "downloading modules …" log entries
e54139c85 tpl/collections: Make delimit return a string
3710a5ec7 Squashed 'docs/' changes from cb18a5183..417593493
705e3cd5f Merge commit '3710a5ec7e'
8c61fd254 build(deps): bump golang.org/x/net from 0.15.0 to 0.17.0
d3145e4e5 build(deps): bump github.com/evanw/esbuild from 0.19.3 to 0.19.5
743a1da3e build(deps): bump github.com/spf13/afero from 1.9.5 to 1.10.0
123901b74 build(deps): bump github.com/bep/logg from 0.2.0 to 0.3.0
71fd79a3f Revise the deprecation logging
c4a530f10 Remove rest of the now unused emoji code
272484f8b markdown: Pass emoji codes to yuin/goldmark-emoji
de4e46603 Fix so hugo get -u updates transitively
c23a0c4a0 watcher/filenotify: Remove redundant duplicated comments
a95670b98 docs: Remove outdated note from CONTRIBUTING.md
46bdc0388 tpl/debug: Add average and median to timer output
5160c7efa tpl/debug: Add debug.Timer
e2dd4cd05 Merge commit 'e509cac533'
e509cac53 Squashed 'docs/' changes from 7ef2dbce4..cb18a5183
fd3817181 Add some convenient integration test helpers
2eca1b3cc hugolib: Deprecate .Site.DisqusShortname
625162674 tpl/tplimpl: Fix dropped error
a692278bc hugolib: Deprecate .Site.GoogleAnalytics
d4016dd5c tpl/tplimpl: Deprecate .Site.Author usage in RSS template
4910312ee tpl/tplimpl: Deprecate .Site.Social usage with internal templates
1b5f78b6b markup/tableofcontents: Return template.HTML from .Fragments.ToHTML
d5d0f420d deps: Update github.com/tdewolff/minify/v2 v2.12.7 => v2.12.9
5993afa4c commands: Update message displayed when running CLI from GUI
d1b445853 common/hugo: Add hugo.IsServer and hugo.IsDevelopment
274852bcf all: Format files with gofmt
37a2d5eb4 magefile: Update isGoLatest to check for Go 1.21
4c95389c2 resources/integrity: Return string instead of template.HTMLAttr
3af8bded2 Update README.md
46da0b7aa tpl/lang: Formally deprecate lang.NumFmt
75f56b4ce tpl/collections: Fix and deprecate echoParams
d234a963e releaser: Prepare repository for 0.120.0-DEV
b84644c00 releaser: Bump versions for release of 0.119.0
a9d19dbdd docs: Even more about images.Process
12d713176 docs: More about images.Process
6b65b2fae common: Remove unused constants
1768684d8 docs: Regen docshelper
9aec42c54 Squashed 'docs/' changes from 686c7b6eb..7ef2dbce4
eb0ed33df Merge commit '9aec42c545'
6a246d115 Add images.Process filter
ef0e7149d Add $image.Process
c32094ace google_analytics_async.html: Add deprecation warning
a262fd4dd build(deps): bump golang.org/x/tools from 0.12.0 to 0.13.0
f0d32455d build(deps): bump github.com/alecthomas/chroma/v2 from 2.8.0 to 2.9.1
e8bc8e6d0 build(deps): bump github.com/evanw/esbuild from 0.19.2 to 0.19.3
f9b3c0f48 Add images.Opacity filter
11fcda971 build(deps): bump github.com/aws/aws-sdk-go from 1.44.314 to 1.45.14
f31375d4c build(deps): bump github.com/getkin/kin-openapi from 0.118.0 to 0.120.0
6415b599b build(deps): bump golang.org/x/image from 0.11.0 to 0.12.0
1e9b87f76 Upgrade to Go 1.21.1
275c0acbf commands: Update CLI docs with the important -u flag in hugo mod get
f9163155d create/skeletons: Improve viewport meta tag
79a17d9e5 Fix tests for Go 1.21.1
75c0f8828 commands/gen: Remove default highlight style
18ce85462 Fix recently broken benchmark
69f5bad40 Adjust baseline benchmarks
525bed991 commands: Print language code after web server address info
2ae4786ca releaser: Prepare repository for 0.119.0-DEV
da7983ac4 releaser: Bump versions for release of 0.118.2
df5d76fed release: Revert to building with Go 1.20
7362ba220 releaser: Prepare repository for 0.119.0-DEV
0eb480aa1 releaser: Bump versions for release of 0.118.1
7e9092eee Revert to bullseye as the release build image
0200eaf58 releaser: Prepare repository for 0.119.0-DEV
28b640a22 releaser: Bump versions for release of 0.118.0
db45dbbee Merge commit '77b976dd92'
77b976dd9 Squashed 'docs/' changes from a7e1e9be8..686c7b6eb
e847a98db docs: Regen docs helper
45c9bbc6c Don't use the OS environment when creating config for docs
94fbab2a8 Delay the creation of cache directories until they're used
c3f273b2d deploy: Create AWS session for CloudFront invalidation via Go CDK
d7dcc76d2 markup/goldmark: Add CJK extension
9bf76fd7e build(deps): bump google.golang.org/api from 0.134.0 to 0.138.0
15d3e48ce Fix RegularPagesRecursive for the home page
b2a02c3c5 build(deps): bump golang.org/x/tools from 0.11.1 to 0.12.0
6821d6f15 build(deps): bump gocloud.dev from 0.33.0 to 0.34.0
93c7ad12e build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.9 to 2.1.0
d2ae9e136 testscripts: Move hugo new tests to where they belong
3a8aad6b1 Fix .RawContent for empty content pages (#11407)
a7b93e656 hugolib: Handle dropped error
65871d5cf common/loggers: Fix typo in option name
2e4bf89ec misc: Change dart-sass labels in workflows and snapcraft
ebaa733d4 Make sure resources directory isn't created in hugo new theme
24b1be45c Go 1.21 Upgrade
111f02db2 testscripts: Make mod vendor test stable
8a08f91d5 dockerfile: Update Docker images
dcf425c84 Fix it so disable a module does not disable transitive dependency required by others
9a8c84d60 create/skeletons: Move theme's site config to top level
a19d03b0e build(deps): bump github.com/yuin/goldmark from 1.5.5 to 1.5.6
cdf0b3b7a modules: Make new cache directories read/write
d979831db deploy: Update InvalidateCloudFront to use Go CDK helper
bcf7421ea Avoid escaping HTML chars inside hugo_stats.json
b6538532f commands/new: Embed site and theme skeletons
90944aa26 docshelper: Improve template lookup order descriptions
db7bc4969 build(deps): bump github.com/evanw/esbuild from 0.18.17 to 0.19.2
a2f6400d6 cache: Hide IsResourceDir from the exported config
7d74cd0cc commands: Handle floats without decimals in hugo config
d139f3023 docs: Replace docs.json with docs.yaml
b1b691241 config: Add a type value for the tags related config entry
0de81c643 build(deps): bump golang.org/x/net from 0.13.0 to 0.14.0
851bf3515 Add all config to docshelper.json
d4a6c16c1 build(deps): bump golang.org/x/image from 0.10.0 to 0.11.0
5d5fb22ea Merge commit '7c62d6ef16'
7c62d6ef1 Squashed 'docs/' changes from c43daf45f..a7e1e9be8
641390f8f Try to make test more stable
2e6191b2e deps: Sync go-i18n with upstream
22861cb4d Return original error on resources.GetRemote retry timeouts
16da1ade7 testing: Write test caches to /tmp
a3d42a277 Add retry in resources.GetRemote for temporary HTTP errors
2c20fd557 build(deps): bump gocloud.dev from 0.24.0 to 0.33.0
243736e75 build(deps): bump golang.org/x/net from 0.11.0 to 0.13.0
bf891c225 build(deps): bump github.com/marekm4/color-extractor from 1.2.0 to 1.2.1
da0df0ada build(deps): bump github.com/frankban/quicktest from 1.14.5 to 1.14.6
0885f8ec2 build(deps): bump golang.org/x/image from 0.9.0 to 0.10.0
61be050a9 build(deps): bump github.com/clbanning/mxj/v2 from 2.5.7 to 2.7.0
65af75fb0 build(deps): bump golang.org/x/tools from 0.9.3 to 0.11.1
2d75f74b8 build(deps): bump go.uber.org/automaxprocs from 1.5.2 to 1.5.3
2ac3d6160 build(deps): bump github.com/hairyhenderson/go-codeowners
ade7ec818 Add Page.RenderShortcodes
8fa8ce3e4 Update GitHub issue template
9dce45c25 build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.8 to 2.0.9
239f2e2c9 releaser: Prepare repository for 0.117.0-DEV
3e1ea030a releaser: Bump versions for release of 0.116.1
30885a6c5 Fix module config watch regression
58da8554c deps: Fix Chroma dependency version
92c159437 releaser: Prepare repository for 0.117.0-DEV
5a7e0da84 releaser: Bump versions for release of 0.116.0
d7db096a9 build(deps): bump github.com/evanw/esbuild from 0.18.11 to 0.18.17
c1df5b1b0 config: Do not fail on unknown config keys
be8e2de59 resources: Fix spelling in method name
d297c8e1b docs: Regenerate CLI docs
fbb8eb39e Fix so temporary images do not get published
87d9bffe7 readme: Fix link
d9fdcbe93 commands: Update cacheDir description
295d73388 Update where.md
d5247788e docs: Update where
036e260d8 docs: Update where function operators
a50356b9a docs: Rework the cacheDir documentation
8859be1c0 Merge commit '87de22d746'
87de22d74 Squashed 'docs/' changes from 85befbb4d..c43daf45f
bec9b80d9 Deprecate taxonomyTerm
1c97095ac Warn about unknown kinds in disableKinds
b3cb6788b Move all Kind constants to its own package
5542f02fb build(deps): bump github.com/rogpeppe/go-internal
0bc7ed9a1 build(deps): bump golang.org/x/image from 0.8.0 to 0.9.0
36b512605 Remove unused autogenerated method
2589b1295 commands: Replace deprecated ioutil with os
ef6e813ca tpl/collections: Add BenchmarkWhereOps
f4598a098 tpl/collections: Add like operator to where function
dc2a544fa tpl/collections: Fix description of apply function
916397320 snap: Set cache location to $HOME/.cache/hugo_cache
b3f10556f Use os.UserCacheDir as first fallback if cacheDir is not set
4d7af757c Add a common regexp cache
7f058b8ba Fix multiple languages in HUGO_DISABLELANGUAGES
575d7f806 snap: Allow access to SSH keys and $HOME/.config/hugo
739d10e8b deps: Upgrade github.com/yuin/goldmark v1.5.4 => v1.5.5
0dbe0f1a0 releaser: Prepare repository for 0.116.0-DEV
dc9524521 releaser: Bump versions for release of 0.115.4
d70b6c7d0 Fix broken handling of legacy taxonomyTerm in disableKinds
d947db371 commands: Move testscript into its correct place
d8c94c354 publisher: Improve class collector for dynamic classes
6bbec9001 Fix cache busting setup
5bd22ba85 commands: Delay server builds after the watcher is set up
7ae62f4aa Create hugo_stats.json if it's mounted but does not exists
f1a061e9e Re-instate disableLiveReload as a config option (and not just a flag)
2f11e673c common/htime: Fix localization of abbreviated month names
387c5f60f Improve error messages for PostCSS etc.
c406fd3a0 Fix setting config from env with complex (e.g. YAML) strings
286821e36 Fix for data mounts in sub folders
79f15be5b releaser: Prepare repository for 0.116.0-DEV
5c2e014a5 releaser: Bump versions for release of 0.115.3
cc44583cc Improve behavior of defaultContentLanguageInSubdir when only the default language is enabled
4da672af8 Return error when .Render is invoked without arg
f1886f8c3 js: Pass tsconfig.json to esBuild
5bec50838 tpl/collections: Fix WordCount (etc.) regression in Where, Sort, Delimit
f650e4d75 config/allconfig: Update timeout description
c934a4506 docs: Refresh docs.json
91b02091a releaser: Prepare repository for 0.116.0-DEV
8966424e0 releaser: Bump versions for release of 0.115.2
72510969a snap: Allow access to AWS, Azure, and GCS config/credentials
70c5e485b snap: Update metadata and security.exec.osEnv
a78b17d7f Make imageConfig work with modules
a48194253 Restore language.disabled config
0f921ace6 Fix hugo mod vendor for modules with hugo.toml
601995376 Fix static content files multilingual root regression
92e86702e Fix defaultContentLanguageInSubdir with only 1 language
6c9ea022a config: Expand default security.exec.osEnv policy
12d3469dd Add titleCaseStyle none and firstupper
bf7ee8a91 Bump github.com/bep/clock v0.3.0 to renamed github.com/bep/clocks v0.5.0
d912491f2 releaser: Prepare repository for 0.116.0-DEV
857374e69 releaser: Bump versions for release of 0.115.1
c27639b9a docs: Regen docs helper
ceb486f98 Fix buildStats when tags and classes are disabled
5afc89f2b Rework the build.writeStats struct
c1eac616d snap: Explicitly set security.exec.osenv during build
3c8256a13 snap: Restore security.exec.osenv whitelist
19d76ae96 github: Build for Dragonfly in CI build
11ecea610 Make build.writeStats a struct
da98724bc build(deps): bump github.com/evanw/esbuild from 0.18.10 to 0.18.11
4d470bb73 build(deps): bump github.com/alecthomas/chroma/v2 from 2.7.0 to 2.8.0
0ff8e13c1 commands: Fix index out of range in hugo mod get
ffd37d4f7 Only print the path warnings once
b4b65245b Update README.md
87886f40d releaser: Prepare repository for 0.116.0-DEV
67caf5069 releaser: Bump versions for release of 0.115.0
7917961d5 Misc permalinks adjustments
80ecb9589 commands: Handle hugo mod get --help
58e09cc6c Update README.md
635cc346c commands: Fix panic when running hugo new theme without theme name
12646750a Print help message when triggered with no flags
79639c981 Fix output formats and media type  per language config regression
9b313cec1 build(deps): bump github.com/evanw/esbuild from 0.18.5 to 0.18.10
b74b8d647 common/collections: Fix append regression to allow appending nil
793e38f5c commands: Fix help message for hugo new theme
7f698c893 Don't panic on invalid security whitelist regexp
fa0e16f4c Fix false path warnings with resources.PostProcess
12e4c4d5d docs: Update permalinks documentation
bac03f407 Merge branch 'master' of github.com:gohugoio/hugo
cc14c6a52 resources/page: Allow section and taxonomy pages to have a permalink configuration
e3308a0bb tpl/tplimpl: Fix typo in global variable name
019299b0b commands: Enable format flag with hugo new site
23ed087c4 Update README.md
a018259bc Merge branch 'release-0.114.1'
ad5e04daa releaser: Prepare repository for 0.115.0-DEV
e9b716ad9 releaser: Bump versions for release of 0.114.1
ae31dbdd1 Revert "build(deps): bump gocloud.dev from 0.24.0 to 0.30.0"
5b4bfc2db Fix broken nodeploy setup
92f55f112 build(deps): bump github.com/niklasfasching/go-org from 1.6.6 to 1.7.0
078226dd6 Fix broken nodeploy setup
06d228aad snap: Switch from Embedded Dart Sass to Dart Sass (#11146)
b1016d2e2 commands: Make hugo env respect --logLevel
49336bfc5 commands: Update Jekyll post-import output
941818295 build(deps): bump gocloud.dev from 0.24.0 to 0.30.0
5491e5547 build(deps): bump github.com/evanw/esbuild from 0.18.4 to 0.18.5
bf7af9043 deps: Update github.com/tdewolff/minify/v2 v2.12.5 => v2.12.7
5e12bf7dc releaser: Prepare repository for 0.115.0-DEV
9df2ec798 releaser: Bump versions for release of 0.114.0
59300faae Revert "build(deps): bump gocloud.dev from 0.24.0 to 0.29.0"
9f98b3e71 docs: Regen docshelper
3ab84651c Add empty Environ when loading test config
7241b5fd5 docs: Regen CLI docs
6dfbd2479 common/loggers: Drop the bold INFO etc. prefixes
f59c3c021 loggers: Avoid using Logf for the LevelLoggerToWriter
3ca29b156 tocss/dartsas: Avoid using Logf for the internal Dart Sass logging
fdb0b7fb1 helpers: Remove superflous formatting flag in deprecation warnings
49dd53a40 Revert "deps: Update github.com/tdewolff/minify/v2 v2.12.5 => v2.12.6"
68d9d3ebd all: Fix some typos
9009c8cdc all: Fix typos in function names and comments
12dc9a6e4 deploy: Fix deploy defaults for non-zero flag values (e.g. maxDeletes, invalidateCDN)
1b85303ac common/loggers: Re-add trailing newline in logger.Printf
8a04d47ab build(deps): bump github.com/evanw/esbuild from 0.18.3 to 0.18.4
7c9fada77 Replace the old log setup, with structured logging etc.
0e7944658 Revert "snap: Transition base snap from core20 to core22 (#11101)" (#11125)
aaf2e9693 build(deps): bump github.com/evanw/esbuild from 0.18.2 to 0.18.3
ee359df17 Fix upstream Go templates bug with reversed key/value assignment
0f989d5e2 build(deps): bump golang.org/x/sync from 0.2.0 to 0.3.0
f73c56753 common/collections: Always make a copy of the input slice in Append
d178fe94f tpl/collections: Fix append when appending a slice to a slice of slices
732dcb848 build(deps): bump google.golang.org/api from 0.123.0 to 0.127.0
944859f1a build(deps): bump golang.org/x/tools from 0.9.1 to 0.9.3
90b2674dd Re-add site.RSSLink (and deprecate it)
bb9377b5e build(deps): bump github.com/kyokomi/emoji/v2 from 2.2.11 to 2.2.12
e88f1b80b build(deps): bump github.com/getkin/kin-openapi from 0.117.0 to 0.118.0
516f0cb6c build(deps): bump golang.org/x/net from 0.10.0 to 0.11.0
21d17566a Fix .Width and .Height for animated gifs
35e9b3ed1 snap: Transition base snap from core20 to core22 (#11101)
3c1deaf20 Squashed 'docs/' changes from 1d5548d73..85befbb4d
a0009e070 Merge commit '3c1deaf201'
7bed16c30 build(deps): bump gocloud.dev from 0.24.0 to 0.29.0
2ba2271e4 tpl/math: Allow variadic math functions to take slice args, add math.Product, math.Sum
60a2cdf72 Fix config merge regression with root slices (e.g. disableKinds)
e08cfc8ca build(deps): bump golang.org/x/image from 0.7.0 to 0.8.0
ef147f4e8 commands: Remove flags log, verboseLog, add flag logLevel, deprecate flags verbose and debug
489519566 build(deps): bump github.com/magefile/mage from 1.14.0 to 1.15.0
91c0b0f76 build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.6 to 2.0.8
baef235d5 build(deps): bump github.com/evanw/esbuild from 0.17.19 to 0.18.2
0541a1b57 Fix handling of aliases (e.g. hugo serve)
258884f44 cache: Set default cache path based on $USER
254c2b323 build(deps): bump go.uber.org/atomic from 1.10.0 to 1.11.0
84f71ba8f build(deps): bump github.com/hairyhenderson/go-codeowners
69f0e88a4 resources: Remove failing and superflous test assertion
82adc972e build(deps): bump github.com/frankban/quicktest from 1.14.4 to 1.14.5
60533fdc0 build(deps): bump github.com/mattn/go-isatty from 0.0.17 to 0.0.19
261143bbb build(deps): bump github.com/spf13/afero from 1.9.3 to 1.9.5
b8526f32f commands,config: Fix typo in log and error messages
ed7e25006 helpers: Avoid url.Parse in RelURL and AbsURL if we can
6a09e7f28 Adjust benchmarks
29e5cbb69 Adjust benchmark
ded686600 Add BenchmarkAbsURL
e1d43021c helpers: Improve schema detection when creating relative URLs
5db215d4d helpers: Add a basic benchmark for RelURL
b7dc93ca1 config: Remove unexpected _merge keys introduced in author and social maps
f210188da Upgrade to v2 of the Dart Sass Embedded Protocol
c782ebd89 Fix indented SASS imports for Dart Sass
73779707a releaser: Prepare repository for 0.114.0-DEV
085c1b3d6 releaser: Bump versions for release of 0.113.0
6c955cc3d docs: Regenerate CLI docs
5446900de commands: Update CLI docs vs server and production
cf38c73f5 commands: Add TLS/HTTPS support to hugo server
536bf71ab releaser: Prepare repository for 0.113.0-DEV
ea3c95a7b releaser: Bump versions for release of 0.112.7
5e5ce00d4 Fix menuItem.URL when pageRef is not set
a191b38ac Don't inject livereload script on hugo -w
382c726e6 markup: Fix typo in function and struct names
4c46f9400 all: Replace deprecated ioutil with io and os
8c7a4e995 releaser: Prepare repository for 0.113.0-DEV
2ca0fcc44 releaser: Bump versions for release of 0.112.6
a6d774e80 docs: Regenerate CLI docs
dfb1895e4 Squashed 'docs/' changes from 1798dc0d5..1d5548d73
9e4072ac2 Merge commit 'dfb1895e4b'
0ef295284 commands: Add --lang to hugo config
e3ae8f025 Make sure any default mounts show up in "hugo config"
06faee5be github: Fix Windows build
409c6c3fc deps: Update github.com/tdewolff/minify/v2 v2.12.5 => v2.12.6
ff77a927f tpl/tplimpl: Use .Language.LanguageCode in built-in templates
9cdca1f95 Fail on invalid defaultContentLanguage
6462eecfb Avoid panic in invalid language config
a7d6b1413 Don't panic on empty yaml config params
3f497d496 Prevent double escaping of image alt-text in Goldmar typographer
32585696b Fix potential deadlock in ByParam
d47225ce9 releaser: Bump versions for release of 0.112.5
e3dfc76fa Fix it so languageCode on top level config still works
cd59216de releaser: Prepare repository for 0.113.0-DEV
e285153d7 releaser: Bump versions for release of 0.112.4
20ea2e0c6 docs: Regenerate CLI docs
51d0a0ab0 commands: Add the common build flags to the config commands
fd099331e Fix Processed images count regression for multiple languages
43f1282e7 commands: Reinstate some of the removed build flags (e.g. --theme) to new and mod
e96cdfe96 Don't create the public folder unless needed
ffdbce578 docs: Regen CLI docs
a838a27e4 Merge commit 'd3927310d5'
d3927310d Squashed 'docs/' changes from 39af43ef1..1798dc0d5
273d9f69a commands: Fail the build when no config file or config dir
a6257d8a4 langs: Remove the Language.Params deprecation message for now
6c2db0dfb Add language.LanguageCode
8f293a185 Fix --renderStaticToDisk regression
901cd970d commands: Re-introduce the -f shorthand for hugo new site
f86b5f70a commands: Move the --format flag to only the commands that support it
3297b395d releaser: Prepare repository for 0.113.0-DEV
ba6f74e40 releaser: Bump versions for release of 0.112.3
231374a1f Fix regression when loading config  -e is empty or HUGO_ENV or HUGO_ENVIRONMENT is set
5adc83790 releaser: Prepare repository for 0.113.0-DEV
f89108f2b releaser: Bump versions for release of 0.112.2
dd6792201 minifiers: Make sure JS.Version always has a value
9a235d0af Fix regression with site.IsServer when not running a server
99407c39b releaser: Prepare repository for 0.113.0-DEV
7c90c19d2 releaser: Bump versions for release of 0.112.1
ed906a86e Fix regression when config for OutputFormat.BaseName is an empty string
d666edad7 releaser: Prepare repository for 0.113.0-DEV
0a95d6704 releaser: Bump versions for release of 0.112.0
70b2aaf87 circleci: Add github.com to known hosts
f01492115 Revert "build(deps): bump gocloud.dev from 0.24.0 to 0.29.0"
bd38e35f9 Revert "postcss: Improve validation of option 'config'"
85b13c105 Add --format to hugo config
b6e6438f7 docs: Regen docshelper
943ff7f7c commands: Add missing gen docshelper command
288be1976 Fix "unknown command" message when no suggestion
9a0370e8e postcss: Improve validation of option 'config'
10d0fcc01 docs: Regen CLI docs
b95e15694 Merge commit 'f96384a3b5'
f96384a3b Squashed 'docs/' changes from 6e32d0591..39af43ef1
4cac5f5e3 Avoid writing to hugo_stats.json when there are no changes
2c3d4dfb7 Add cache busting config to support Tailwind 3
1292d5a26 build(deps): bump github.com/tdewolff/parse/v2 from 2.6.5 to 2.6.6
baa556904 build(deps): bump gocloud.dev from 0.24.0 to 0.29.0
a5413c1f8 build(deps): bump github.com/gobuffalo/flect from 0.3.0 to 1.0.2
9cea58a8a build(deps): bump golang.org/x/image from 0.5.0 to 0.7.0
1a5dce4cc build(deps): bump github.com/tdewolff/minify/v2 from 2.12.4 to 2.12.5
6ca8a40f2 commands: Make all list commands list what 'all' did before
2db7ec622 tpl/tplimpl: Add img loading attribute to figure shortcode  (#10927)
e6dc8053b commands: Fix build logic when listing expired/future draft content
2637b4ef4 Allow whitelisting mediaTypes used in resources.GetRemote
7c7baa618 Add hugo.WorkingDir
4f085e80d Make language merging of markup etc. config without values in the root
150d190ff tpl/urls: Return empty string when JoinPath has zero args
065ae003a build(deps): bump github.com/dustin/go-humanize from 1.0.0 to 1.0.1
1a7d57c0b build(deps): bump google.golang.org/api from 0.76.0 to 0.123.0
bba54e694 build(deps): bump golang.org/x/tools from 0.4.0 to 0.9.1
737054311 build(deps): bump github.com/cli/safeexec from 1.0.0 to 1.0.1
f6269ee92 build(deps): bump github.com/getkin/kin-openapi from 0.110.0 to 0.117.0
715d48404 deps: Update github.com/evanw/esbuild v0.17.0 => v0.17.19
0a51dfac9 commands: Fix data race
c371171ab deps: Update github.com/alecthomas/chroma/v2 v2.7.0
d6197a41f Re-add --printUnusedTemplates and --printPathWarnings
e4e0313c8 tpl/urls: Fix build broken by a merge
5b3e165ba tpl/urls: Add JoinPath template function
03cb38e6c Allow legacy taxonomyTerm in disableKinds
ad4bc969d Fix warn message about custom params on the language top level
4003c7903 Fix some spelling mistakes
610cedaa6 all: Fix comments for exported functions and packages
24e7d0c17 deps: Update github.com/bep/golibsass v1.1.0 => v1.1.1
008170c8a Make GOMAXPROCS to be CPU limit aware
7c647bcae Allow empty params.mainSections
95818e27d modules: Fix format flag in error
3f00f4753 commands: Load config before creating the filesystem
834b3d7e4 Fix some recently introduced error handling issues
1155bbca9 tpl/lang: document delimiter option for FormatNumberCustom
86b2a2743 Re-add site.LanguagePrefix
35955f50e github: Trim the test flow a little
8a69ccbb0 commands: Improve the common build flag handling
7ce033a89 Support, but warn, about top level language custom params
05542130b Handle transient errors in config loading etc.
5251f015b Re-establish all the server flags
5d857165f Deprecate site.Language.Params and some other fixes
0106cf1a6 Revert "Make GOMAXPROCS CPU limit aware"
59050f97f Make GOMAXPROCS CPU limit aware
faa6998f2 Add Sections to Site interface
3d90871e9 helpers: simplify path tests with T.TempDir
bda082c98 tpl: Add math.Abs
241b21b0f Create a struct with all of Hugo's config options
6aededf6b Improve date parsing performance for the common case
0988b76a7 Add a counter helper
e0e19a934 Expand the baseline benchmark a little
bcd7ac770 Revert "Update syntax-highlighting.md (#10929)" (#10930)
a4fb8dc6b Update syntax-highlighting.md (#10929)
4f341fa1a Update README.md
5c7b79cf7 tpl/strings: Clarify findRESubmatch description
0cb6ca590 langs/i18n: Fallback to defaultContentLanguage instead of English
f1062519a tpl/debug: Add VisualizeSpaces
46a3cf618 Update README.md
9906c1ae5 Prevent the global error collector to panic when sending on closed channel
5596dc24a markup/goldmark: Add config options for the typographer extension
d01731d53 readme: Fix build command
f1e8f010f Update README.md
5748133d5 Add test for ToC vs include
05c095a0e resources.functions: improve validation
891b2918d resources: Fix typos in error message and variables
b0b1b76dc markup/goldmark: Fail on invalid Markdown attributes
0fbab7cbc commands: Fix data race in test
f5eddf89b tpl/math: Return error if less than 2 input numbers
0e8ab20a8 releaser: Prepare repository for 0.112.0-DEV
5d4eb5154 releaser: Bump versions for release of 0.111.3
1c841ec91 deps: Update go-org to v1.6.6
e7148f335 Fix "unknown shortcode token" when calling shortcode within fenced code block
d55af2abf Run gofmt -s on source files
b6f44aaf1 docs: Improve examples of variadic math functions
84201e8d5 tpl/math: Allow multi numbers in add, sub, mul, div, min and max
04b981164 readme: Update dependency list
9818724b5 Improve error message for unclosed shortcode with inner content
34a86e13f Don't fail when calling Paginate with an empty pages.PagesGroup
0f01bd463 server: Replace golang.org/x/net/context with context
d171d1543 tpl: Add hasSuffix alias
02ab77da3 watcher: use time.NewTicker to prevent leaks
873be9f90 ensure we default to 10 correctly
bebb2b8d0 switch transfers to workers
e6f029bde customize parallel transfer count
bdbfacb86 metadecoders: Add support for native org dates in frontmatter PR #7433 added support for Org timestamps for the DATE header. This PR widens the support with additional front matter headers LASTMOD, PUBLISHDATE and EXPIRYDATE.
32ea40aa8 releaser: Prepare repository for 0.112.0-DEV
4164f8fef releaser: Bump versions for release of 0.111.2
b83050cb4 Fix .Fragments when called cross sites on uninitialized output format
df5608f8a Allow page.TableOfContents on self in shortcode
f56ce01ae tpl/partial: Consolidate GoDoc
3bbeb5688 Fix "context canceled" with partial
184a67ac4 cache: Fix --gc failure on Windows
6c798eba6 Page context handling in i18n
ec1c97e7e Work around --gc failure on Windows <= 10
f10009e7f Update to Go 1.20.1
a950950f1 snap: Fix dart-sass-embedded installation
36ce3a4a9 Correct typos in Go comments
17e60b77e releaser: Prepare repository for 0.112.0-DEV
39a4a3cf6 releaser: Bump versions for release of 0.111.1
52f339dad Merge branch 'release-0.111.0'
eef23a7f2 Fix "page" not defined
18cf75805 releaser: Prepare repository for 0.112.0-DEV
3fa8bb831 releaser: Bump versions for release of 0.111.0
db9f74d24 Revert "build(deps): bump gocloud.dev from 0.24.0 to 0.28.0 (#10610)"
60e6fa798 build: Bump build images
7e51ba03c build: Update Linux ARM build image
66f94b494 tpl/tplimpl: Remove the Google News internal template
c0d15a289 strings: fix Truncate behavior for formatted html
2a61910e8 tpl/strings: Adjust benchmark
079d1b654 tpl/strings: Add BenchmarkTruncate
a56b9071d cods: Regen docs helper
5c317c55e Move the Related doc counter to prevent a race
a669467d9 Misc ioutil deprecation adjustments
d453c1274 Replace deprecated ioutil with io and os
336622d5e Squashed 'docs/' changes from 36dd5483f..6e32d0591
97b010f52 Merge commit '336622d5e7'
4d36b99a4 build(deps): bump github.com/tdewolff/parse/v2 from 2.6.4 to 2.6.5
807237bc0 build(deps): bump github.com/mattn/go-isatty from 0.0.16 to 0.0.17
79b03b3f7 build(deps): bump golang.org/x/image
e31441031 Remove unused temp directory
39cc3a2a7 exif: Return the proper exposure time value in some special cases
ce524d0b5 Add a page template func
2662faf61 dartsass: Import CSS without extension at compile time
271318ad7 Split parse and render for Goldmark
e442a63bb related: Add config option cardinalityThreshold
d5601e839  docs: Another fix related docs example
cedd04db3 docs: Fix related docs example
4bf91b975 build(deps): bump golang.org/x/net from 0.4.0 to 0.7.0
ae48507d6 Fix shortcode error when closing without .Inner
7d78a498e Throw an error when shortcode is expected to be closed
0dbeac80c Add some shortcode testcases
b99d073ca sass: Remove some unused leftover code
e965cb679 resources/sass: Remove debug statements
cf591b7c0 Squashed 'docs/' changes from 1214f6ffb..36dd5483f
7e539cb39 Merge commit 'cf591b7c0c'
586fea0de page: Move the cache double check right after the lock
fa2d7adf1 page: Add some concurrency to the building of the related page index
4346987fa related: Adjust benchmark
2dad13c0e create: Fix typo in error message
ecf3cd514 tocss: Simplify the hugo:vars type handling
a1a9c08b5 resource_transformers/tocss: Fixed hugo:vars casting
6abd15e78 Adjust tests for GO 1.20
094135ff9 tpl/internal: Sync Go template src to Go 1.20
4801e2e8e build: Update to Go 1.20
90da7664b Add page fragments support to Related
0afec0a9f related: Adjust benchmark
28540ed13 related: Add benchmark
9af78d110 tpl/collections: Improve error message in Index
d33a7ebcc Make the HTML collector parsing more robust
2a364cca6 Revert "build(deps): bump github.com/getkin/kin-openapi from 0.110.0 to 0.114.0"
3fb2417cb deps: Upgrade github.com/yuin/goldmark v1.5.3 => v1.5.4
fce089048 tpl/strings: Add strings.ContainsNonSpace
87c78bd3e build(deps): bump github.com/getkin/kin-openapi from 0.110.0 to 0.114.0
69c369e11 deps: Upgrade github.com/alecthomas/chroma v2.4.0 => v2.5.0
73ece30d8 markup: Fix linenos codeblock hl option case regression
f9fc0e045 Fix slow HTML elements collector for the pre case
4f4a1c00b publisher: Add benchmark
76c6140c5 snap: Install dart-sass-embedded for 32-bit ARM (armhf) too
d4482e8bf snap: Add read access for ~/.gitconfig.local and ~/.config/git/* too
1477d0ba9 commands: Fix server url rewrites (http status 200)
dd37163f5 build(deps): bump github.com/kyokomi/emoji/v2 from 2.2.10 to 2.2.11
c3a59a7d5 build(deps): bump gocloud.dev from 0.24.0 to 0.28.0 (#10610)
4ccc8cfb4 Fix description of collections.Uniq
e2cfc3d5a Update CONTRIBUTING.md
168858331 Fix shortcode detection in RenderString
4ef9baf5b Only invoke a given cached partial once
93ed6e447 Update README.md
0d1161b26 releaser: Prepare repository for 0.111.0-DEV
e32a493b7 releaser: Bump versions for release of 0.110.0
19e960562 dos: Regen CLI docs
80e8bd3b7 docs: Regen docshelper
b661132e0 Merge commit 'ef6f101e75'
ef6f101e7 Squashed 'docs/' changes from 2c0125b52..1214f6ffb
d59541903 related: Handly []any
671f64b2e Fix permalinks issue with repeated sections
2fb40ece5 tpl/strings: Add findRESubmatch
c6b388769 config/security: Add O\w+ (e.g. GOROOT) to the default allowed list
21af5b359 Preserve front matter slice value types (e.g. int)
f38a2fbd2 Make hugo.toml the new config.toml
6a579ebac Add fill HTTP Response info into .Data in resources.GetRemote
f13531e60 Fix HEAD method in resources.GetRemote
b5d485060 Fix order when reading custom headers in resources.GetRemote
6e9fa9e0f deps: Upgrade github.com/evanw/esbuild v0.15.18 => v0.17.0
c4f3a46ce Update README.md
fbc3e08c6 resource: Fix Go Doc vs .Data.Integrity
e402d91ee Misc doc, code refactoring to improve documentation
3c51625c7 Make readFile return nil when file not found (note)
dd6d0a6de Remove reference to Goreleaser in code comment
f95fd57aa tpl/compare: Sort special float values as string
e754d5cb3 tpl/diagrams: Move Goat to its own file
002cd5280 Update CONTRIBUTING.md
a76c405d4 Update CONTRIBUTING.md
c0a03a2a3 Update README.md
e127d3e5c releaser: Prepare repository for 0.110.0-DEV
47b12b83e releaser: Bump versions for release of 0.109.0
180dfeba0 Adjust "you need the extended version" error message
10bb29d7f docs: Regen docs helper JSON
eb0c8f9d0 resource/page: Slight adjustment of Page.Ancestors
3a216186b resource/page: Add Page.Ancestors
7874b9681 build(deps): bump golang.org/x/tools from 0.3.0 to 0.4.0
71832328f Annotate test assertions
37ab1cf12 hugolib: Exclude non-linkable pages from translations map
59af05cab Add HUGO_PUBLISHDIR to the Node environment
4989da653 Revert "tpl/tplimpl: Use https in sitemap templates"
cd1ed563a tpl: Improve template funcs GoDoc
aa2c72419 tpl/resources: Fix data race in ToCSS
effa6a422 tocss: Add some more test cases
5d5f0a237 tocss: Fix unquote case with double quotes
d20d2651e Allow "fast render mode" even if --disableLiveReload is set
41a080b26 tocss: Add vars option
41bc6f702 Squashed 'docs/' changes from 2201ac0e5..2c0125b52
9a215d695 Merge commit '41bc6f702a'
eda1e720c modules: Improve "module workspace" not found error
330fa8941 modules: Adjust watch logic vs workspace use definitions
6db527483 Add any configured Go Workspace file to the config watcher
0d4b17d4c modules: Make the module.workspace=off as default (note)
3afaca758 release: Add a note section in release notes
2d217cba5 helpers: Allow at signs in UnicodeSanitize (note)
17055d1fa parser/metadecoders: Remove superflous cast in test
2a81a4949 parser/metadecoders: Simplify nil check in Unmarshal
e30d711c2 parser/metadecoders: Add empty /data JSON file as empty map
ad2059878 Also consider wrapped errors when checking for file IsNotExist errors
87e898a17 tpl/openapi3: Wrap *kopenapi3.T
b54de1bd9 resources/js: Fix some import discrepancies between Hugo and ESBuild
c9354d546 github: Update to Dart Sass 1.56.2
d89426985 github: Use ruby/setup-ruby
3fd0b7849 tpl/tplimpl: Use https in sitemap templates
e0e63f35e parser/metadecoders: Fix spelling
cc574ef12 releaser: Prepare repository for 0.109.0-DEV
a0d64a46e releaser: Bump versions for release of 0.108.0
f97544a83 Make the hugo env non verbose output slightly more verbose
d8efe085c Add dart-sass-embedded version info to hugo env -v
f5b5b71c6 deps: Upgrade github.com/bep/godartsass v0.15.0 => v0.16.0
b82b547ac tpl/embedded: Make Open Graph's series optional
da670c38e Squashed 'docs/' changes from 4c1309cdf..2201ac0e5
c9f2fa266 Merge commit 'da670c38ee'
5067775a6 common/hugio: Fix multiWriteCloser.Close
50549c867 build(deps): bump github.com/getkin/kin-openapi from 0.109.0 to 0.110.0
de9c5542c docs: Add basic doc for wrapStandAloneImageWithinParagraph etc.
e93138dfd dartsass: Add sourceMapIncludeSources option
7d16c3c0c github: Update Dart Sass Embedded to 1.56.1
63126c635 markup/goldmark: Add removeSurroundingParagraph for Markdown images
535ea8cc9 build(deps): bump github.com/evanw/esbuild from 0.15.16 to 0.15.18
8bbec426c build(deps): bump golang.org/x/text from 0.4.0 to 0.5.0
0bfa293dc build(deps): bump github.com/evanw/esbuild from 0.15.15 to 0.15.16
0b976d2b4 tpl/tplimpl: Allow alternate comment syntax
a49e51fd0 resources: Increase timeout for http.Client
d373774cb tpl/collections: Fix some index cases where the indices given is a slice and be more lenient with nil inputs
7d5e3ab8a tpl: Misco GoDoc improvements
dc44bca96 config/security: Add CI env var to whitelist
da1652789 Squashed 'docs/' changes from 32cb8785e..4c1309cdf
ef518485c Merge commit 'da16527896'
83080df61 deps: Upgrade github.com/bep/godartsass v0.14.0 => v0.15.0
b8d5c378b tpl: Use consistent delimiter spacing in examples
75f782a5a docs: Regen docs helper
2221b5b30 releaser: Bump versions for release of 0.107.0
6a004b8d9 build(deps): bump github.com/getkin/kin-openapi from 0.108.0 to 0.109.0
092362242 build(deps): bump github.com/evanw/esbuild from 0.15.14 to 0.15.15
7855b47f0 Add a cache for lexers.Get
34d1150d9 markup/goldmark: Improve benchmark
85e2ac1a4 commands: Create assets directory with new site
74776726d build(deps): bump github.com/frankban/quicktest from 1.14.3 to 1.14.4
63f7f0ff5 build(deps): bump golang.org/x/tools from 0.2.0 to 0.3.0
bcb62d891 deps: Upgrade github.com/alecthomas/chroma/v2 v2.4.0
00fe7e040 hugo/parser: Fix shortcode boolean param parsing
df85cb9ae releaser: Prepare repository for 0.107.0-DEV
e08ce30fe releaser: Bump versions for release of 0.106.0
a99fed485 resources/tpl: Add a test for resources.Get
db945a6ed tlp/resources: resources.Get returns nil when given empty string
bafb389b3 build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.4 to 2.0.6
0a019a1a5 docs: Regen CLI docs
9f7fb0a73 docs: Regenerate docs helper
f04cc581e Merge commit '00c4484c70'
00c4484c7 Squashed 'docs/' changes from 392668f4f..32cb8785e
cdd83bf3c build(deps): bump github.com/evanw/esbuild from 0.15.13 to 0.15.14
e00220a06 deps: Update the libweb version string
a662ddae1 deps: Upgrade github.com/bep/gowebp v0.1.0 => v0.2.0
13adf3e02 readme: Update ToC
fe08d35f2 build(deps): bump github.com/yuin/goldmark from 1.5.2 to 1.5.3
4b675ddd4 build(deps): bump github.com/spf13/afero from 1.9.2 to 1.9.3
24eaa290c build(deps): bump github.com/getkin/kin-openapi from 0.107.0 to 0.108.0
f6ab9553f tpl/internal: Sync go_templates
58a98c775 build(deps): bump github.com/clbanning/mxj/v2 from 2.5.6 to 2.5.7
900904fd1 build(deps): bump golang.org/x/net from 0.1.0 to 0.2.0
24eca0cbe build(deps): bump github.com/evanw/esbuild from 0.15.12 to 0.15.13
60e0e2c1d Add Go 1.16+ install method to README
52ea07d2e Fix taxonomy weight sort regression
77fc74a5b releaser: Prepare repository for 0.106.0-DEV
0e3b42b4a releaser: Bump versions for release of 0.105.0
f50585442 build(deps): bump golang.org/x/tools from 0.1.12 to 0.2.0
2aedccc9a build(deps): bump github.com/getkin/kin-openapi from 0.106.0 to 0.107.0
c10931404 build(deps): bump golang.org/x/text from 0.3.7 to 0.4.0
4732c47d1 build(deps): bump github.com/spf13/cobra from 1.5.0 to 1.6.1
62780ec8d build(deps): bump github.com/getkin/kin-openapi from 0.103.0 to 0.106.0
351d6b062 build(deps): bump github.com/tdewolff/minify/v2 from 2.12.1 to 2.12.4
631d768be Revise the fix for shortcode vs output format nilpointer
e5d2a8f6a Avoid nilpointer when shortcode page content output nil
00ff161b6 livereload: Use text/javascript here, too
588710a7a media: Rename application/javascript, application/typescript to text/javascript etc.
ed930db2f build(deps): bump github.com/yuin/goldmark from 1.4.15 to 1.5.2
05df96481 build(deps): bump github.com/fsnotify/fsnotify from 1.5.4 to 1.6.0
20ef6dcf9 Skip flakey server tests on GitHub Action on Windows
9860e0e18 build(deps): bump github.com/magefile/mage from 1.13.0 to 1.14.0
d1cd1db0e github: Avoid duplicate test runs
09e10110a tpl/encoding: Add noHTMLEscape option to jsonify
2ef60dbd2 build(deps): bump github.com/evanw/esbuild from 0.15.9 to 0.15.12
6275aad9e Update Go and Alpine version in Dockerfile
01ebb6e30 Don't use self-closing generator tag
a066e9885 build: Update to Go 1.19.2
1fd3320dc github: Use SHA versions
0fb2b3d14 Resolve dependency-path not found error in workflow
db05232d5 Use setup-go action to cache dependencies
2734f956c releaser: Prepare repository for 0.105.0-DEV
58b824581 releaser: Bump versions for release of 0.104.3
ec57cf2c3 resources: Update golden image dithering exception list
3a9cb7b0f resources/images: Fix 2 animated GIF resize issues
0addb302a server: Fix flaky TestServerPathEncodingIssues tests
b002d4795 commands: Remove extraneous newline from result of convert toTOML
e3f31352d config/security: Fix filename
ec02c537e releaser: Prepare repository for 0.105.0-DEV
84cbe7249 releaser: Bump versions for release of 0.104.2
4611b6920 Fix htimes /: operation not permitted error on config changes
2171e3c9a Revert "Adjust a test"
cac773aef Adjust a test
51010a69b releaser: Prepare repository for 0.105.0-DEV
8958b8741 releaser: Bump versions for release of 0.104.1
29ccb3606 Fix /static performance regression from Hugo 0.103.0
d8aba18e0 releaser: Prepare repository for 0.105.0-DEV
c744dbd6e releaser: Bump versions for release of 0.104.0
5c4165336 Consolidate the glob case logic
281554ee9 hugofs: Fix glob case-sensitivity bug
f3560aa0e server: Fix 404 redirects on Windows
edf9038a9 build(deps): bump github.com/evanw/esbuild from 0.15.8 to 0.15.9
78f49b4c0 build(deps): bump github.com/yuin/goldmark from 1.4.14 to 1.4.15
fa4b77e7e build(deps): bump github.com/getkin/kin-openapi from 0.100.0 to 0.103.0
8377c3cea docs: Regen docs helper
4d909d476 build(deps): bump github.com/alecthomas/chroma/v2 from 2.2.0 to 2.3.0
4eb6d9740 build(deps): bump github.com/evanw/esbuild from 0.15.7 to 0.15.8
4f9cb4f34 docs: Regenerate CLI docs
0171fb201 Run go mod tidy
a4028112e resources/images: Add $image.Colors
08f0984f9 commands: Skip flaky test on CI
86653fa38 config/security: Allow proxy variables in subcommands
c46d10498 releaser: Prepare repository for 0.104.0-DEV
b665f1e8f releaser: Bump versions for release of 0.103.1
6be6752c8 server: Fix redirects when file path contains bytes > 0x80
8e9dce109 Merge branch 'release-0.103.0'
00b71668b releaser: Prepare repository for 0.104.0-DEV
beebf2afb releaser: Bump versions for release of 0.103.0
3f0b40f67 Use standard GOOS/GOARCH values in release archives
0bd79d30c Use standard GOOS/GOARCH values in release archives
8e77bcc93 Filter out any duplicate files to post process
74daca6b3 Support PostProcess for all file types
1fd4c562a build(deps): bump github.com/gobuffalo/flect from 0.2.5 to 0.3.0
a5cda5ca4 server: Add 404 support
5e2b28d6e build(deps): bump github.com/getkin/kin-openapi from 0.98.0 to 0.100.0
f2019f0a2 build(deps): bump github.com/evanw/esbuild from 0.15.5 to 0.15.7
475638fe0 build(deps): bump github.com/yuin/goldmark from 1.4.13 to 1.4.14
203cc5457 Feat/sponsors in readme (#10273)
90ad80450 Squashed 'docs/' changes from e5aa641a6..392668f4f
af23cdca9 Merge commit '90ad804505'
ab5ce5989 Fix usage description
7d40da876 Add `--force` to `hugo new`
02c89a446 scss: Handle single-file sourcemaps correctly
06c3ac674 release: Bump Hugoreleaser version
5e03de0dd Update stale.yml
bef31b58a releaser: Prepare repository for 0.103.0-DEV
b76146b12 releaser: Bump versions for release of 0.102.3
8e5044d7f Fix shortcode parser regression with quoted param values
5046a6c7c deps: Update github.com/tdewolff/minify/v2 v2.12.0 => v2.12.1
160a067c8 snap: Use "snapcraftctl set-grade"
e0ba1a805 snap: Use "snapcraftctl set-version"
7b49c56a6 snap: Make external dependencies actually work
dffca5788 release: Add the releaser commits to the ignore list
79932e722 release: Fix the Deb archives
9eb9b70a2 releaser: Prepare repository for 0.103.0-DEV
0ff4a9326 releaser: Bump versions for release of 0.102.0
45e1084ff Add linux/arm64 extended to release setup
c98348416 license: Add copyright info
2de393c79 build(deps): bump go.uber.org/atomic from 1.9.0 to 1.10.0
7efb35680 build(deps): bump github.com/kyokomi/emoji/v2 from 2.2.9 to 2.2.10
ddbcc6712 build(deps): bump github.com/getkin/kin-openapi from 0.97.0 to 0.98.0
fd75f129b deps: Update github.com/pelletier/go-toml/v2 v2.0.2 => v2.0.4
14878ca0a build(deps): bump github.com/spf13/afero from 1.8.2 to 1.9.2
e88873b80 build(deps): bump github.com/tdewolff/parse/v2 from 2.6.1 to 2.6.2
4219993b0 build(deps): bump github.com/mattn/go-isatty from 0.0.14 to 0.0.16
988e1417a build(deps): bump github.com/rogpeppe/go-internal from 1.8.1 to 1.9.0
42529882c build(deps): bump github.com/yuin/goldmark from 1.4.12 to 1.4.13
45f1b1cfc build(deps): bump github.com/spf13/cobra from 1.4.0 to 1.5.0
369bdf22f build(deps): bump github.com/tdewolff/minify/v2 from 2.11.10 to 2.12.0
d1b03a093 build(deps): bump github.com/evanw/esbuild from 0.14.43 to 0.15.5
941c28ab0 readme: Add Golang URL to Go links
ffbdcc75a Update README.md
95d976451 Update README.md
b66f9f266 Update README.md
f7e00c039 github: Use GitHub's Choco-Install function to retry installs
f5ba6fd45 common/hugio: One more fix for non-OS fs
c4bbc1eee common/hugio: Fix CopyDir when fs is not OS
0e0fb1b64 snap: Delete obsolete custom x-nodejs plugins
b017f7cb0 livereload: Inject script without head or body tag
7fb28085a releaser: Fat MacOS binaries
0cd1929b9 Update to Go 1.19
cbdaff213 markup/goldmark/codeblock: Fix attributes when no language identifier in CodeBlock
3fefea06b commands: Fix embed in livereload.go
5c48ba934 Update README.md
21562e3aa Externalise and embed livereload.js string
9c24b86e4 Cache when not found in LookupLayout
223bf2800 parser/pageparser: Don't store the byte slices
72b0ccdb0 Make the baseline benchmark's test files stable
bdf935d66 Squashed 'docs/' changes from 30f32a624..e5aa641a6
65e52a7f5 Merge commit 'bdf935d66c'
8ebcaa539 Accept vendor-specified build date if .git/ is unavailable
241481931 snap: Replace mage with "go build" and set VendorInfo=snap
5caed8a71 snap: Use interface names etc-gitconfig and gitconfig, Take 2
d1278f696 Extract the baseline benchmark to a test
92f31ae63 Add a baseline benchmark
fd3953c18 snap: Use interface names etc-gitconfig and gitconfig
15463f835 releaser: Prepare repository for 0.102.0-DEV
466fa43c1 releaser: Bump versions for release of 0.101.0
6072ce0bc releaser: Add release notes for 0.101.0 [ci skip]
2c5943ddc build: Update to Go 1.18.3
0cb459a20 docs: Regen docshelper
475f87f68 Squashed 'docs/' changes from 96fdc246c..30f32a624
604cfffc5 Merge commit '475f87f685'
d863dde6c markup/highlight: Add hl_inline option
580b214a4 deps: Update github.com/alecthomas/chroma/v2 v2.1.0 => v2.2.0
ddb954708 build(deps): bump github.com/clbanning/mxj/v2 from 2.5.5 to 2.5.6
288b0fb15 build(deps): bump github.com/pelletier/go-toml/v2 from 2.0.1 to 2.0.2
3e1344632 build(deps): bump golang.org/x/tools from 0.1.10 to 0.1.11
7a9ce0eca build(deps): bump github.com/tdewolff/minify/v2 from 2.11.5 to 2.11.10
f2ba0cc8c build(deps): bump github.com/evanw/esbuild from 0.14.42 to 0.14.43
62ceaabdc build(deps): bump github.com/getkin/kin-openapi from 0.94.0 to 0.97.0
35fa19283 deps: Udpate to github.com/alecthomas/chroma/v2
09ac73338 common: Add hugo.GoVersion
66da1b7b2 resources: Panic on Copy of Resource with .Err
5a9ecb82a resources/page: Add :slugorfilename attribute
cbc35c48d Respect NO_COLOR
44f3c0796 readme: Update dependency list
a5a4422aa Fix relURL with leading slash when baseURL includes a subdirectory
617e09448 js: Resolve index.esm.js
cf12fa616 Add animated GIF support
2e1c81770 resources: Add a Gif source file to golden tests
4276075c7 releaser: Prepare repository for 0.101.0-DEV
d25cb2943 releaser: Bump versions for release of 0.100.2
8b9bdc403 releaser: Add release notes for 0.100.2 [ci skip]
4e94d1db7 Update CONTRIBUTING.md
0566bbf7c Fix raw TOML dates in where/eq
534e7155b deps: Update to github.com/pelletier/go-toml/v2 v2.0.1
953f215f3 tpl/path: Add path.BaseName function
8e2fd5592 livereload: Use `X-Forwarded-Host` for Codespace
311b8008b helpers: Fix panic with invalid defaultMarkdownHandler
c7d5f9f06 resources: Register MediaTypes before build
bfebd8c02 releaser: Prepare repository for 0.101.0-DEV
0afb4866e releaser: Bump versions for release of 0.100.1
b1ec0c226 releaser: Add release notes for 0.100.1 [ci skip]
212d9e301 Fix panic with markdownify/RenderString with shortcode on Page with no content file
4daac654d releaser: Prepare repository for 0.101.0-DEV
27b077544 releaser: Bump versions for release of 0.100.0
0f8343a2c releaser: Add release notes for 0.100.0 [ci skip]
3fcbee261 docs: Regen CLI docs
db9d27427 docs: Regen docs helper
95baafeac Merge commit 'e4bfe59c4e'
e4bfe59c4 Squashed 'docs/' changes from 2d9da3a56..96fdc246c
6f7bf3f2d Fix indentation in highlight shortcode
9e904d756 Make .RenderString render shortcodes
d2cfaede5 Improve shortcode indentation handling
322d19a81 Add Markdown as an output format
7cb484e12 build(deps): bump github.com/evanw/esbuild from 0.14.39 to 0.14.42
0b395f0b4 Run go mod tidy
c1a83076b Add a shortcode benchmark
0f8dc4703 Remove Blackfriday markdown engine
3b478f50b Fix HasMenuCurrent and IsDescendant/IsAncestor when comparing to itself
f343b8eb7 build(deps): bump github.com/sanity-io/litter from 1.5.4 to 1.5.5
60ede146b deps: Update to github.com/tdewolff/minify/v2 v2.11.5
dd9eaf19f Don't use the baseURL /path as part of the resource cache key
46a2ea6d0 postcss: Make the resource cache key more stable
653ab2cc1 commands: Fix case where languages cannot be configured
52edea0fe github: Set HUGO_BUILD_TAGS: extended when running tests
6a5acd753 metrics: Fix divide by zero error
805b21555 Fix error message when PostCSS config file is not found
8ca705252 server: Skip watching dirs in ignoreFiles
bb232a351 resources: Improve error message on .Resize etc. on SVGs
3854a6fa6 Fix Plainify edge cases
cd0112a05 Add resources.Copy
6f7fbe03b basefs: add `noBuildLock` flag
2fc2e9c87 import: Fix importing jekyll site
e164834f0 releaser: Prepare repository for 0.100.0-DEV
d52406738 releaser: Bump versions for release of 0.99.1
31ce89f7f releaser: Add release notes for 0.99.1 [ci skip]
ee55fde5e releaser: Fix version replacement
2f9eac480 server: Fix multihost crash
3a8189ee9 Update stale.yml
7bc3401eb common/hugo: Fix version logic
1de333e7a releaser: Bump versions for release of 0.99.0
35cb6eefb releaser: Add release notes for 0.99.0 [ci skip]
657d1a2d9 server: Refresh the error template
87a22eb6d server: Fix SIGINT handling after loading bad configuration
fc9f315d8 Improve SASS errors
4b189d8fd postcss: Fix import error handling
c2fa0a332 build(deps): bump github.com/fsnotify/fsnotify from 1.5.3 to 1.5.4
48ea24f89 common/herrors: Remove unused struct
9f563856c build(deps): bump github.com/evanw/esbuild from 0.14.38 to 0.14.39
5c96bda70 errors: Misc improvements
4a96df96d server: Always rebuild the files involved in an error
e8537e6dd postcss: Fix line numbers in error messages
2fbdee726 Update CONTRIBUTING.md
91fe1b6c6 js: Bump test dependency
7de629121 deps: Update github.com/spf13/cast v1.4.1 => v1.5.0
9d7f16624 hugolib: Check for nil in shouldRender
51f08b0b6 Revise the use of htime.Since/htime.Now
860c51c31 tpl/collections: Make sort stable
855e5869c docs: Regen CLI docs
327aaed6d Squashed 'docs/' changes from 7030fe3a2..2d9da3a56
1c7759028 Merge commit '327aaed6d8'
35c88a7f9 Use configured timeZone for the clock
e77ca3c10 Add `clock` cli flag
f2946da9e Improve error messages, esp. when the server is running
6eea32bd6 tpl: Improve godoc
a6d545854 github: Add permissions to test action
e5f217316 tpl/crypto: Add example for FNV32a
89c1655ec releaser: Prepare repository for 0.99.0-DEV
165d299cd releaser: Bump versions for release of 0.98.0
e94dc6710 releaser: Add release notes for 0.98.0 [ci skip]
a4fff5753 docs: Regen docs helper
3902f9a47 Squashed 'docs/' changes from 4c5edacfe..7030fe3a2
4852a3765 Merge commit '3902f9a476'
fa80fe3c8 Some godoc adjustments and image struct renames
11047534e tpl/crypto: Add FNV32a
d7b54a4c3 markup/goldmark: Fix attribute nilpointer
13ceef759 deps: Update to gocloud.dev v0.24.0
942d0dd2c build(deps): bump github.com/mitchellh/mapstructure from 1.4.3 to 1.5.0
a022ca271 deps: Update github.com/yuin/goldmark v1.4.11 => v1.4.12
d56b33955 build(deps): bump github.com/evanw/esbuild from 0.14.36 to 0.14.38
55e28c239 deps: Update github.com/tdewolff/minify/v2 v2.11.1 => v2.11.2
9a888c243 Some godoc adjustments
05b45c35c tpl/lang: Handle nil values in lang.Merge
625be77e0 resources/page: Mark some more interface methods as internal
097fd588c Deprecate page.Author and page.Authors
41cc4e4ba releaser: Prepare repository for 0.98.0-DEV
078053a43 releaser: Bump versions for release of 0.97.3
7d9f88808 releaser: Add release notes for 0.97.3 [ci skip]
9b352f04a Fix syncing of /static regression
e66e2e9ce Revert "Revert "Fix PostProcess regression for hugo server""
5de6f8a02 releaser: Prepare repository for 0.98.0-DEV
5099abe60 releaser: Bump versions for release of 0.97.2
99ec88d42 releaser: Add release notes for 0.97.2 [ci skip]
6c35a1a9e Revert "Fix PostProcess regression for hugo server"
363bc907c releaser: Prepare repository for 0.98.0-DEV
04efcb2a6 releaser: Bump versions for release of 0.97.1
456072552 releaser: Add release notes for 0.97.1 [ci skip]
4deb5c606 Fix PostProcess regression for hugo server
397fce560 Fix MediaType when reading images from cache
0093eaa68 deps: Upgrade github.com/bep/overlayfs v0.4.0 => v0.5.0
d0f731c03 releaser: Prepare repository for 0.98.0-DEV
c07f3626e releaser: Bump versions for release of 0.97.0
42b5d1653 releaser: Add release notes for 0.97.0 [ci skip]
d80d5a104 releaser: Reduce parallelism
842262f65 Revert "build(deps): bump gocloud.dev from 0.20.0 to 0.25.0"
2dbdf38a5 resources: Add `key` to reources.GetRemote options map
f8c4e1690 build(deps): bump github.com/evanw/esbuild from 0.14.34 to 0.14.36
627eed1d6 Make string sorting (e.g. ByTitle, ByLinkTitle and ByParam) language aware
82ba634ed Fix gosum checksum errors
d417a6cf7 build(deps): bump github.com/tdewolff/minify/v2 from 2.11.0 to 2.11.1
13dac7f3c compare: Add a string sort benchmark
30c2e54c2 Replace all usage of  CopyOnWriteFs with OverlayFs
3117e5859 deps: Update github.com/tdewolff/minify/v2 v2.10.0 => v2.11.0
ec920363c Squashed 'docs/' changes from 63386081c..4c5edacfe
5b5dcb8d5 Merge commit 'ec920363cd'
ffe3eb919 docs: Regen CLI docs
d070bdf10 Rework the Destination filesystem to make --renderStaticToDisk work
b08193971 Revert "Revert "Some minor adjustments to the new static filesystem logic""
0a56f2af4 Revert "Revert "Allow rendering static files to disk and dynamic to memory in server mode""
9e360d384 build(deps): bump github.com/evanw/esbuild from 0.14.31 to 0.14.34
a8c221d33 modules/client: Vendor config directory if present
e58a54089 resources: Create a common ResourceFinder interface
20162518c build(deps): bump gocloud.dev from 0.20.0 to 0.25.0
6b469cc8f build(deps): bump golang.org/x/tools from 0.1.9 to 0.1.10
080dcac6b build(deps): bump github.com/magefile/mage from 1.12.1 to 1.13.0
072fc8cc3 build(deps): bump github.com/gobuffalo/flect from 0.2.4 to 0.2.5
658e11eba Localize all the GroupBy*Date methods
e0a882fd3 build(deps): bump github.com/getkin/kin-openapi from 0.93.0 to 0.94.0
d0657a436 deploy: Set an MD5 attribute and use that if eTag not available
a6e2e38bb build(deps): bump github.com/sanity-io/litter from 1.5.2 to 1.5.4
510e17900 build(deps): bump github.com/evanw/esbuild from 0.14.25 to 0.14.31
21484f9e1 build(deps): bump github.com/frankban/quicktest from 1.14.2 to 1.14.3
da00e7714 Add environment as a new filter to _cascade.target
ed9aa374d Merge branch 'release-0.96.0'
2a231b0b5 Snap: Add {system,user}-gitconfig plugs to read gitconfig (#9619)
69c590080 releaser: Prepare repository for 0.97.0-DEV
2fd4a7d3d releaser: Bump versions for release of 0.96.0
5a4ac2dac releaser: Add release notes for 0.96.0 [ci skip]
db1562e13 docs: Regen docshelper
5b18e1084 docs: Regen CLI docs
d276e901b Squashed 'docs/' changes from a393f4cf4..63386081c
d7497b28c Merge commit 'd276e901b3'
94459680b Deprecate .File.Extension
9202117ba resources: Add more details to .Err
a6fa290f6 commands: Change link protocol to https
0bbc2fb52 build(deps): bump github.com/getkin/kin-openapi from 0.91.0 to 0.93.0
94e8a9076 tpl/crypto: Add optional encoding arg to hmac function
a461e9d01 Fix typo
48c98a8d2 Fix some typos
bbd455fe7 Update CONTRIBUTING.md to use "go install" to install mage
8309a2b1c Dockerfile: Make it build with Go 1.18
2b7231097 snap: Make it build with Go 1.18
13ff4ded7 build(deps): bump github.com/yuin/goldmark from 1.4.10 to 1.4.11
c3289eb5b build(deps): bump github.com/spf13/cobra from 1.3.0 to 1.4.0
9539069f5 commands: Improve server startup to make tests less flaky
0e305d695 all: Use strings.Cut
5adb81ce3 Support '-u=patch' in hugo mod get
1c0e7c1ae Make sure file mounts higher up wins
cad2d8cc7 resources/images: Require width and height for Crop, Fill, and Fit
b80853de9 all: gofmt -w -r 'interface{} -> any' .
423594e03 dartsass: Enable deprecation, @warn and @debug logging
64afb7ca5 Use revision etc. from debug.BuildInfo
004bec2e9 releaser: Prepare repository for 0.96.0-DEV
9f2e76af6 releaser: Bump versions for release of 0.95.0
f1d157682 releaser: Add release notes for 0.95.0 [ci skip]
5930173cd readme: Add note about Go 1.18
3476b5334 tpl: Pull in Go 1.18 patch that fixes the "no space in {{ continue }} and {{ break }}" bug
e792d2701 readme: Add a contribution note
9d6495d77 github: Make it build with Go 1.18
42cc5f88b tpl: Adjustments and an integration test for Go 1.18
a6488e7ba Remove Go 1.17 support
65a78cae1 tpl: Sync go_templates for Go 1.18
4d6d1d08d build: Bump to Go 1.18
b60e1bbdf dartsass: Improve error message when no read access
61cf3c9f6 Fix and refactor typos
31fbc081c Improve server startup/shutdown
cebd886ac commands: Improve server tests
38f778cfc releaser: Prepare repository for 0.95.0-DEV
48fb9e4de releaser: Bump versions for release of 0.94.2
0958167b3 releaser: Add release notes for 0.94.2 [ci skip]
b37183e48 deps: Update github.com/yuin/goldmark v1.4.9 => v1.4.10
04ccde3e9 releaser: Prepare repository for 0.95.0-DEV
0fcd9a5d8 releaser: Bump versions for release of 0.94.1
414608436 releaser: Add release notes for 0.94.1 [ci skip]
3bc742bea docs: Regenerate CLI docs
1a796d723 deps: Fix Goldmark regression with HTML comments
64b7b7a89 Revert "Allow rendering static files to disk and dynamic to memory in server mode"
5ef8a9f32 Revert "Some minor adjustments to the new static filesystem logic"
3bc34666c releaser: Prepare repository for 0.95.0-DEV
63b236603 releaser: Bump versions for release of 0.94.0
b107b4b29 releaser: Add release notes for 0.94.0 [ci skip]
a4ac188c1 docs: Regenerate docshelper
b82d95575 Revert "markup/highlight: Add hl_inline option"
4e14cf760 Fail with error when double-rendering text in markdownify/RenderString
5697348e1 markup/goldmark: Default to https for linkify
f98e570b1 Add lang attribute to internal alias template
cdb8b0842 docs: Regenerate docshelper
a360cab75 markup/highlight: Add hl_inline option
c97fed08f minifiers: Make keepWhitespace = false default for HTML (note)
53a6210d8 markup/goldmark/codeblocks: Fix slice bounds out of range
7182809d9 docs: Regenerate CLI docs
1f8cd2614 docs: Regenerate docshelper
9d76b8fa3 Merge commit 'd706529720'
d70652972 Squashed 'docs/' changes from 3f95a2ace..a393f4cf4
4576c82ed Cache reflect.MethodByName
ff02d4172 releaser: Remove the GitHub link syntax around release contributors
63bb2a5b1 Some minor adjustments to the new static filesystem logic
7d8011ed6 Allow rendering static files to disk and dynamic to memory in server mode
b9a1be2f9 build(deps): bump github.com/kyokomi/emoji/v2 from 2.2.8 to 2.2.9
097824503 build(deps): bump github.com/evanw/esbuild from 0.14.23 to 0.14.25
ff37df830 build(deps): bump github.com/niklasfasching/go-org from 1.6.0 to 1.6.2
5857d5524 build(deps): bump github.com/getkin/kin-openapi from 0.90.0 to 0.91.0
d86eca5bb releaser: Prepare repository for 0.94.0-DEV
44e3c002a releaser: Bump versions for release of 0.93.3
9177849f9 releaser: Add release notes for 0.93.3 [ci skip]
0e0d672bc Remove the decorator from the fs used in ReadDir
19f816f77 Update stale.yml
970f385c4 build(deps): bump github.com/yuin/goldmark from 1.4.7 to 1.4.8
76c1248f7 Remove the examples/ folder
9e76507da releaser: Prepare repository for 0.94.0-DEV
643b5ae9c releaser: Bump versions for release of 0.93.2
2f7feca9a releaser: Add release notes for 0.93.2 [ci skip]
673cde1eb tpl/os: Revert readDir in theme behaviour
e46e9ceb2 markup/goldmark: Escape image alt attribute
883e71c96 releaser: Prepare repository for 0.94.0-DEV
e9669fed1 releaser: Bump versions for release of 0.93.1
fefb1caac releaser: Add release notes for 0.93.1 [ci skip]
0327da050 tpl/transform: Fix it when template.HTML is passes as option to Hightlight
9b8b6d34e tpl/partials: Fix partialCached deadlock regression
376704d38 tpl/collections: Fix apply when function have Context as first arg
c1398b91a Squashed 'docs/' changes from 93f7baf80..3f95a2ace
41b5bc963 Merge commit 'c1398b91a9'
5a1b394f2 releaser: Prepare repository for 0.94.0-DEV
074690824 releaser: Bump versions for release of 0.93.0
75084bfc7 releaser: Add release notes for 0.93.0 [ci skip]
12d00d288 docs: Regenerate docs helper
260ff1374 markup/highlight: Ignore  HL_lines_parsed in the gen docs
14915a0c3 cod: Regen CLI docs
fd0c1a5e9 tpl/diagrams: Rename the SVG accessor to Wrapped
3ad39001d markup/highlight: Rework the return value from HighlightCodeblock
39261b689 tpl/transform: Add CanHighlight
cff14144a Rename Codeowners() to CodeOwners()
5f6715155 tpl/diagrams: Rename Body to Inner
f7109771a CodeblockContext method renames
e1f696911 build(deps): bump github.com/tdewolff/minify/v2 from 2.9.29 to 2.10.0
5f65c17a1 markup/goldmark: Adjust test for Windows
579ff9b65 markup/goldmark: Improve attributes vs options
928a89696 markup/goldmark: Add Position to CodeblockContext
2e54c0093  markup/goldmark: Unify some code block tests
10928a4f7 Remove the trailing new line in .Code
afd63bf7d markup/goldmark: Rename extension struct
228126b7f build(deps): bump github.com/gobuffalo/flect from 0.2.3 to 0.2.4
0f80be341 markup/goldmark: Use Ordinal to create default lineanchors
78afdb88a build(deps): bump github.com/gorilla/websocket from 1.4.2 to 1.5.0
3ed83227b build(deps): bump github.com/sanity-io/litter from 1.5.1 to 1.5.2
1a257bb2b Move the Goat template to the correct place
97514f17d build(deps): bump google.golang.org/api from 0.63.0 to 0.70.0
0df096b86 Update error message about failed menus in config.toml
308ad611b build(deps): bump github.com/getkin/kin-openapi from 0.85.0 to 0.90.0
6bffcdbd2 Add test for line anchor attributes with code fences
7248f4318 build(deps): bump github.com/evanw/esbuild from 0.14.22 to 0.14.23
08fdca9d9 Add Markdown diagrams and render hooks for code blocks
2c20f5bc0 build(deps): bump github.com/aws/aws-sdk-go from 1.41.14 to 1.43.5
723b2c485 build(deps): bump github.com/google/go-cmp from 0.5.6 to 0.5.7
06bac57ab Add support for CODEOWNERS
ec8b767fa Remove Viper as a dependency
6407b2cd0 helpers: Allow hyphens in UnicodeSanitize
6ff39fd90 Change `disqus_config` to `window.disqus_config`
96c0bdf3a deps: Update github.com/spf13/cobra v1.2.1 => v1.3.0
e97d3c640 Add page.Store
7732da9f9 Allow images to be cropped without being resized
aebde49b8 commands: Fix server panic regression
4ada09415 markup/goldmark: Add BenchmarkCodeblocks
bddcfd911 deps: Update github.com/gohugoio/localescompressed v0.14.0 => v0.15.0
d485f9543 deps: Update github.com/yuin/goldmark v1.4.4 => v1.4.7
a87be597a modules: Add modules.Workspace config for Go 1.18
b0eea0075 Update stale.yml
ef8b781b1 Update stale.yml
3136ff67d github: Configure stale to be run manually
929808190 tpl/partials: Fix recently introduced deadlock in partials cache
667f3a4ba tpl/partials: Add some more partials to BenchmarkIncludeCached
c061b253a deps: Update github.com/evanw/esbuild v0.14.11 => v0.14.22
0927cf739 tpl/partials: Make sure a cached partial is invoked only once
26a5e89fa build(deps): bump github.com/rogpeppe/go-internal from 1.8.0 to 1.8.1
e9fa7e81b build(deps): bump github.com/magefile/mage from 1.11.0 to 1.12.1
ff545f427 markup/goldmark: Exclude event attributes from markdown render hook
b2a827c52 markup/goldmark: Fix mangling of headers/links in render hooks
77c7059ff markup/goldmark: Add a render hook benchmark
f4c90bd6b Fix BenchmarkCascadeTarget
d16228334 metrics: Add cached count tracking
ea6bcd694 tpl: Remove TODO comment
f2e7b49ac Add --printUnusedTemplates
923419d7f deps: Update github.com/tdewolff/minify/v2 v2.9.22 => v2.9.29
837fdfdf4 commands: Rename --i18n-warnings to printI18nWarnings
6819feab6 commands: Rename --path-warnings, --print-men to --printPathWarnings, --printMemoryUsage
ea54a99ca deps: Update github.com/alecthomas/chroma v0.9.4 => v0.10.0
9563c7d13 Finally remove deprecated Page methods
230a49594 Squashed 'docs/' changes from b8b20e9a2..93f7baf80
c707b71cd Merge commit '230a495941'
b0a9cf0a7 tpl: Use go:embed to load internal templates
9433cc256 releaser: Prepare repository for 0.93.0-DEV
cdf6a0d62 releaser: Bump versions for release of 0.92.2
bf1fa7137 releaser: Add release notes for 0.92.2 [ci skip]
4f4cec73b Add HUGO_ENV to the os/exec environment
da4866c2b Simplify some integration tests
d1109f590 Fix validation of Page Kind in cascade target map
a7d182cea Add another cascade benchmark
a2a660ed1 commands: Fix server deadlock on config error
f7bc4cc50 Exclude event attributes when rendering markdown
54f8d8a70 Remove the "check" command
3036d0ac9 Update the application/javascript media type
6a238a727 tpl/templates: Fix templates.Exist issue with base templates
f60714b5a Add a migration test helper
215a715dd babel: Port integration tests to their own package
d128d260b js: Port integration tests to its own package
c4aaf1d51 postcss: Move integration test to its own package
94f10cf4f minifier: Port integration tests to its package
b06c2103b templates: Port integration test to its package
d22f7795c tocss: Port integration tests to their package
39f69ca7f openapi3: Port integration test into correct package
64f75adcf Add a new integration test framework
926271909 Validate comparison operator argument count
333676293 Remove hugo gen autocomplete
5ca40c8f7 deps: Update github.com/pelletier/go-toml/v2 to v2.0.0-beta.6
ef7d14a24 Fix erroneous warning with .Page.RenderString on a page without a backing file
c05c99f0c Fix typo in panicOnWarning message
ff7689ce0 releaser: Prepare repository for 0.93.0-DEV
85e2e8626 releaser: Bump versions for release of 0.92.1
515f8a6d8 releaser: Add release notes for 0.92.1 [ci skip]
f22c4aba0 Make the RenderString content provider fix more general
85d31f7bf Fix .RenderString issue in .Translations
22055176d general: Fix issue causing log threads to hang indefinitely when print() panics
7a080b624 Fix duplicate mount sources
265573994 tpl/collections: Fix apply with namespaced template funcs
348d300a7 common: Remove unused code
6f07bdb15 common/paths: Remove unused code
55a9bc1e7 helpers: Remove unused code
20a7ce7c1 Do not render hl_style as an HTML attribute
8cd449240 build(deps): bump github.com/spf13/viper from 1.8.1 to 1.10.1
9d8f318aa Fixing typos (#9387)
fcbbbef22 Fix typo in warning message
6041adc16 github: Clean up the issue templates a little
408da4365 github: Add lock-threads step
ed04ed574 releaser: Prepare repository for 0.93.0-DEV
b35494036 releaser: Bump versions for release of 0.92.0
bd89aef8b releaser: Add release notes for 0.92.0 [ci skip]
f2bc13dd9 docs: Regenerate docshelper
098254f17 Merge commit 'a8e9fc699a'
a8e9fc699 Squashed 'docs/' changes from 4eb10c1a9..b8b20e9a2
cdcd15b6c Only create LazyContentProvider for the non-rendering Site
25d645f47 Fix missing page data for alternative formats
fbb3c181c docs: Add dependency table to maintainance page
9af4ca386 deps: Upgrade github.com/evanw/esbuild v0.14.8 => v0.14.11
7396aa945 Add hugo.Deps
d82cef5c5 hugolib: Fix livereload problem with files including NFC characters in MacOs
74f0777c5 docs. Regen CLI docs
e334a4066 commands: Fix CLI help text for hugo new
5bd3c8df4 Update to Go 1.17.6
0aca99fe0 create: Correctly pass newContentEditor flags
c8b5ab75b Add --panicOnWarning flag
85c5b8959 github: Increase stale days
965760835 docs: Regenerate CLI docs
4a0b55330 docs: Regenerate docshelper
1651beb2c Remove mmark
2b6063c3e Misc depreation updates
56ab83a59 Make the deprecated Page/File methods (from Hugo 0.55) ERROR
dad0dc8d8 github: Add add stale GitHub action
d3c4fdb8f Fix surprise OutputFormat.Rel overwriting
d632dd7d7 hugolib: Make an RST test optional
0671ef559 deps: Upgrade github.com/niklasfasching/go-org v1.5.0 => v1.6.0
672481f1f Update stale.yml
1dbfc0f93 releaser: Prepare repository for 0.92.0-DEV
1798bd3fd releaser: Bump versions for release of 0.91.2
f0b55a68e releaser: Add release notes for 0.91.2 [ci skip]
623dda717 Revert "config/security: Add HOME to default exec env var whitelist"
aee9e11a4 Make sure we always create the /public folder
bd63c1aa5 Fix "stuck on build" in error situations in content processing
9eb05807c deps: Run "go mod tidy"
654f513a4 deps: Upgrade github.com/evanw/esbuild v0.14.7 => v0.14.8
759cdf3fc releaser: Prepare repository for 0.92.0-DEV
f42350574 releaser: Bump versions for release of 0.91.1
af165d5b6 releaser: Add release notes for 0.91.1 [ci skip]
6779117f7 media: Also consider extension in FromContent
ce0401109 media: Add missing BMP and GIF to the default MediaTypes list
cdc73526a media: Add PDF MIME type
425c7d90f deps: Update github.com/evanw/esbuild v0.14.5 => v0.14.7
fca266ebb config/security: Add HOME to default exec env var whitelist
0016e21cd modules: Set GOCACHE env var
728feaecf releaser: Prepare repository for 0.92.0-DEV
d1dc0e9a5 releaser: Bump versions for release of 0.91.0
072bca69d releaser: Add release notes for 0.91.0 [ci skip]
e26e13fbb releaser: Drop running tests as part of the release
6df2f080c docs: Regen docs helper
b84745d49 tpl/resources: Add empty method mapping for GetRemote
44954497b Always use content to resolve content type in resources.GetRemote
22ef5da20 Add resources.GetRemote
5758c370e Allow for return partials with falsy arguments (#9298)
8ee6de6d9 deps: Upgrade github.com/evanw/esbuild v0.14.2 => v0.14.5
a4b9f1a92 don't use path.Join, because it cleans the final path
f4389e48c Add some basic security policies with sensible defaults
803f572e6 Simplify Babel test assertions
6183184b9 Merge commit '45e6fdb315'
45e6fdb31 Squashed 'docs/' changes from 316cec249..4eb10c1a9
a037be774 Improve handling of remote image/jpeg resources (#9278)
8a005538d Fix Dockerfile
657d0272e Remove debug statement
159120cdd Fix deprecation notice
3f0d49e50 releaser: Prepare repository for 0.91.0-DEV
489078897 releaser: Bump versions for release of 0.90.1
3075eaa3b releaser: Add release notes for 0.90.1 [ci skip]
3bc683041 Remove the retries on error in remote resources.Get
e4d6ec94b Allow user to handle/ignore errors in resources.Get
6260455ba Make resource.Get return nil on 404 not found
c397975af Update to Go 1.17.5
965a6cbff Update to Go 1.17.4 and remove timeout in resources.Get
34a96290f releaser: Prepare repository for 0.91.0-DEV
dd0d3fdbb releaser: Bump versions for release of 0.90.0
b92175233 releaser: Add release notes for 0.90.0 [ci skip]
0fa40ce58 releaser: Simplify the release process
bf537f1c6 releaser: Remove unused code
e86b33113 docs: Regenerate docs helper
6c841a691 Merge commit '8d9511a08f'
8d9511a08 Squashed 'docs/' changes from 39a7fac34..316cec249
e71d715b9 Add custom font support to images.Text
e61cdf335 images: Fix cache busting of image text filter
6c3bc5eba build(deps): bump github.com/getkin/kin-openapi from 0.80.0 to 0.85.0
283394a4f images: Text filter that draws text with the given options (#9239)
5538507e9 tpl/transform: Optional options for highlight func
b4f27ef8e deps: Upgrade github.com/evanw/esbuild v0.13.12 => v0.14.2 (note)
3473e31eb releaser: Add "note" to Note regexp
fa0da004a build(deps): bump github.com/mitchellh/mapstructure from 1.4.2 to 1.4.3
24a893cf8 releaser: Rework and simplify to use GitHub only for release notes
bf1564bd2 build(deps): bump google.golang.org/api from 0.51.0 to 0.61.0
cd44d409b media: Add rss suffix for application/rss+xml
9a326d563 parser: Add a test case in format resolution
b10381fbe lazy: Reset error in Reset
0eaaa8fee Implement XML data support
58adbeef8 Validate private use language tags
93572e531 resources: Add timeout to the HTTP request in Get
94f149b21 Add a remote retry for resources.Get
66753416b Make resources.Get use a file cache for remote resources
133e4bfbe Remove empty href element from pagination template
f122771fb Check for empty deployment targets and matchers
08a863e1e resources: Adjust the remote Get cache so it does not get evicted on restarts
8aa7257f6 Add remote support to resources.Get
75a823a36 Add deprecation warning to google_news template
5e0947c5b helpers: Make UniqueStringsReuse allocation free
0b70b46aa releaser: Prepare repository for 0.90.0-DEV
ab01ba6e7 releaser: Add release notes to /docs for release of 0.89.4
cc08c0959 releaser: Bump versions for release of 0.89.4
f97da9eca releaser: Add release notes for 0.89.4 [ci skip]
2e70f61fb Fix content dir resolution when main project is a Hugo Module
1ed8069a3 releaser: Prepare repository for 0.90.0-DEV
c88cdb561 releaser: Add release notes to /docs for release of 0.89.3
e1064d219 releaser: Bump versions for release of 0.89.3
bf489b96d releaser: Add release notes for 0.89.3 [ci skip]
b8155452a Improve error when we cannot determine content directory in "hugo new"
08552a7a4 deps: Upgrade github.com/yuin/goldmark v1.4.3 => v1.4.4
fdad91fd9 commands: Make sure pollInterval is always set
5f3f60898 create: Improve archetype directory discovery and tests
057d02de2 create: Add a log statement when archetype is a directory
43ac59da8 create: Always print "Content ... created"
ab5c6990a commands: Fix missing file locking in server partial render
9369d13e5 modules: Improve error message
805c24c32 releaser: Prepare repository for 0.90.0-DEV
63e3a5ebb releaser: Add release notes to /docs for release of 0.89.2
eaa6c96a7 releaser: Bump versions for release of 0.89.2
cf3eb580b releaser: Add release notes for 0.89.2 [ci skip]
2b01c85d1 Fix path resolution in hugo new
c09f5c5fd deps: Upgrade github.com/yuin/goldmark v1.4.2 => v1.4.3
9232e2844 releaser: Prepare repository for 0.90.0-DEV
b6a4ae4ad releaser: Add release notes to /docs for release of 0.89.1
84de0c325 releaser: Bump versions for release of 0.89.1
a07410226 releaser: Add release notes for 0.89.1 [ci skip]
da4406ea5 Revert "releaser: Fat MacOS binaries"
166862a09 create: Make sure the build lock is released before we open editor
82c33c710 readme: Update dependency list
41e9e9fe1 releaser: Prepare repository for 0.90.0-DEV
ade966b84 releaser: Add release notes to /docs for release of 0.89.0
a93d4ba64 releaser: Bump versions for release of 0.89.0
110512a65 releaser: Add release notes for 0.89.0
f503b6395 docs: Regen CLI docs
30aba7fb0 source: Make ContentBaseName() return the directory for branch bundles
04a3b45db Fix description of lang.FormatNumberCustom
0cc39af68 Update Twitter shortcode oEmbed endpoint
ed6fd26ce common/htime: Fix time.Format with Go layouts
7fa66425a build(deps): bump github.com/evanw/esbuild from 0.13.10 to 0.13.12
69210cfdf build(deps): bump github.com/yuin/goldmark from 1.4.1 to 1.4.2
4b36498a8 Merge commit 'aa5ac36a3e'
aa5ac36a3 Squashed 'docs/' changes from 327003421..39a7fac34
3a977485e releaser: Fat MacOS binaries
0f248606d releaser: Only build amd64 binary for freebsd, netbsd, openbsd, dragonfly
e82cbd746 tpl/time: Use configured location when date passed to Format is string
3339c2bb6 build(deps): bump github.com/aws/aws-sdk-go from 1.40.8 to 1.41.14
03bbdba8b build(deps): bump github.com/getkin/kin-openapi from 0.79.0 to 0.80.0
a772b8fc3 build(deps): bump github.com/evanw/esbuild from 0.13.8 to 0.13.10
dce49d133 resources: Rename excepted filenames for image golden testdata
61c5b7a2e build(deps): bump github.com/frankban/quicktest from 1.13.1 to 1.14.0
1d60bd1ef Fix typo in error message
75c9b893d create: Validate the target path in hugo new
64e1613fb Fix panic when specifying multiple excludeFiles directives
b959ecbc8 htime: Set zone of datetime from from `go-toml`
70e454812 Added nodesource apt repository to snap package
355ff83e7 config: Set HUGO_ENABLEGITINFO=false override in Set_in_string
471ed91c6 hugofs: Add includeFiles and excludeFiles to mount configuration
94a5bac5b build(deps): bump github.com/mitchellh/mapstructure from 1.4.1 to 1.4.2
9830ca9e3 resources: Always preserve the original transform error
b64fd0577 readme: Add hyperlink to the banner
2706437a7 build(deps): bump github.com/getkin/kin-openapi from 0.78.0 to 0.79.0
ec7c993cf deps: github.com/evanw/esbuild v0.13.5 => v0.13.8
32c6f656d create: Return error on no content dirs
e02e0727e Fix file permissions in new archetype implementation
096f5e192 Fix the "page picker" logic in --navigateToChanged
ba35e6985 Add a cross process build lock and use it in the archetype content builder
c7957c90e readme: Fix a typo on OpenBSD
bb0537703 deps: github.com/alecthomas/chroma v0.9.2 => v0.9.4
9185e11ef Reimplement archetypes
168a3aab4 build(deps): bump github.com/tdewolff/minify/v2 from 2.9.21 to 2.9.22
8bcfa3bdf deps: Update github.com/evanw/esbuild v0.13.5
d7331aaa7 releaser: Fix regexp
cd4e67af1 build(deps): bump github.com/mattn/go-isatty from 0.0.13 to 0.0.14
e6ad1f0e7 build(deps): bump github.com/getkin/kin-openapi from 0.75.0 to 0.78.0
625d2c257 releaser: Update to Go go1.17.2
e6e44b7c4 Fix value of useResourceCacheWhen in TestResourceChainPostCSS
64abc83fc Allow multiple plugins in the PostCSS options map
f8d132d73 docs: Create path.Clean documentation
26f1919ae Skip a test assertion on CI
e55466ce7 tpl/path: Add path.Clean
ecf025f00 readme: Remove tracking image
fab1e43de Revert "Remove credit from release notes"
e03f82eef Pass minification errors to the user
a864ffe9a Clarify "precision" in currency format functions
b49da3328 build(deps): bump github.com/evanw/esbuild from 0.12.24 to 0.12.29
7c21eca74 resources: Use default math/rand.Source for concurrency safety
13ad8408f commands: Make the error handling for the mod commands more lenient
1cabf61dd modules: Add some help text to the 'unknown revision' error
268e3069f deps: Update github.com/yuin/goldmark v1.4.0 => v1.4.1
3efc2e2af releaser: Prepare repository for 0.89.0-DEV
5bc547389 releaser: Add release notes to /docs for release of 0.88.1
bb3254385 releaser: Bump versions for release of 0.88.1
9b1d6d7e3 releaser: Add release notes for 0.88.1 [ci skip]
e1ead4dbc Bump down again to Go 1.16.7 for the release builds
5b59b9c17 releaser: Prepare repository for 0.89.0-DEV
acc5eb5b5 releaser: Add release notes to /docs for release of 0.88.0
6cacfa329 releaser: Bump versions for release of 0.88.0
4d03cd780 Release 0.88.0
8b14fdbf8 Update 0.88.0-relnotes.md
fc21b63b4 releaser: Add release notes for 0.88.0
6631c9c7e Run go mod tidy
cf73cc2ec js: Fix import order for ./foo when both ./foo.js and ./foo/index.js exists
7d1f806ec commands: Don't fail on template errors on go mod graph etc.
04b595996 build(deps): bump github.com/getkin/kin-openapi from 0.74.0 to 0.75.0
c278b6e45 build(deps): bump github.com/frankban/quicktest from 1.13.0 to 1.13.1
107c86feb build(deps): bump github.com/evanw/esbuild from 0.12.22 to 0.12.24
a0489c2df Avoid failing with "module not found" for hugo mod init and similar
0fc2ce9e4 Update to Go 1.17
32569285c Remove Pygments from snapcraft.yml
5a46eefbc Revert "build(deps): bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.0"
7a15edafe highlight: Add tabindex when code is not highlighted
2f0945baf build(deps): bump github.com/evanw/esbuild from 0.12.17 to 0.12.22
f4ffeea71 Fix it so disableKinds etc. does not get merged in from theme
7ba3f3d20 build(deps): bump golang.org/x/text from 0.3.6 to 0.3.7
f70165242 build(deps): bump github.com/fsnotify/fsnotify from 1.4.9 to 1.5.0
bc0743ed8 Prevent minifier from removing quoutes around post-processed attributes
ffa2fe611 Revert "commands: Avoid too many watch file handles causing the server to fail to start"
d966f5d08 highlight: Remove some pygments references
3f38c785b commands: Avoid too many watch file handles causing the server to fail to start
24589c081 build(deps): bump github.com/getkin/kin-openapi from 0.68.0 to 0.74.0
efebd756e deps: Update github.com/spf13/cast v1.4.0 => v1.4.1
58b6742cf Import time/tzdata on Windows
32ead4b1e releaser: Bump to Go 1.16.7
abd969a67 Revert "tpl/time: Handle nil values in time.AsTime"
3e1107289 tpl/time: Handle nil values in time.AsTime
9bba9a3a9 parser: Indent TOML tables
d6c8cd771 Fix `lang.FormatPercent` description
dfe54d321 releaser: Prepare repository for 0.88.0-DEV
b0c541e49 releaser: Add release notes to /docs for release of 0.87.0
2ed7be295 releaser: Bump versions for release of 0.87.0
d9d1ef8b0 Release 0.87
ec1c1c345 Merge branch 'b087' into release-0.87.0
c7fd13462 Update 0.87.0-relnotes.md
a5d2632eb Update 0.87.0-relnotes.md
494f284be docs: Adjust config docs
bf738d2f4 docs: Regen CLI docs
8d19850e2 docs: Regen docs helper
093498352 Merge commit 'bd77f6e1c9' into release-0.87.0
bd77f6e1c Squashed 'docs/' changes from 60a58d123..327003421
1c5b025dd docs: Adjust time zone docs
c13d33dd5 releaser: Add release notes for 0.87.0
d70c48570 Make sure module config loading errors have file positioning info
9ff17c332 tpl/time: Adjust tests to handle matching local time zones
7aaaf7e33 mod: Remove superflous replace statement
3a9665559 Reduce binary size vs locale, update to CLDR v36.1
9a7383caf deps: Update github.com/tdewolff/minify/v2 v2.9.20 => v2.9.21
6c70e1f22 Fix error handling for the time func alias
4d221ce46 Fail on invalid time zone
e3dc5240f Improve handling of <nil> Params
268065cb2 Merge branch 'release-0.86.1'
e0304c06e releaser: Add release notes for 0.86.1 [ci skip]
7aa8b1cd7 releaser: Prepare repository for 0.87.0-DEV
f6821b88a releaser: Add release notes to /docs for release of 0.86.1
580d320a6 releaser: Bump versions for release of 0.86.1
b75d4526e releaser: Add release notes for 0.86.1 [ci skip]
94b616bdf config: Fix a potential deadlock in config reading
e90b3591a build(deps): bump github.com/evanw/esbuild from 0.12.16 to 0.12.17
4b7da6a9d build(deps): bump github.com/getkin/kin-openapi from 0.67.0 to 0.68.0
7907d24ba tpl/lang: Add new localized versions of lang.FormatNumber etc.
726fe9c3c Go back to WARNING for Page deprecations
b5de37ee7 Handle toml.LocalDate and toml.LocalDateTime in front matter
bf301daf1 deps: Upgrade github.com/pelletier/go-toml/v2 v2.0.0-beta.3 => v2.0.0-beta.3.0.20210727221244-fa0796069526
a3701e093 Switch to go-toml v2
40b6016cf build(deps): bump github.com/tdewolff/minify/v2 from 2.9.19 to 2.9.20
7e1305710 Add a TOML front matter benchmark
efa5760db Add timezone support for front matter dates without one
a57dda854 Localize time.Format
f9afba933 build(deps): bump github.com/getkin/kin-openapi from 0.61.0 to 0.67.0
a5d2ba429 build(deps): bump github.com/spf13/cast from 1.3.1 to 1.4.0
31972f364 build(deps): bump google.golang.org/api from 0.45.0 to 0.51.0
2e58782f9 build(deps): bump github.com/sanity-io/litter from 1.5.0 to 1.5.1
7b68f6524 build(deps): bump github.com/mattn/go-isatty from 0.0.12 to 0.0.13
81265af2c build(deps): bump github.com/spf13/cobra from 1.1.3 to 1.2.1
c102c9719 build(deps): bump github.com/mitchellh/mapstructure from 1.3.3 to 1.4.1
7c0f904f2 build(deps): bump github.com/google/go-cmp from 0.5.5 to 0.5.6
b2fbd4d13 build(deps): bump github.com/mitchellh/hashstructure from 1.0.0 to 1.1.0
90041d1b6 build(deps): bump github.com/gobuffalo/flect from 0.2.2 to 0.2.3
05047096f build(deps): bump github.com/pelletier/go-toml from 1.9.0 to 1.9.3
a469156ea build(deps): bump github.com/aws/aws-sdk-go from 1.38.23 to 1.40.8
18fdd85bc build(deps): bump github.com/tdewolff/minify/v2 from 2.9.18 to 2.9.19
aeb1935d4 deps: Update github.com/evanw/esbuild v0.11.16 => v0.12.16
c7252224c Deprecate Blackfriday and fix a potential deadlock in config
e09d7882c deps: Update github.com/yuin/goldmark v1.3.9 => v1.4.0
15c0eed04 build(deps): bump github.com/frankban/quicktest from 1.12.0 to 1.13.0
91cbb9630 Bump all long-living deprecations to ERRORs
a352d19d8 Fix theme count in release notes
11bb67dcf releaser: Prepare repository for 0.87.0-DEV
41c6c52ea releaser: Add release notes to /docs for release of 0.86.0
d270eaf4f releaser: Bump versions for release of 0.86.0
b2e67505f Release 0.86.0
32508045d navigation: Check Page first in URL()
e521c9a36 Update 0.86.0-relnotes.md
dfb1cc431 releaser: Add release notes for 0.86.0
0294a4a4f Merge commit '53a352795a'
53a352795 Squashed 'docs/' changes from 6ebb5dad9..60a58d123
351ed0f56 commands: Fix panic on invalid config in "hugo mod get" and similar
d831d2fce Simplify "active menu" logic for section menus
634481ba8 Fix Params case handling for menu items defined in site config
c19f65f95 minifiers: Make keepWhitespace = true default for HTML
022c47955 hugofs: Make FileMeta a struct
f27e54244 markup: Add tabindex="0" to default <pre> wrapper
ae6cf93c8 Fix default values when loading from config dir
a70da2b74 Fix the deprecation error/warn log levels
805664818 markup/goldmark: Rename/reorder the hook methods
ee3d2bb1d markup/goldmark: Support auto links in render hook
eb2a50036 Adjust a test helper
5cb52c231 Add config.cascade
30eea3915 resources: Regenerate image golden testdata
8f40f34cd Fix transparency problem when converting 32-bit images to WebP
8ddbc9546 releaser: Prepare repository for 0.86.0-DEV
724d5db58 releaser: Add release notes to /docs for release of 0.85.0
875fe4050 releaser: Bump versions for release of 0.85.0
56362e4bc Update 0.85.0-relnotes.md
f5cfb9e25 releaser: Add release notes for 0.85.0
04dc469fb commands: Move time notification to after any build errors
07919d1cc exif: Log warning for metadata decode error
f75f90079 Fix tab selection of disabled items in internal pagination template
e31b1d194 commands: Make the --poll flag a duration
43a23239b docs: Regen CLI docs
4479f09c9 Merge commit '7eb0e10a80'
7eb0e10a8 Squashed 'docs/' changes from 710856e5a..6ebb5dad9
24ce98b6d Add polling as a fallback to native filesystem events in server watch
0019d60f6 deps: Bump github.com/yuin/goldmark v1.3.9
e451b984c Fix panic when theme has permalinks config
b4d60b3db releaser: Prepare repository for 0.85.0-DEV
020e4acee releaser: Add release notes to /docs for release of 0.84.4
4c34faf42 releaser: Bump versions for release of 0.84.4
a339f6266 releaser: Add release notes for 0.84.4 [ci skip]
4c8552b11 Fix Cloudflare vs Netlify cache dir issue
34e4742f0 Fix date format in schema and opengraph templates
bffa2a2a9 releaser: Prepare repository for 0.85.0-DEV
a1b0353cc releaser: Add release notes to /docs for release of 0.84.3
bc6f84c58 releaser: Bump versions for release of 0.84.3
80410257e releaser: Add release notes for 0.84.3 [ci skip]
6c8c0c8b6 config: Fix Netlify default cache dir logic
49fedbc51 config: Fix handling of invalid OS env config overrides
829072010 releaser: Prepare repository for 0.85.0-DEV
e0c67958f releaser: Add release notes to /docs for release of 0.84.2
f6b9ce6eb releaser: Bump versions for release of 0.84.2
4b03399b7 releaser: Add release notes for 0.84.2 [ci skip]
40dfdd095 modules: Add module.import.noMounts config
3a6dc6d3f modules: Use value type for module.Time
6cd2110ab commands: Add version time to "hugo config mounts"
6a365c271 commands: Add some more info to "hugo config mounts"
19aa95fc7 Fix config handling with empty config entries after merge
923dd9d1c Fix config loading for "hugo mod init"
d9bdd37d3 deps: Update to Minify v2.9.18
b2eaf4c8c Remove credit from release notes
efb6ee6c1 releaser: Prepare repository for 0.85.0-DEV
4bd65e224 releaser: Add release notes to /docs for release of 0.84.1
ff2266300 releaser: Bump versions for release of 0.84.1
8677cfb04 releaser: Add release notes for 0.84.1 [ci skip]
093dacab2 Fix language menu config regression
4a9d408fe config: Fix merge of config with map[string]string values.
931205988 releaser: Bump to Goreleaser v0.171.0
a7e3da242 markup: Rename Header(s) to Heading(s) in ToC struct
b70a12ec4 Merge commit '4dd90050f1'
4dd90050f Squashed 'docs/' changes from 3a923e155..710856e5a
3d544c9ae releaser: Prepare repository for 0.85.0-DEV
2c4689f7b releaser: Add release notes to /docs for release of 0.84.0
9c0860f74 releaser: Bump versions for release of 0.84.0
a1694b06a releaser: Increase timeout
219ec3800 releaser: Add release notes for 0.84.0
be6b901cf docs: Regenerate docs helper
643b67193 output: Make WebAppManifestFormat NotAlternative=true
ab4e1dfa4 media: Adjust  test assertion
02f31897b media: support application/manifest+json
402da3f8f docs: Regenerate docshelper
92405e5b0 Squashed 'docs/' changes from 4c81c6c2a..3a923e155
a074f758b Merge commit '92405e5b0a'
bb2aa0870 Implement configuration in a directory for modules
9096842b0 tpl: Rename err-missing-instagram-accesstoken => error-missing-instagram-accesstoken
3aa7f0b27 deps: Update github.com/alecthomas/chroma v0.9.1 => v0.9.2
9b870aa78 deps: Run go mod tidy
93aad3c54 Split out the puthe path/filepath functions into common/paths
5af045eba resources/image: Fix fill with smartcrop sometimes returning 0 bytes images
8eafe0845 deps: Update to Goldmark v1.3.8
31fb29fb3 Do not read config from os.Environ when running tests
d392893cd Misc config loading fixes
a886dd53b github: Set a dummy Instagram token
a91cd7652 docs: Regenerate docs helper
162f41d0e Merge commit '32ba623541'
32ba62354 Squashed 'docs/' changes from bcc4f9324..4c81c6c2a
552cef5c5 Update to Go 1.16.5, Goreleaser 0.169.0
73483d0f9 tpl: Add a terse pagination template variant to improve performance
9b5debe4b Upgrade Instagram shortcode
12530519d Fix nested OS env config override when parent does not exist
f55d2f437 tpl/fmt: Add erroridf template func
282f1aa3d tpl/data: Print response body on HTTP errors
fcd63de3a tpl/data: Misc header improvements, tests, allow multiple headers of same key
150d75738 tpl/data: Allows user-defined HTTP headers with getJSON and getCSV
06d295427 hugofs: Set modTime at creation time
26ae12c0c Fix invalid timestamp of the "public" folder
ee733085b config: Fix env split to allow = character in  values
01758f99b Add math.Max and math.Min
845a7ba4f Catch incomplete shortcode error
10f60de89 Use SPDX license identifier
785a31b5b navigation: Cache and copy Menu for sorting
bc1e05286 deps: Update to LibSASS 3.6.5
f518b4f71 publisher: Make the HTML element collector more robust
dc6b7a75f Revert "publisher: Make the HTML element collector more robust"
3f515f0e3 Revert "publisher: Get the collector in line with the io.Writer interface"
a9bcd3818 publisher: Get the collector in line with the io.Writer interface
ef0f1a726 publisher: Make the HTML element collector more robust
abbc99d4c common/maps: Add Scratch.DeleteInMap
76c95f55a Display version when building site (#8533)
2c7f5b62f docs: Update querify function description and examples
c46fc838a tpl: Allow 'Querify' to take lone slice/interface argument
504c78da4 modules/npm: Change SetEscapeHTML to false
b660ea8d5 Add a benchmark
64f88f301 readme: Update dependency list
7a2c10ae6 tpl: Fix countwords to handle special chars
e1c328df2 releaser: Prepare repository for 0.84.0-DEV
5afe0a57d releaser: Add release notes to /docs for release of 0.83.1
8900e3391 releaser: Bump versions for release of 0.83.1
9753e1b9c releaser: Add release notes for 0.83.1 [ci skip]
ececd1b12 langs/i18n: Fix warning regression in i18n
b0ca723eb releaser: Prepare repository for 0.84.0-DEV
4c65ceccc releaser: Add release notes to /docs for release of 0.83.0
57a471a0d releaser: Bump versions for release of 0.83.0
9b63af55b Update 0.83.0-relnotes.md
23fc65832 docs: Fix shortcode
e7b5e36e0 releaser: Add release notes for 0.83.0
a9b52b417 docs: Regenerate docs helper
b073a1c97 docs: Regenerate CLI docs
4227cc1bd commands: Remove all dates from gendoc
c239c643f Squashed 'docs/' changes from fb551cc75..bcc4f9324
d7b22aee4 Merge commit 'c239c643fe'
3cc4fdd6f deps: Update getkin/kin-openapi v0.60.0 => v0.61.
7eb80a9e6 langs/i18n: Fix multiple unknown language codes
78c1a6a7c deps: Update github.com/evanw/esbuild v0.11.14 => v0.11.16
f6745ad35 Remove .Site.Authors from embedded templates
f523e9f0f deploy: Don't treat a NotFound response for Delete as a fatal error.
63cd05ce5 snap: Switch to deb packages of nodejs and python3-pygments
902535ef1 snapcraft.yaml: Install bin/node from node/14/stable
70aebba04 build(deps): bump github.com/getkin/kin-openapi from 0.55.0 to 0.60.0
3e3b7d447 build(deps): bump github.com/evanw/esbuild from 0.11.13 to 0.11.14
c13d36874 resources/page: Fix permalinks pattern detection for some of the sections variants
048418ba7 deps: Update to Chroma v0.9.1
eebde0c2a langs/i18n: Improve plural handling of floats
e4dc9a82b tpl/collections: Fix where on type mismatches
0d86a32d8 Make the shortcode template lookup for output formats stable
65c502cc8 build(deps): bump github.com/evanw/esbuild from 0.11.12 to 0.11.13
537c905ec langs/i18n: Revise the plural implementation
243951ebe snapcraft.yaml: Update to "base: core20"
fe2ee0280 build(deps): bump github.com/frankban/quicktest from 1.11.3 to 1.12.0
316d65cd7 build(deps): bump google.golang.org/api from 0.44.0 to 0.45.0
b95229ab4 build(deps): bump github.com/aws/aws-sdk-go from 1.37.11 to 1.38.23
0551df090 Correct function name in comment
bca40cf0c Fix Params case handling in where with slices of structs (e.g. Pages)
057e5a22a deps: Upgraded github.com/evanw/esbuild v0.11.0 => v0.11.12
fd96f65a3 docs: Regen docs helper
8f7891e70 Merge commit '07b8d9466d'
07b8d9466 Squashed 'docs/' changes from 9cece6640..fb551cc75
d3a64708f build(deps): bump github.com/tdewolff/minify/v2 from 2.9.15 to 2.9.16
3b56244f4 build(deps): bump golang.org/x/text from 0.3.5 to 0.3.6
f5d3d635e publisher: Remove some unreachable code
0d3c42da5 build(deps): bump github.com/getkin/kin-openapi from 0.39.0 to 0.55.0
ef34dd8f0 publisher: Some performance tweaks for the HTML elements collector
bc80022e0 publisher: Exclude comment and doctype elements from writeStats
2bb9496ce Merge branch 'release-0.82.1'
fda3c4d1e releaser: Prepare repository for 0.83.0-DEV
60618210b releaser: Add release notes to /docs for release of 0.82.1
f8b064f3c releaser: Bump versions for release of 0.82.1
4713e509b releaser: Add release notes for 0.82.1 [ci skip]
6e9d2bf0c Regression in media type suffix lookup
e73f7a770 Regression in media type suffix lookup
3ddffd064 build(deps): bump github.com/yuin/goldmark from 1.3.2 to 1.3.5
6fc52d185 Remove duplicate references from release notes
73c3ae818 build(deps): bump github.com/spf13/afero from 1.5.1 to 1.6.0
7ca118fdf build(deps): bump github.com/pelletier/go-toml from 1.8.1 to 1.9.0
33d5f8059 Add webp image encoding support
509d39fa6 build(deps): bump google.golang.org/api from 0.40.0 to 0.44.0
7725c41d4 build(deps): bump github.com/nicksnyder/go-i18n/v2 from 2.1.1 to 2.1.2
5d36d8015 build(deps): bump github.com/rogpeppe/go-internal from 1.6.2 to 1.8.0
9b34d42bb Remove extraneous space from figure shortcode
c2d8f87cf build(deps): bump github.com/magefile/mage from 1.10.0 to 1.11.0
cbc246616 build(deps): bump github.com/google/go-cmp from 0.5.4 to 0.5.5
fa432b17b org: Disable broken pretty relative links feature
0cd55c66d deps: Update go-org to v1.5.0
0d5cf256e build(deps): bump github.com/jdkato/prose from 1.2.0 to 1.2.1
36527576b build(deps): bump github.com/spf13/cobra from 1.1.1 to 1.1.3
9b83f45b6 Add complete dependency list in "hugo env -v"
7fdd2b95e Add hugo.IsExtended
3d5dbdcb1 publisher: Also test minified HTML in the element collector
8a308944e publisher: Skip script, pre and textarea content when looking for HTML elements
7b4ade56d output: Only output mediaType once in docshelper JSON
7c7974b71 Fix typo in docshelper.go
5656a908d tpl: Remove the FuzzMarkdownify func for now
2dc222cec Add slice syntax to sections permalinks config
4d22ad580 deps: Upgrade github.com/evanw/esbuild v0.9.6 => v0.11.0
5e2f12891 Try to fix the fuzz build
97934779e releaser: Prepare repository for 0.83.0-DEV
9d9607843 releaser: Add release notes to /docs for release of 0.82.0
1efd93c09 releaser: Bump versions for release of 0.82.0
584a9b3e2 releaser: Add release notes for 0.82.0
86b4fd35e docs: Regenerate docs helper
195d108da docs: Regen CLI docs
81689af79 Squashed 'docs/' changes from bb15e9804..9cece6640
c94aa5cf4 Merge commit '81689af799'
df8bb8812 Simplify some config loading code
57d8d208e deps: Update github.com/evanw/esbuild v0.9.0 => v0.9.6
fc06e8508 Apply OS env overrides twice
b725253f9 Attributes for code fences should be placed after the lang indicator only
35dedf15c deps: Bump github.com/tdewolff/minify/v2 v2.9.15
7ed56c694 Fix OS env override for nested config param only available in theme
24c716cac Fix `new theme` command description
137d2dab3 github: More explicit support link to discourse
ba1d0051b media: Make Type comparable
1b1dcf586 deps: Update to esbuild v0.9.0
f6612d8bd exif: Fix handling of utf8 runes in nullString()
0a2ab3f8f exif: Allow more spacing characters in strings
4d24e2a32 media: Add a basic benchmark
18074d0c2 Fix output format handling for render hooks
35bfb6622 Rename a test
6d21559fb Add a debug helper
ba16a14c6 Add support for Google Analytics v4
782c79ae6 Bump go.mod to Go 1.16
5afcae7e0 #8210 Upgrade golang version for Dockerfile
60469f429 Update CONTRIBUTING.md
aed7df62a markup: Handle attribute lists in code fences
cd0c5d7ef Allow markdown attribute lists to be used in title render hooks
e7e194435 Merge commit '9d31f650da'
9d31f650d Squashed 'docs/' changes from d343ebf71..bb15e9804
88a85dcea build(deps): bump github.com/kyokomi/emoji/v2 from 2.2.7 to 2.2.8
7f8530039 tpl: Add method mappings for strings.Contains, strings.ContainsAny
01dd7c16a Fixes #7698.
c8f45d1d8 commands: Fix autocomplete docs
b3504a0ee releaser: Prepare repository for 0.82.0-DEV
59d15c97d releaser: Add release notes to /docs for release of 0.81.0
9e2d086ca releaser: Bump versions for release of 0.81.0
b65518ac6 releaser: Increase build timeout
0e9cd8128 releaser: Add release notes for 0.81.0
fe77f7434 tpl: Make the build green again
9e99950c6 docs: Regen CLI docs
1b364b003 docs: Regen docs helper
acb9109df Squashed 'docs/' changes from ef9c4913c..d343ebf71
7d0a26198 Merge commit 'acb9109df7'
c60806550 tpl: Regenerate internal templates
ffd9dac42 tpl: Update date logic of opengraph and schema internal templates
88b93a09d Run go mod tidy
29fb456c9 build: Add arm64 to Darwinextended build and add vendorInfo
718fba7d6 Update Travis, GitHub, CircleCI and Snap to Go 1.16 (only)
9650e5684 tpl: Add temporary patch to fix template data race
e77b2e3aa Pull in latest Go 1.16 template source
b5485aeae Add breaking tests for "map read and map write in templates"
ccb822eb5 Pull in latest Go template source
21e9eb18a Expand template newline testcase to commands
ae57ba6a9 Add a test case for Go 1.16 template action newlines
cf3e077da tpl/internal: Synch Go templates fork with Go 1.16dev
66beac99c deps: Update github.com/tdewolff/minify/v2 v2.6.2 => v2.9.13
968dd7a71 build(deps): bump github.com/frankban/quicktest from 1.11.2 to 1.11.3
38f29e817 build(deps): bump github.com/getkin/kin-openapi from 0.32.0 to 0.39.0
cd87813aa build(deps): bump github.com/aws/aws-sdk-go from 1.36.33 to 1.37.11
4e815b063 build(deps): bump github.com/sanity-io/litter from 1.3.0 to 1.5.0
652a59d38 build(deps): bump github.com/olekukonko/tablewriter from 0.0.4 to 0.0.5
84f0ec7f8 deps: Update to esbuild v0.8.46
bdfbcf6f4 modules: Add config option modules.vendorClosest
b60e9279a js: Fix potential path issue on Windows
a9b0fea6a build(deps): bump google.golang.org/api from 0.26.0 to 0.40.0
e8df09774 Change version string format and add VendorInfo to help with issue triaging
3a5ee0d2d modules: Allow absolute paths for any modules resolved via project replacement
4ffaeaf15 modules: Throw an error running hugo mod vendor on mountless module
bf55afd71 Fix some humanize issues
5f621df25 commands: Add PowerShell completion support
7118f89cf Refer to mage instead of make in comment regarding commitHash
e6dd31281 markup/goldmark: Fix handling of legacy attribute config
2681633db markup/goldmark: Add attributes support for blocks (tables etc.)
1b2472825 deps: Update to Goldmark v1.3.2
441b11bee Update to Dart Sass Protocol beta6
4867cd1de tpl/embedded: Exclude pages without Permalink from sitemap
92c6c4041 langs/i18n: Support translation files with suffix *.yml
d36fd5b3e Refactor: Write to stdout by default
a7c515e1b Refactor: Remove powershell support
216b00f35 Feat: Add zsh, fish and powershell completion support
144943798 github: Enable NPM tests on Windows
440fdb0eb deps: Update to esbuild v0.8.39
b2a48dce5 Trim whitespace in elements written to hugo_stats.json
35def0ae4 tpl/data: Add default user-agent header for getJSON requests
2f9dadae4 build(deps): bump github.com/aws/aws-sdk-go from 1.35.0 to 1.36.33
ed3071b75 docs: Remove mention of a file size limit for readFile
ee9c13676 tpl/os: remove 1mb limit for readFile.
32b86076e js: Add Inject config option
241b7483e tpl: Fix race condition in text template baseof
e19a046c4 js: Add Shims option
a1fe552fc Fix nilpointer in js.Build error handling
a1a9f088b Merge commit 'e48ffb7635'
e48ffb763 Squashed 'docs/' changes from 1de7a358c..ef9c4913c
07ad283f6 build(deps): bump github.com/spf13/afero from 1.4.1 to 1.5.1
2c8b5d916 pipes: Add external source map support to js.Build and Babel
0004a733c tpl: Fix metrics hint tracking
8a26ab0bc tpl: Do not return errors in substr for out-of-bounds cases
788e50ad3 tpl: Add missing test scenario for strings.Substr
4d2b6fc4c Run go mod tidy
212e5e554 deps: Update go-org to v1.4.0
4fdec67b1 rst: Adjust log level
9b681ecfb releaser: Prepare repository for 0.81.0-DEV
792ef0f41 releaser: Add release notes to /docs for release of 0.80.0
5b3fc1c67 releaser: Bump versions for release of 0.80.0
63a33afee Update 0.80.0-relnotes.md
69aa3d459 releaser: Add release notes for 0.80.0
ffbf5e45f Allow Dart Sass transformations to be cached on disk
48994ea76 dartsass: Dart Sass only supports `expanded` and `compressed`
428b0b329 dartsass: Add missing OutputStyle option
1f7e9f733 Update emoji import paths and version
cea157402 Add Dart Sass support
f9f779786 GroupByParamDate now supports datetimes
a9718f44c para: Skip para test when not on CI
f802bb236 Update SECURITY.md
6c2941827 releaser: Add release notes to /docs for release of 0.79.1
10ae7c321 Improve LookPath
ae2d1bd52 docs: create a SECURITY.md
81975f847 Fix Resource.ResourceType so it always returns MIME's main type
8103188b9 para: Show more detail on failed time test
3ba147e70 images: Add images.Overlay filter
a2d146ec3 tpl: Regenerate templates
d2d493ab5 tpl: Fix series detection in opengraph
ce96895de hugolib/paths: Fix typo
04b89857e all: Fix minor typos
21fa1e86f Fix BenchmarkMergeByLanguage
c84ad8db8 deps: Bump github.com/spf13/cobra from 0.15.0 to 0.20.0
4e0acb89b chore: configure proper link to discourse.gohugo.io (#8020)
718e09ed4 tpl/internal/go_templates: Revert formatting
d90e37e0c all: Format code with gofumpt
32471b57b build(deps): bump github.com/evanw/esbuild from 0.8.15 to 0.8.17
4fc918e02 tpl: Add title parameter to YouTube shortcode
0ad378b09 Use --baseURL path for live-reload URL
aebfe156f Fix RelURL and AbsURL when path starts with language
907d9e926 build(deps): bump github.com/getkin/kin-openapi from 0.31.0 to 0.32.0
5862fd2a6 tpl: Fix substr when length parameter is zero
64789fb5d tpl: Refactor and fix substr logic
32d4bf68d releaser: Prepare repository for 0.80.0-DEV
1415efdcd releaser: Add release notes to /docs for release of 0.79.0
4e6bf7907 releaser: Bump versions for release of 0.79.0
50be4370b Update 0.79.0-relnotes.md
3d2e6a30d releaser: Add release notes for 0.79.0
4f1e4bb3f Merge commit '9f1265fde4'
9f1265fde Squashed 'docs/' changes from 57c1d1a67..1de7a358c
d162bbd79 publisher: Fix memory usage in writeStats
17e0bbe82 build(deps): bump gopkg.in/yaml.v2 from 2.3.0 to 2.4.0
e442cf30a Fix server rebuild issue with partials referenced from render hooks
7e223b3ba Allow setting the delimiter used for setting config via OS env, e.g. HUGO_
8a6e70605 deps: Update to github.com/evanw/esbuild 0.8.11 to 0.8.14
34061706e output: Add more layout lookup tests
6f7633df7 build(deps): bump github.com/google/go-cmp from 0.5.2 to 0.5.3
a546059a9 examples: Remove unneeded meta tag from blog example
b5d906e31 build(deps): bump github.com/getkin/kin-openapi from 0.30.0 to 0.31.0
fd70bdafe docs: Regen docshelper
8f5c9a747 Add menu params
e4fcb672e resources: Preserve url set in frontmatter without sanitizing
18c13adcd watcher: Add file deleted by accident
20a35374a Revert "docs: Regenerate docshelper"
caf16c208 docs: Regenerate docshelper
b298c06e0 deps: Update to Chroma v0.8.2
55e290af4 build(deps): bump github.com/evanw/esbuild from 0.8.8 to 0.8.11
506a190a8 build(deps): bump github.com/getkin/kin-openapi from 0.26.0 to 0.30.0
fc81de643 build(deps): bump github.com/evanw/esbuild from 0.8.6 to 0.8.8
fcaa324e3 releaser: Prepare repository for 0.79.0-DEV
959724f0e releaser: Add release notes to /docs for release of 0.78.2
a3012d85d releaser: Bump versions for release of 0.78.2
fc7f73927 releaser: Add release notes for 0.78.2 [ci skip]
78f227b66 js: Let ESBuild handle all imports from node_modules
5e03f644a build(deps): bump github.com/evanw/esbuild from 0.8.5 to 0.8.6
a92ef20ff build(deps): bump github.com/evanw/esbuild from 0.8.4 to 0.8.5
0d54a8440 build(deps): bump github.com/getkin/kin-openapi from 0.22.1 to 0.26.0
943f3c932 Update GH docs to say "main" as default branch
4f20bf29e Updated year in header
4c613d5d5 Added first fuzzer
82a182e52 build(deps): bump github.com/frankban/quicktest from 1.11.1 to 1.11.2
dfc662b20 build(deps): bump golang.org/x/text from 0.3.3 to 0.3.4
2f0917cc0 build(deps): bump github.com/evanw/esbuild from 0.8.3 to 0.8.4
7565cda1f releaser: Prepare repository for 0.79.0-DEV
347f2de67 releaser: Add release notes to /docs for release of 0.78.1
210f6d38a releaser: Bump versions for release of 0.78.1
03f87f8f0 releaser: Add release notes for 0.78.1 [ci skip]
3437174c3 Disable NPM test on Travis on Windows
f66302ca0 travis: Install nodejs on Windows
944150baf js: Remove external source map option
bf2837a31 js: Misc fixes
cf6131dc1 releaser: Prepare repository for 0.79.0-DEV
fd62817bb releaser: Add release notes to /docs for release of 0.78.0
3ebe83aea releaser: Bump versions for release of 0.78.0
0c16debc7 Update 0.78.0-relnotes.md
794e1f9e7 releaser: Add release notes for 0.78.0
c64e9504d Merge commit 'b74591123e'
b74591123 Squashed 'docs/' changes from d1157b687..57c1d1a67
3b2fe3cd3 js: Add avoidTDZ option
85e4dd737 Make js.Build fully support modules
3089fc0ba js.Build: Generate tsconfig files
e10e36cf7 releaser: Prepare repository for 0.78.0-DEV
ef290125c releaser: Add release notes to /docs for release of 0.77.0
5d2fceeca releaser: Bump versions for release of 0.77.0
0696df668 Release 0.77.0
5ba49c877 Update 0.77.0-relnotes.md
c3ccda8fa releaser: Add release notes for 0.77.0
beabc8d99 modules: Allow absolute paths for project imports
332b65e4c docs: Regen docs helper
3553fc533 Merge commit '9cabb46f68'
9cabb46f6 Squashed 'docs/' changes from 9abd3043a..d1157b687
173187e26 Add module.replacements
8a1c637c4 Fix setting HUGO_MODULE_PROXY etc. via env vars
6d95dc9d7 tpl: Fix reflection bug in merge
56a343507 deploy: Do not call CDN service invalidation when executing a dry run deployment
d48a98c47 create: Pass editor arguments from newContentEditor correctly
3261678f6 deps: Bump github.com/spf13/cobra from 0.0.7 to 1.1.1
f465c5c30 build: Allow optional "nodeploy" tag to exclude deploy command from bin
3400aff25 Allow cascade _target to work with non toml fm
fdfa4a5fe Allow getJSON errors to be ignored
8cbe2bbfa build(deps): bump github.com/evanw/esbuild from 0.7.15 to 0.7.18
807db97af tpl: Refactor time.AsTime location implementation
26eeb2914 tpl: Update Hugo time to support optional [LOCATION] parameter
b886fa46b Revert "Add benchmark for building docs site"
14bce18a6 highlight: Avoid making unnecessary allocation
837e084bb Add benchmark for building docs site
08e4f9ff9 embedded: Always show page number when 5 pages or less
acfa15386 output: Improve layout path construction
f033d9f01 build(deps): bump github.com/frankban/quicktest from 1.11.0 to 1.11.1
59fe27942 build(deps): bump github.com/evanw/esbuild from 0.7.14 to 0.7.15
62119022d Merge branch 'release-0.76.5'
2f3f41f73 releaser: Prepare repository for 0.77.0-DEV
60f0725b3 releaser: Add release notes to /docs for release of 0.76.5
dcf70ea5a releaser: Bump versions for release of 0.76.5
7487c0abf releaser: Add release notes for 0.76.5 [ci skip]
79a022a15 Render aliases even if render=link
ead5799f7 Render aliases even if render=link
d57be1132 build(deps): bump github.com/spf13/afero from 1.4.0 to 1.4.1
d07059669 build(deps): bump github.com/evanw/esbuild from 0.7.9 to 0.7.14
f5ea359dd docker: Update to Go 1.15 and Alpine 3.12
78b26d538 output: Test all lookup permutations in TestLayout
28179bd55 output: Reformat TestLayout table
fef057b48 releaser: Prepare repository for 0.77.0-DEV
50dfe40b9 releaser: Add release notes to /docs for release of 0.76.4
1ef4211fe releaser: Bump versions for release of 0.76.4
b148063ec releaser: Add release notes for 0.76.4 [ci skip]
e9a7ebaf6 snap: Install postcss v8 explicitly as it is now a peer dependency
506820435 lang/i18n: Fix for language code case issue with pt-br etc.
49972d079 Merge branch 'release-0.76.3'
c98132e30 Add merge helper
af19253f4 releaser: Prepare repository for 0.77.0-DEV
e96234590 releaser: Add release notes to /docs for release of 0.76.3
d62bc7477 releaser: Bump versions for release of 0.76.3
1b1d62fdc releaser: Add release notes for 0.76.3 [ci skip]
33e9d79b7 langs/i18n: Add workaround for known language, but missing plural rule error
fc6abc39c langs/i18n: Fix for bare TOML keys
18ed22be5 releaser: Prepare repository for 0.77.0-DEV
207913f34 releaser: Add release notes to /docs for release of 0.76.2
830b1a94d releaser: Bump versions for release of 0.76.2
605cff407 releaser: Add release notes for 0.76.2 [ci skip]
6dd60fca7 Revert "deps: Update to  github.com/tdewolff/minify v2.9.4"
138a02591 releaser: Prepare repository for 0.77.0-DEV
58ac83a98 releaser: Add release notes to /docs for release of 0.76.1
2b8e8e6d9 releaser: Bump versions for release of 0.76.1
aef836986 releaser: Add release notes for 0.76.1 [ci skip]
f9e798e8c langs/i18n: Fix i18n .Count regression
ee56efffc Fix typo in 0.76.0 release note
2c4e76e96 releaser: Prepare repository for 0.77.0-DEV
9c7d6e475 releaser: Add release notes to /docs for release of 0.76.0
4482958f9 releaser: Bump versions for release of 0.76.0
e1ec3bc2b Release 0.76.0
1cfa63b9e releaser: Add release notes for 0.76.0
b9318e431 docs: Regen docshelper
5e39eb20a Merge commit 'e556848805'
e55684880 Squashed 'docs/' changes from 4895c29c5..9abd3043a
634938908 pagemeta: Make BuildConfig.Render an enum
c63db7f1f Allow cascade to be a slice with a _target discriminator
5e2a547cb Add force flag to server redirects config
ee090c094 build(deps): bump github.com/evanw/esbuild from 0.7.8 to 0.7.9
edc5c4741 tpl: Add Do Not Track (dnt) option to Vimeo shortcode
05e358fd3 build(deps): bump github.com/tdewolff/minify/v2 from 2.9.5 to 2.9.7
a2e85d9a7 build(deps): bump github.com/aws/aws-sdk-go from 1.34.34 to 1.35.0
4fba78dd0 build(deps): bump github.com/getkin/kin-openapi from 0.22.0 to 0.22.1
c011b4667 build(deps): bump github.com/aws/aws-sdk-go from 1.34.33 to 1.34.34
35348b4b3 build(deps): bump github.com/evanw/esbuild from 0.7.7 to 0.7.8
34915777c build(deps): bump github.com/aws/aws-sdk-go from 1.34.27 to 1.34.33
0f4a837ed build(deps): bump github.com/evanw/esbuild from 0.7.4 to 0.7.7
b395d686e build(deps): bump github.com/tdewolff/minify/v2 from 2.9.4 to 2.9.5
97987e5c0 langs/i18n: Upgrade to go-i18n v2
111344113 publisher: Fix writeStats with quote inside quotes
4855c186d build(deps): bump github.com/evanw/esbuild from 0.7.2 to 0.7.4
0c3d2b67e Fix CLI example for PostCSS 8
6f07ec7e9 build(deps): bump github.com/aws/aws-sdk-go from 1.34.26 to 1.34.27
4318dc72f build(deps): bump github.com/alecthomas/chroma from 0.8.0 to 0.8.1
acdc27a32 build(deps): bump github.com/evanw/esbuild from 0.7.1 to 0.7.2
3acde9ae0 Make sure CSS is rebuilt when postcss.config.js or tailwind.config.js changes
473b6610d Fix typo in redirect error message
0bce97703 build(deps): bump github.com/aws/aws-sdk-go from 1.34.22 to 1.34.26
b254532b5 deps: Update to  github.com/tdewolff/minify v2.9.4
05a228929 snap: Bump bundled Node.js from v12.18.3 to v12.18.4
8e553dcde markup/asciidocext: Add preserveTOC option
d4fc70a3b build(deps): bump github.com/frankban/quicktest from 1.10.2 to 1.11.0
d905abc00 build(deps): bump github.com/evanw/esbuild from 0.6.32 to 0.7.1
8f3946746 build(deps): bump github.com/rogpeppe/go-internal from 1.5.1 to 1.6.2
b01b2564e build(deps): bump github.com/jdkato/prose from 1.1.1 to 1.2.0
9fa5ebe2c build(deps): bump github.com/spf13/afero from 1.2.2 to 1.4.0
efaed306b releaser: Prepare repository for 0.76.0-DEV
a4a7bab73 releaser: Add release notes to /docs for release of 0.75.1
2a9dce423 releaser: Bump versions for release of 0.75.1
30159b58e releaser: Add release notes for 0.75.1 [ci skip]
cd00f7f96 resources/image: Fix nilpointer for images with no Exif
214afe4c1 modules/npm: Preserve the original package.json if it exists
cd830bb02 tpl: Fix grammar in the new 'requires non-zero' error message
a8458bfb2 releaser: Prepare repository for 0.76.0-DEV
fef924baf releaser: Add release notes to /docs for release of 0.75.0
07b5e602f releaser: Bump versions for release of 0.75.0
70f16e84e Release 0.75.0
abadf2954 releaser: Add release notes for 0.75.0
377ad87a5 Set PWD in environment when running the Node apps
292b0e26e typo: already -> already
534ae9c57 Squashed 'docs/' changes from d3eb97a33..4895c29c5
df56682a1 Merge commit '534ae9c57a'
be2404c8b docs: Regen docs helper
c8da8eb1f docs: Regenerate CLI docs
787da6bd5 releaser: Drop 32-bit for MacOS
85ba9bfff Add "hugo mod npm pack"
9df60b62f Print layout name if it was specified when showing missing layout file error
4fad43c8b build(deps): bump github.com/aws/aws-sdk-go from 1.34.21 to 1.34.22
fb0f2cc71 markup/highlight: Add support to linkable line anchors on Chroma
748fd4cb0 snap: Bump bundled Node.js from v8.12.0 to v12.18.3
b82f440c5 Revert "snap: Change confinement from strict to classic"
c8143efa5 build(deps): bump github.com/getkin/kin-openapi from 0.14.0 to 0.22.0
c80132bbe build(deps): bump github.com/aws/aws-sdk-go from 1.34.20 to 1.34.21
75fa4c5c9 build(deps): bump github.com/spf13/viper from 1.6.1 to 1.7.1
fd7969e0b deps: Run "go mod tidy"
b7fa3c4bb deps: Update to Goldmark v1.2.1
6a848cbc3 markup/asciidocext: Fix AsciiDoc TOC with code
746ba803a build(deps): bump github.com/aws/aws-sdk-go from 1.27.1 to 1.34.20
612b7d376 build(deps): bump github.com/mitchellh/mapstructure from 1.1.2 to 1.3.3
6f4ff1a46 snap: Change confinement from strict to classic
ddeca4593 build(deps): bump github.com/spf13/cobra from 0.0.5 to 0.0.7
31f2091f5 build(deps): bump github.com/sanity-io/litter from 1.2.0 to 1.3.0
d4611c432 modules: Add noVendor to module config
20af9a078 modules: Add ignoreImports to module imports config
9a1e6d15a modules: Make ignoreVendor a glob pattern
84adecf97 build(deps): bump github.com/gorilla/websocket from 1.4.1 to 1.4.2
573558a07 build(deps): bump github.com/fsnotify/fsnotify from 1.4.7 to 1.4.9
8b10c22f8 build(deps): bump github.com/kyokomi/emoji
195bd1243 build(deps): bump github.com/markbates/inflect from 1.0.0 to 1.0.4
6a544ece2 build(deps): bump github.com/frankban/quicktest from 1.7.2 to 1.10.2
4b430d456 Encode & in livereload injected code
b9f10c75c build(deps): bump github.com/niklasfasching/go-org from 1.3.1 to 1.3.2
537c598e9 build(deps): bump github.com/bep/golibsass from 0.6.0 to 0.7.0
67348676f build(deps): bump golang.org/x/text from 0.3.2 to 0.3.3
f9cc0ec76 build(deps): bump github.com/evanw/esbuild from 0.6.5 to 0.6.32
b5483eed6 build(deps): bump github.com/nicksnyder/go-i18n from 1.10.0 to 1.10.1
90285f475 Revert "Update dependabot.yml"
4949bdc2e markup/asciidocext: Fix broken test
f7c1b5fe1 docs: Update replaceRE func
183e86260 docs: Update replace func
f50ee6bbe docs: Update merge function
c0655ba6c Update dependabot.yml
a2dda22c3 Create dependabot.yml
910d81a69 Remove Pygments from requirements.txt
8c490a73b docs: Regen CLI docs
e6cd9da42 docs: Regen docs helper
dcf25c0b4 markup/asciidocext: Revert trace=true
7d7771b67 Squashed 'docs/' changes from 7297c1172..d3eb97a33
b9e4f5898 Merge commit '7d7771b673'
e820b366b Update to Go 1.15.1 and 1.14.8
4055c1218 Fix some change detection issues on server reloads
3ba7c9253 markup/asciidoc: Add support for .TableOfContents
19ef27b98 markup/goldmark: Add a test case
c6b661de8 js.Build: Add SourceMap flag with inline option
cdfd1c99b tpl: Add limit support to replaceRE
047af7cfe tpl: Extend merge to accept multiple parameters
f9ebaaed1 tpl: Add limit option to replace template function
d39636a5f commands: Remove logic that hides 'Building Sites' message after build completes
ad01aea3f Fixed misspelled words
ec3742046 Improve stderr logging for PostCSS and simlilar
ae63c2b5c Fail on  partials with return when given none or a zero argument
e627449c0 Update to Go 1.15
c2235c6a6 Revert "Update stale.yml"
4f69ade71 Update stale.yml
f8b8b091f Merge commit 'cb39847dee'
cb39847de Squashed 'docs/' changes from a26d0e610..7297c1172
5f4259014 Remove trailing whitespace and tabs from RSS templates
f3cb0be35 Fix a typo in CONTRIBUTING.md
bffc4e12f Revert "Fix ellipsis display logic in pagination template"
12f6a1cdc Respect mediatypes for deploy
2fa851e65 Fix ellipsis display logic in pagination template
21dbfa1f1 mage: Add uninstall target
e5591e89d deps: Update Chroma to 0.8.0
88929bc23 deps: Update go-org to v1.3.1
850c18bfe releaser: Prepare repository for 0.75.0-DEV
da0437b48 releaser: Add release notes to /docs for release of 0.74.3
90fe00df0 releaser: Bump versions for release of 0.74.3
02efadc24 releaser: Add release notes for 0.74.3 [ci skip]
00e00da23 publisher: Collect transition attributes as classes
45c665d39 Fix Asciidoctor args
a06c06a5c Fix date format in internal schema template
0256959a3 resources/js: Add option for setting bundle format
eded9ac2a resources/js: Simplify options handling
8d7251282 make sure documentation intro text only appears once
e81aef0a9 resources/js: Add es5 build target
673e622fa Merge commit '28bd06265e'
28bd06265 Squashed 'docs/' changes from c3b4f8410..a26d0e610
9f9191471 deps: esbuild v0.6.5
3727a9d11 releaser: Prepare repository for 0.75.0-DEV
48565de62 releaser: Add release notes to /docs for release of 0.74.2
808e12621 releaser: Bump versions for release of 0.74.2
aa85a46dc releaser: Add release notes for 0.74.2 [ci skip]
35011bcb2 Add .Defines to js.Build options
084624baa releaser: Prepare repository for 0.75.0-DEV
15163266c releaser: Add release notes to /docs for release of 0.74.1
a74f7d3cc releaser: Bump versions for release of 0.74.1
cb84d9816 releaser: Add release notes for 0.74.1 [ci skip]
c91dbe4ce Fix baseof block regression
6e0452e18 releaser: Prepare repository for 0.75.0-DEV
d2b116268 releaser: Add release notes to /docs for release of 0.74.0
626518430 releaser: Bump versions for release of 0.74.0
797127010 Release 0.74.0
1672a332d releaser: Add release notes for 0.74.0
823ce055e Squashed 'docs/' changes from cfd74b57d..c3b4f8410
5f7a65a08 Merge commit '823ce055ed'
25e3da334 docs: Regenerate docs helper
9df98ec49 Add proper Media Type handling in js.Build
2fc338070 Add js.Build asset bundling
f1916f114 Merge commit '6aa5c9117f'
6aa5c9117 Squashed 'docs/' changes from ac2c4a487..cfd74b57d
12a65e76d Add openapi3.Unmarshal
58c0f5e61 Remove trailing hyphen from auto heading ID
a1c3e3c1f deploy: Ensure that non-trivial default flag values are passed through.
42e150fbf Fix server reload when non-HTML shortcode changes
028b35678 tpl/strings: Add strings.Count
e9f87c4e3 Update formats.md doc for new allowed extensions.
defd7106b tpl: Add debug.Dump
beb6c03bc Update config.go to add two Asciidoctor extensions
4a3efea7e Add support for inline partials
c66dc6c74 Add support for native Org dates in frontmatter
127d5feb3 deps: Update go-org to v1.3.0
2d42ba912 deps: Update go-org to v1.2.0
5b7b5dea1 Update bug_report.md
ccfaeb678 hugolib: Add missing zero check on file
057b1377c cache: Remove some unused code
48dbb593f commands: Add an option to print memory usage at intervals
f0266e2ef Rework external asciidoctor integration
77aa385b8 Enable the embedded template test when race detector is off
545a1c1ce Merge branch 'release-0.73.0'
47aaa52e3 releaser: Prepare repository for 0.74.0-DEV
428907cc3 releaser: Add release notes to /docs for release of 0.73.0
a78b3e341 releaser: Bump versions for release of 0.73.0
cfcb01451 Release 0.73.0
0b579db80 Updated installation instruction about Sass/SCSS support
ee5d027cd releaser: Add release notes for 0.73.0
4a340ba25 Remove some old release notes
3466884e3 Create robots.txt in the domain root directory
6ff435aa3 Make GroupByParamDate work with string params
82abca32f Add GroupByLastmod
fc045e12a Rename taxonomy kinds from taxonomy to term, taxonomyTerm to taxonomy
9679023f2 Fix aliases with path in baseURL
0a9172672 Merge commit 'efa74c5c6e'
efa74c5c6 Squashed 'docs/' changes from 9be494de3..ac2c4a487
6408c1cbc Fix server data race/nil pointer in withMaps
522ba1cd9 Fix order of GetTerms
889dc47ce Add genDocsHelper mage target
f720fe56d Fix aliases with uglyURLs
d6ed17c60 Fix crash for closing shortcode with no .Inner set
145b3fcce Fix aliases with relativeURLs
01e249e97 Regenerate templates
4b560cc11 Beautify HTML generated by pagination template
e3e627e6b Add a nested data dir test
83d03a520 hugofs: Use os.PathError  in RootMappingFs.doLstat
fc0f13b68 commands: Fix URL rewrites vs fast render server mode
7eeebe1e5 tpl/crypto: Add hmac
740fa4a91 Remove credit (#7347)
f8c67f93e Allow hook template per section/type
3d9235e8f tpl: Fix bad rounding in NumFmt
f7d909f39 releaser: Prepare repository for 0.73.0-DEV
8a7ef3cf4 releaser: Add release notes to /docs for release of 0.72.0
2dfe242ea releaser: Bump versions for release of 0.72.0
7a1464e54 Release 0.72.0
41d50b4dd releaser: Add release notes for 0.72.0
4d53ae697 releaser: Adjust the "thanks" section
626b16e02 Merge commit '9e1dcefc5f'
9e1dcefc5 Squashed 'docs/' changes from 6c2195936..9be494de3
2919a6a50 common/maps: Add Scratch.Values
432885c49 deps: Update Goldmark to improve Typographer
6a3e89743 Add redirect support to the server
9613e3e8a Fix typo in install instructions
c950c86b4 publisher: Fix tag collector for nested table elements
915202494 snap: Fix build error: my previous commits did not fix it
b3e4f911f releaser: Prepare repository for 0.72.0-DEV
a301f6b2a releaser: Add release notes to /docs for release of 0.71.1
646bc8508 releaser: Bump versions for release of 0.71.1
5c0d10045 releaser: Add release notes for 0.71.1 [ci skip]
81f563324 Add some more date test cases
9698b0dab Fix RenderString vs render hooks
32344fe3d Prevent WARNINGs in RenderString
4d7fa9f11 Fix IsAncestor/IsDescendant for taxonomies
a985efcec Fix GetPage on section/bundle name overlaps
6c3c6686f Fix Go template script escaping
c34bf4856 Add a test helper
833d16d46 releaser: Prepare repository for 0.72.0-DEV
06150c87b releaser: Add release notes to /docs for release of 0.71.0
330e52ebe releaser: Bump versions for release of 0.71.0
9e7823537 Release 0.71
7cd66c53b releaser: Add release notes for 0.71.0
723ec555e Fix Babel on Windows
518d14964 commands: Use WARN log level also for the early initialization
e0e81b280 Merge commit 'c9403cbcea'
c9403cbce Squashed 'docs/' changes from ec0abe052..6c2195936
3cc41523b Update to Go 1.14.3 and Go 1.13.11
2fd0a5a67 Improve error message when no Babel installed
6e051c053 Add test for headings render hook
423b8f2fb Add render template hooks for headings
991934497 Add math.Pow
558c09305 deploy: Do not suppress .well-known/ directory
b69a36140 snap: Quote "@babel/cli" to solve build error
a0103864a snap: Remove custom x-nodejs plugin
b342e8fbd Upgrade chroma to 0.7.3 to fix invalid css
6205d56b8 Use .Lastmod for og:updated_time
a5039ddda releaser: Prepare repository for 0.71.0-DEV
7f47b99ea releaser: Add release notes to /docs for release of 0.70.0
b98e2f66b releaser: Bump versions for release of 0.70.0
57ebab7c2 Release 0.70.0
0e314925f releaser: Add release notes for 0.70.0
e4621446c Merge commit '89044b8f87'
89044b8f8 Squashed 'docs/' changes from 19f44e150..ec0abe052
01befcce3 deps: Update minify to v2.6.2
04b1a6d99 Add support for sort by boolean
dd31e8000 deps: Update to Libsass 3.6.4
6add6d77b Rename transpileJS to babel
2a171ff1c resources: Add JavaScript transpiling solution
67f920419 Disable a test locally
c03ea2b66 Fix some missing JS class collector cases
fe60b7d9e Add diagnostic hints to init timeout message
c2d9fd1eb releaser: Prepare repository for 0.70.0-DEV
ec9dcf304 releaser: Add release notes to /docs for release of 0.69.2
03802ff3c releaser: Bump versions for release of 0.69.2
5e31198c9 releaser: Add release notes for 0.69.2 [ci skip]
8d5766d41 Fix IsAncestor and IsDescendant when the same page is passed
5c41f41ad deps: Update goldmark-highlighting
27a4c4410 Fix IsAncestor and IsDescendant under subsection
ade27699e releaser: Prepare repository for 0.70.0-DEV
17661debb releaser: Add release notes to /docs for release of 0.69.1
8549189e8 releaser: Bump versions for release of 0.69.1
c2c7a4ce5 releaser: Add release notes for 0.69.1 [ci skip]
49e6c8cb4  hugolib/filesystems: Fix typo in test suite
f37e77f2d Fix class collector when running with --minify
27af5a339 related: Fix toLower
b3c825756 Fix broken test
5146dc614 tpl/tmplimpl/template: Change defer RLock to RUnlock
736f84b2d hugolib: Add Unlock before panic
cd4d82020 docs: Fix typo in Hugo's Security Model
2b28e5a9c deps: Update go-org to v1.1.0
102ec2da7 commands: Modify gen chromastyles to output all CSS classes
feaa582cb deps: Update to goldmark v1.1.28
ee67dbeff Fix query parameter handling in server fast render mode
4a3f2427e releaser: Prepare repository for 0.70.0-DEV
4205844bc releaser: Add release notes to /docs for release of 0.69.0
9b55d1358 releaser: Bump versions for release of 0.69.0
6f56a636f Update 0.69.0-relnotes.md
5ec7fa343 releaser: Add release notes for 0.69.0
b7ff4dc23 docs: Regen docs helper
da3c3e5fb Squashed 'docs/' changes from 20d77860b..19f44e150
30748decf Merge commit 'da3c3e5fbd'
095bf64c9 Collect HTML elements during the build to use in PurgeCSS etc.
7791a804e deps: Update to latest emoji package
c774b230e Update hosting-on-aws-amplify.md
2f721f8ec Add basic "post resource publish support"
8568928aa tpl: Extend Jsonify to support options map
1bc93021e tpl: Extend Jsonify to support optional indent parameter
7eba37ae9 Typo correction
efc61d6f3 commands: Use semver for min_version per recommendations
d8d6a25b5 modules: Fix hugo mod vendor for regular file mounts
9f12be54e Revert "Revert "common/herrors: Fix typos in comments""
4437e918c Revert "common/herrors: Fix typos in comments"
4de3ecdc2 deps: Updateto gitmap v1.1.2
1123711b0 common/herrors: Fix typos in comments
3d84ef972 Merge commit 'c494c37a45'
c494c37a4 Squashed 'docs/' changes from 2a0ea423d..20d77860b
9c9987535 helpers: Fix TrimShortHTML
4a39564ef Fix IsDescendant/IsAncestor for overlapping section names
b6e097cfe fix typo in getting started
19a8accc9 releaser: Prepare repository for 0.69.0-DEV
157669a0e releaser: Add release notes to /docs for release of 0.68.3
8f49df946 releaser: Bump versions for release of 0.68.3
1a68ad4e3 releaser: Add release notes for 0.68.3 [ci skip]
523d51948 Fix _build.list.local logic
971b28904 releaser: Prepare repository for 0.69.0-DEV
63bbb40df releaser: Add release notes to /docs for release of 0.68.2
73ae6d581 releaser: Bump versions for release of 0.68.2
e18a2ad3f releaser: Add release notes for 0.68.2 [ci skip]
cfa73050a Fix cache reset for a page's collections on server live reload
244e49c0e releaser: Prepare repository for 0.69.0-DEV
98dc46e1a releaser: Add release notes to /docs for release of 0.68.1
87dd5725d releaser: Bump versions for release of 0.68.1
8c6a03a92 releaser: Add release notes for 0.68.1 [ci skip]
1ce3e7d52 releaser: Include "Revert" commits in change log
c9dc316ad Revert "resources: Add data context to the key in ExecuteAsTemplate"
1664a0e89 releaser: Prepare repository for 0.69.0-DEV
1e67854b1 releaser: Add release notes to /docs for release of 0.68.0
e1b609af9 releaser: Bump versions for release of 0.68.0
8e5566af6 Release 0.68.0
1005f754e Update 0.68.0-relnotes.md
efde7078e releaser: Add release notes for 0.68.0
2ebb9f548 Fix Go build version
7204b354a Some minify configuration adjustments
574c2959b Add minify config
99958f90f Allow headless bundles to list pages via $page.Pages and $page.RegularPages
1d91d8e14 Update to Go 1.14.1 and 1.13.9
95f492114 Fix GetTerms nil pointer
c947351d7 Merge commit 'aa54803a84'
aa54803a8 Squashed 'docs/' changes from 988f7d5c2..2a0ea423d
cc2a5d52a Pass directory name to filters in LstatIfPossible in the same way as Readdir
52c159c45 Update to goldmark 1.1.25.
c7b6d74e8 resources: Fix scss vs css import regexp
1a8af7d4f Add workaround for regular CSS imports in SCSS
03b93bb98 Add .RegularPagesRecursive
94fb4dc3d releaser: Prepare repository for 0.68.0-DEV
4f44227bd releaser: Add release notes to /docs for release of 0.67.1
99d36237c releaser: Bump versions for release of 0.67.1
e371162c3 releaser: Add release notes for 0.67.1 [ci skip]
5eadc4c0a metrics: Fix --templateMetricsHints
18cb21ff2 resources: Add data context to the key in ExecuteAsTemplate
df298558a Improve Tailwind/PostCSS error messages
b1106f871 deps: Update Blackfriday
c0177fe2b resources: Try to fix a Go 1.15 go vet error
5914f91b6 Add languageDirection to language configuration
5b4659fa0 releaser: Prepare repository for 0.68.0-DEV
7f1da3efc releaser: Add release notes to /docs for release of 0.67.0
f7d4b01c6 releaser: Bump versions for release of 0.67.0
b809b9680 Update 0.67.0-relnotes.md
a9c91361c releaser: Add release notes for 0.67.0
63393230c docs: Doument the server config
6b61f2a5b Merge commit '14e369b961'
14e369b96 Squashed 'docs/' changes from 341ecabb2..988f7d5c2
6cceef65c Fix ambigous error on site.GetPage
ffcb4aeb8 Fix handling of HTML files without front matter
8279d2e22 Support unComparable args of uniq/complement/in
c4fa2f079 tpl: Fix error with unicode in file paths
108314444 Add HTTP header support for the dev server
51e178a6a deploy: Add include and exclude support for remote
cb12f41a9 releaser: Prepare repository for 0.67.0-DEV
78c3c78fc releaser: Add release notes to /docs for release of 0.66.0
713132cd4 releaser: Bump versions for release of 0.66.0
bbaefd7e3 Update 0.66.0-relnotes.md
cc1a71886 releaser: Add release notes for 0.66.0
6a34f88dc Skip some tests on CircleCI
ae383f04c {{ in }} should work with html.Template type
ee31e61fb docs: Regen CLI docs
760a87a45 commands: Add --all flag to hugo mod clean
3d3fa5c3f Add build.UseResourceCacheWhen
ee3d02134 Update dependency list in README.md
8947c3fa0 Fix ref/relref short lookup for pages in sub-folder
d7798906d tpl: Change error message on missing resource
305ce1c9e resources: Add full filename to image when processing fails
3e9db2ad9 hugolib: Fix error handling in page collector
449deb7f9 Update dependency list in README
1746e8a9b Fix ref/relRef regression for relative refs from bundles
6f48146e7 identity: Fix potential infinite recursion in server change detection
b0d850321 Fix rebuild logic when editing template using a base template
b66d38c41 resources: Add basic @import support to resources.PostCSS
05a74eaec deploy: Implement include/exclude filters for deploy
33ae62108 Update to Go 1.14 and 1.13.8
1352bc880 Add hugo.IsProduction function
d184e5059 tpl: Add math.Sqrt
322c285ba releaser: Prepare repository for 0.66.0-DEV
211ba42a9 releaser: Add release notes to /docs for release of 0.65.3
0ac528d74 releaser: Bump versions for release of 0.65.3
d8bde266c releaser: Add release notes for 0.65.3 [ci skip]
0bd6356c6 Fix panic when home page is drafted
ca68abf0b Fix goldmark toc rendering
a524124be Fix crashes for 404 in IsAncestor etc.
c1eb62512 releaser: Add release notes to /docs for release of 0.65.2
1510f0778 releaser: Bump versions for release of 0.65.2
aa2ef4542 releaser: Add release notes for 0.65.2 [ci skip]
76b2afe64 Apply missing go fmt
f46053034 Fix panic on no output formats
4c2a0de41 Fix panic in 404.Parent
6be6684cc releaser: Add release notes to /docs for release of 0.65.1
dbaa15d40 releaser: Bump versions for release of 0.65.1
a449e87da releaser: Add release notes for 0.65.1 [ci skip]
7ef5a4c83 hugolib: Fix 2 Paginator.Pages taxonomy regressions
a70bbd069 hugolib: Fix deletion of orphaned sections
24afe2b82 releaser: Add release notes to /docs for release of 0.65.0
9fd7d3957 releaser: Bump versions for release of 0.65.0
c45025cb9 releaser: Add release notes for 0.65.0
a5ebdf7d1 docs: Regenerate CLI docs
9bdedb251 Fix lazy publishing with publishResources=false
dce210ab5 modules: Improve "hugo mod clean"
0b96aba02 commands: Add "hugo mod verify"
fa520a2d9 Add Page.GetTerms
4b670bc8c Squashed 'docs/' changes from 16753a78d..341ecabb2
82029c1ec Merge commit '4b670bc8cc'
7489a8645 Add a list terms benchmark
da54787cf Handle disabled RSS even if it's defined in outputs
c7975b48b Fix goMinorVersion on non-final Go releases
b2dcd53e3 Use the tree for taxonomy.Pages()
36983e618 Add some cagegories to the site collections benchmarks
d73e37387 tpl: Adjust the RSS taxonomy logic
aa3e18305 tpl: Fix RSS template for the terms listing
1b7acfe76 Fix taxonomy
19e12caf8 Fix RenderString for pages without content
20f2211fc modules: Do not try to get local themes in "hugo mod get"
a21a9373e deps: Update goldmark-highlighting
775c7c247 commands: Support "hugo mod get -u ./..."
eada236f8 Introduce a tree map for all content
e5329f13c Another benchmark rename
5b145ddc4 Rename the Edit benchmarks
3c568ad01 markup/highlight: Fix chroma highlight
54bdcaaca Refactor a benchmark to make it runnable as test
1622510a5 Add benchmark for content edits
56d0b6588 Add "go mod verify" to build scripts
75c3787fc Add git to Dockerfile
9babb1f0c deps: Update go.sum
8a5124d6b commands: Rename doWithCommandeer to cfgInit/cfgSetAndInit
898a0a96a deps: Update golibsass
3b721110d Shuffle test files before insertion
40ba7e6d6 Update to LibSass v3.6.3
4f43c9022 releaser: Prepare repository for 0.65.0-DEV
c327e75d0 releaser: Add release notes to /docs for release of 0.64.1
8bd8d4fe9 releaser: Bump versions for release of 0.64.1
ad7c38cd6 releaser: Add release notes for 0.64.1 [ci skip]
b78576fd3 hugofs: Fix mount with hole regression
18888e09b Fix bundle resource ordering regression
1e5eb8679 Merge commit '3c0036805d'
3c0036805 Squashed 'docs/' changes from bd0e15bb6..16753a78d
7f0ebd4a3 CONTRIBUTING: Fix note about CGO
23ea43180 Update Go version requirement
6a74cbe91 releaser: Prepare repository for 0.65.0-DEV
241db8f78 releaser: Add release notes to /docs for release of 0.64.0
7624ab028 releaser: Bump versions for release of 0.64.0
8490a0aa9 Update 0.64.0-relnotes.md
bd731d27b releaser: Add release notes for 0.64.0
80dd6ddde Fix module mount in sub folder
299731012 Mention a "no CGO rule"
2bbc865f7 commands: Fix config environment handling
0792cfa9f Update to Go 1.13.7 and Go 1.12.16
b3f0674b8 transform/livereloadinject: Add defer to livereload script tag
ef78a0d18 transform/livereloadinject: Don't use document.write to inject livereload
585958645 hubolig: Add a render hook whitespace test
2d159e9cc Do not render alias paginator pages for non-HTML outputs
f45cb3172 Fix base template handling with preceding comments
49ef64720 modules: Fix "hugo mod get -u" with no arguments
8f08cdd0a transform/livereloadinject: Inject livereload script right after head if possible
281abb18e deps: Update goldmark to v1.1.22
d8e685154 releaser: Prepare repository for 0.64.0-DEV
934ee21fa releaser: Add release notes to /docs for release of 0.63.2
c7427a50e releaser: Bump versions for release of 0.63.2
49e2931eb releaser: Add release notes for 0.63.2 [ci skip]
e8831a056 hubolib: Revert to .Type = "page" when empty
74b6c4e5f And now finally fix the 404 templates
8df5d76e7 Fix 404 with base template regression
8ae2c9c3d releaser: Prepare repository for 0.64.0-DEV
ce9aceb74 releaser: Add release notes to /docs for release of 0.63.1
fd32849bf releaser: Bump versions for release of 0.63.1
417f9ddf5 releaser: Add release notes for 0.63.1 [ci skip]
0df7bd62d deps: Make the build flags shared between sites
f441f6751 Fix baseof with regular define regression
7ed22e9fb Revert to minify v2.6.1
fb974ae87 releaser: Prepare repository for 0.64.0-DEV
745ddcbba releaser: Add release notes to /docs for release of 0.63.0
3b3f5a259 releaser: Bump versions for release of 0.63.0
d10ed683c Release 0.63.0
19e387d18 releaser: Add release notes for 0.63.0
cafb1d53c docs, output: Add base template lookup variant to docs.json
4f466db66 docs: Regen docs helper
17af79a03 Fix 0.62.1 server rebuild slowdown regression
2fefc0160 tpl/compare: Fix eq when > 2 args
0c251be66 Allow multiple arguments in ne/ge/gt/le/lt functions Treat op arg1 arg2 arg3 ... as (arg1 op arg2) && (arg1 op arg3) and so on for ne/ge/gt/le/lt.
836c24261 hugolib: Disable a test assertion on ARM
c6d650c8c tpl/tplimpl: Rework template management to get rid of concurrency issues
8585b388d deps: Update go-org
d61bee5e0 examples: Fix blog not building
21ca2e9ce Add support for newline characters in raw string shortcode
3efa1d812 deps: Update github.com/alecthomas/chroma
65ec8fe82 deps: Update minify to v2.7.2
d3e8ab2e3 deps: Update Goldmark to v1.1.21
da8145565 Allow raw string literals in shortcode params
0c0bb3728 deps: Update github.com/gohugoio/testmodBuilder
ddd75f212 hugolib: Some more benchmark adjustments
4ed6ebef4 hugolib: Adjust site benchmarks
94cfdf6be deps: Update direct dependencies
451380177 minifiers: Update to new CSS config
56354a63b deps: Update to Minify v2.7.0
b9b73a2f6 Revert "Add support for freebsd/arm64"
aead8108b Add support for freebsd/arm64
1cf235412 tpl: Put Go's internal template funcs in Hugo's map
df6e9efd8 Update releasenotes_writer.go
ea05c0e84 hugolib: Add a benchmark with lots of templates
273047b5b releaser: Prepare repository for 0.63.0-DEV
83e501849 releaser: Add release notes to /docs for release of 0.62.2
12230b689 releaser: Bump versions for release of 0.62.2
afdb180e2 releaser: Add release notes for 0.62.2 [ci skip]
196a9df58 hugolib: Fix relative .Page.GetPage from bundle
9b6e61464 markup/goldmark: Adjust auto ID space handling
d62ede8e9 docs: Document the new autoHeadingIDType setting
81b7e48a5 docs: Regenerate docshelper
16e7c1120 markup/goldmark: Add an optional Blackfriday auto ID strategy
8f071fc15 markup/goldmark: Make the autoID type config a string
469351d5b Merge commit '26f1458a2d'
26f1458a2 Squashed 'docs/' changes from 54f0e8776..bd0e15bb6
5ee1f0876 markup/goldmark: Simplify code
a82d2700f markup/goldmark: Make auto IDs GitHub compatible
ae816452b releaser: Prepare repository for 0.63.0-DEV
a1518704a releaser: Add release notes to /docs for release of 0.62.1
3a21a1708 releaser: Bump versions for release of 0.62.1
451746ddd releaser: Add release notes for 0.62.1 [ci skip]
ff6253bc7 Support files in content mounts
aa4ccb8a1 Update alpine base image in Dockerfile to 3.11
5509954c7 hugolib: Fix inline shortcode regression
6b59b64f0 releaser: Prepare repository for 0.63.0-DEV
6608f1557 releaser: Add release notes to /docs for release of 0.62.0
b361d9a46 releaser: Bump versions for release of 0.62.0
592a7d104 Release 0.62.0
93216fda7 releaser: Add release notes for 0.62.0
8a4005cf2 Squashed 'docs/' changes from af4b7ac5b..54f0e8776
740b72558 Merge commit '8a4005cf2b'
1fb17be9a deps: Update Goldmark to v1.1.18
51d89dab1 deps: Update go-org
c8bfe47c6 docs: More on hooks
50cc7fe54 tpl: Do not return any value in errorf
1773d71d5 tpl: Add a warnf template func
8a58ebb31 hugolib: Improve error and reload handling  of hook templates in server mode
045368381 deps: Update to Goldmark v1.1.17
55c29d4de docs: Regen docshelper
ccb1bf1ab tpl/collections: Some more params merge adjustments
a67d95fe1 Preserve HTML Text for image render hooks
ad6504e6b Fix abs path handling in module mounts
158e7ec20 Fix incorrect MIME type from image/jpg to image/jpeg
eef934ae7 deps: Update Goldmark
00954c5d1 Preserve HTML Text for link render hooks
1b785a7a6 tpl/collections: Fix merge vs Params
d20ca3700 tpl: Get rid of the custom template truth logic
3e316155c docs: Footnote
e625088ef Add render template hooks for links and images
67f3aa72c Merge commit '2e711a28c7'
2e711a28c Squashed 'docs/' changes from 51c4f3184..af4b7ac5b
0947cf958 Enhance accessibility to issues
3c24ae030 hugolib: Fix test
03d6960a1 deps: Re-introduce the correct version of Goldmark
92c7f7ab8 tpl: Add some comments
a03c631c4 Rework template handling for function and map lookups
167c01530 Create lightweight forks of text/template and html/template
4c804319f markup/tableofcontents: Add config option for ordered list
186a5ebfc releaser: Prepare repository for 0.62.0-DEV
9b445b9da releaser: Add release notes to /docs for release of 0.61.0
3af783966 releaser: Bump versions for release of 0.61.0
31f322a61 Release 0.61.0
38c60f2be releaser: Add release notes for 0.61.0
3cc217a65 deps: Update Goldmark
5f8c2818f Deprecate Ace and Amber
c5f2f5837 markup: Add typographic chars from goldmark to toc
0efb00c2a tpl/partials: Allow any key type in partialCached
40a092b06 markup: Reimplement pygmentsCodefencesGuessSyntax
d534ce942 deps: Update Goldmark
a6b6b135a releaser: Prepare repository for 0.61.0-DEV
960667561 releaser: Add release notes to /docs for release of 0.60.1
6c0556308 releaser: Bump versions for release of 0.60.1
f5250ec09 releaser: Add release notes for 0.60.1 [ci skip]
86a5b59f6 deps: Update minify
bb80fff69 Fix headless regression
347cfb0c1 deps: Update Goldmark
b60ae35b9 hugolib: Fix timeout number parsing for YAML/JSON config
003ba5b10 releaser: Prepare repository for 0.61.0-DEV
f2dea9b03 releaser: Add release notes to /docs for release of 0.60.0
763b0dcb9 releaser: Bump versions for release of 0.60.0
b2969b7a7 Release 0.60.0
60fea562c releaser: Add release notes for 0.60.0
14a1de14f modules: Add some more output if modules download takes time
dcde8af8c Add some internal template image tests
c91970c08 tpl/tplimpl: Featured and Site.Params image support for Schema
dd1e5fc0b hugolib: Disable test assertion on Windows
b0c7749fa deps: Update Goldmark
25a6b3369 tpl/tplimpl: Add support for featured and global image to OpenGraph template
017664392 hugolib: Fix cascade in server mode
da5352359 hugolib: Fix .Sections vs siblings
96f09659c Fix language handling in ExecuteAsTemplate
03b369e67 hugolib: Adjust .Site.Permalinks deprecation level
69fd1c60d hugolib: Remove .Site.Ref/RelRef
33d733300 Deprecate mmark
e3451371b hugolib: Fix recently broken timeout config
5c5231e09 commands: Use HUGO_ENV if set
d6f7a9e28 resources/images: Make the image cache more robust
031f948f8 Update to Go 1.13.4 and Go 1.12.13
71597bd1a mage: Restore -v behaviour
a8e9f8389 hugolib: Increase default timeout value to 30s
03e2d7462 hubolig: Fix potential data race
ea96e1dc5 Revert "deps: Update Goldmark"
822191286 deps: Update Goldmark
8beaa4c25 mage: Fix mage check on darwin and add debugging output
8a89b8582 commands: Fix jekyll metadata import on individual posts
e1175ae83 Improve grammar in README.md
a2d77f4a8 markup/highlight: Replace the temp for with a dependency
b546417a2 deps: Update Chroma
4175b0468 deps: Update Goldmark
55f951cbb markup/tableofcontents: GoDoc etc.
20f351ee4 Minor cleanups
bfb9613a1 Add Goldmark as the new default markdown handler
a3fe5e5e3 Fix Params case handling in the index, sort and where func
cd07e6d57 Fix GetPage Params case issue
628efd6e2 common/para: Add parallel task executor helper
2dcc1318d Add some more output if loading modules takes time
14a985f8a Update homepage.md
0cf85c071 hugolib: Add a benchmark
20ec9fa2b modules: Do not check for remote modules if main project is vendored
812688fc2 hugolib: Fix emoji handling inside shortcodes
a2670bf46 tpl/collections: Allow dict to create nested structures
1a36ce9b0 commands: Add hint when dir not empty
90d0cdf23 tpl/collections: Add collections.Reverse
95ef93be6 tpl/collections: Make index work with slice as the last arg
79355043e Merge commit 'efc0b1bb6c'
efc0b1bb6 Squashed 'docs/' changes from 723da4a37..51c4f3184
d1d1f240a hubolib: Headless bundles should not be listed in .Pages
70a1aa345 Support Go time format strings in permalinks
cafecca44 travis: Increase timeout to 30000 for mage -v check
5f6b6ec68 Prepare for Goldmark
366ee4d8d deps: Update quicktest
c26d00db6 hugolib: Fix ref/relref anhcor handling
8483b53ae deps: Update to Chroma v0.6.9 for Java lexer fix
9f46a72c7 tpl/collections: Add some index map test cases
9abd39678 helpers: Use pointer receiver for ContentSpec
ad4c56b55 travis: Allow arm64 to fail
3717db1f9 minifiers: Add a JSON roundtrip test
ae4fde086 Update .travis.yml for arm64 support, etc.
c6d69d0c9 mage: Skip Test386 on non-AMD64 architectures
c3d433af5 Update past go-cmp's checkptr fix
07a203406 releaser: Prepare repository for 0.60.0-DEV
d5dab232c releaser: Add release notes to /docs for release of 0.59.1
e04a22c5e releaser: Bump versions for release of 0.59.1
d14265da8 releaser: Add release notes for 0.59.1 [ci skip]
33c474b9b hugofs: Fix crash in multilingual content fs
ed2682325 Dockerfile: Switch to mage builds, various optimizations
66fe68ffc resources/images: Add exception for new test image
c5e1e8241 Adjust benchmark templates
baa975082 deps: Update to Chroma v0.6.8 to fix a crash
3e8b5a5c0 deps: Update quicktest
e6aa6edb4 Do not attempt to build if there is no config file
6bcc5ad8b releaser: Prepare repository for 0.60.0-DEV
1dd0c69c7 releaser: Add release notes to /docs for release of 0.59.0
b084af4bf releaser: Bump versions for release of 0.59.0
0237d4595 Release 0.59.0
109ac877c releaser: Add release notes for 0.59.0
5ac0f751a Squashed 'docs/' changes from 0584815c8..723da4a37
de8ca7e4d Merge commit '5ac0f751aa'
5070ba6c9 Squashed 'docs/' changes from fdea5430f..0584815c8
ec5962278 Merge commit '5070ba6c9e'
b9bd35d72 Squashed 'docs/' content from commit fdea5430f
27aef3f1f Merge commit 'b9bd35d72e' as 'docs'

git-subtree-dir: docs
git-subtree-split: 9b06f951e61081c503927bb772b75f93504aeba8
2024-06-21 09:35:57 +02:00
Dietrich Epp
d5542ed286 deploy: Add stripIndexHtml target option
This new configuration parameter causes paths matching
"<dir>/index.html" to be stored as "<dir>/" remotely. This simplifies
the cloud configuration needed for some use cases, such as CloudFront
distributions with S3 bucket origins. Before this change, users must
configure their S3 buckets as public websites (which is incompatible
with certain authentication / authorization schemes), or users must add
a CloudFormation function to add index.html to the end of incoming
requests. After this change, users can simply use an ordinary CloudFront
distribution (no additional code) with an ordinary S3 bucket origin (and
not an S3 website).

This adds tests to ensure that functionality like matchers is unaffected
by this change. I have also tested that the functionality works as
expected when deploying to a real S3 / CloudFront website.

Closes #12607
2024-06-20 19:37:22 +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
Bjørn Erik Pedersen
b46d101d5a
Update README.md 2024-06-19 12:13:30 +02:00
Joe Mooring
8efc75b73f markup/goldmark: Add the Hugo Goldmark Extras "delete" extension
With Goldmark v1.7.1 and earlier, the Goldmark "strikethrough" extension was
triggered by wrapping text within a pair of double-tilde characters. With
Goldmark v1.7.2 and later, to provide full GFM compatibility, the Goldmark
"strikethrough" extension is triggered by wrapping text within a pair of
single- or double-tilde characters.

This change created a conflict with the Hugo Goldmark Extras "subscript"
extension.

When enabling the Hugo Goldmark Extras "subscript" extension, if you
want to render subscript and strikethrough text concurrently, you must:

1. Disable the Goldmark "strikethrough" extension
2. Enable the Hugo Goldmark Extras "delete" extension

Closes #12597
2024-06-18 18:56:20 +02:00
Bjørn Erik Pedersen
ad6d91cabd Fix live reload when both CSS and HTML changes
This seems to be a browser bug (tested in both Chrome and Safari on MacOS), but it seems that doing a `window.location.reload()` (or `window.location.reload(true)`) doesn't refresh the CSS changes, even if HTTP caching is disabled.

This commit works around this by doing additional refreshes of the CSSes.

Closes #12600
2024-06-15 20:13:42 +02:00
Joe Mooring
57165d44ed resources: Update Dart Sass error message 2024-06-13 16:25:50 +02:00
Razon Yang
7ee36b3718
config: Fix typo 2024-06-09 17:22:23 +02:00
Bjørn Erik Pedersen
9c3143c45a resources/page: Deprecate PageSize in favor of PagerSize
See #12572
2024-06-09 12:28:24 +02:00
Bjørn Erik Pedersen
9f22bc4414 Rename DefaultPageSize => PagerSize
This was recently introduced. so no breaking change.

The thing is:

* We do not commonly use the prefix Default* even if it can be overridden in the templates.
* PagerSize makes more sense and is also the term used in the code.
2024-06-09 12:28:24 +02:00
Joe Mooring
8cf94aea73 deps: Upgrade github.com/alecthomas/chroma v2.13.0 => v2.14.0
Closes #12580
2024-06-08 20:25:42 +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
1cdd3d0a9e js: Support more recent targets with js.Build / esbuild
Closes #12575
2024-06-08 11:40:19 +02:00
Bjørn Erik Pedersen
b57306d61b deps: Upgrade github.com/evanw/esbuild v0.20.2 => v0.21.4
See #12575
2024-06-08 11:40:19 +02:00
hugoreleaser
1a53a8c2f5 releaser: Prepare repository for 0.128.0-DEV
[ci skip]
2024-06-05 10:41:48 +00:00
hugoreleaser
74e0f3bd63 releaser: Bump versions for release of 0.127.0
[ci skip]
2024-06-05 10:27:59 +00: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
bc05d854b2
resources: Fix spelling 2024-06-04 18:48:39 +02:00
Bjørn Erik Pedersen
be47830a87
deps: Upgrade github.com/gohugoio/httpcache v0.6.0 => v0.7.0
This was somehow missed when merging #12523
2024-06-04 18:32:02 +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
hugoreleaser
c71e24af51 releaser: Prepare repository for 0.127.0-DEV
[ci skip]
2024-06-02 13:15:24 +00:00
hugoreleaser
44f1edcb06 releaser: Bump versions for release of 0.126.3
[ci skip]
2024-06-02 13:02:43 +00: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
Razon Yang
0068f03290
metrics: Increase maximum length of cumulative duration to 15 2024-06-01 17:48:43 +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
74b9b8a229
releaser: Try to fix the last failing step 2024-05-31 09:03:09 +02:00
Bjørn Erik Pedersen
420f26b6bb
releaser: Prepare repository for 0.127.0-DEV 2024-05-30 18:58:47 +02:00
hugoreleaser
312b71232d releaser: Bump versions for release of 0.126.2
[ci skip]
2024-05-30 16:07:40 +00: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
2c88e454d8
Delete .github/workflows/test-dart-sass-v1.yml
That work flow was added to make sure Hugo kept on working for people using the old Dart Sass Protocol binary. We still do, but testing it on every PR build is too much now that all/most people should have upgraded.
2024-05-30 11:42:07 +02:00
Bjørn Erik Pedersen
eaa42a8754
commands: Add shorthand flags -M (--renderToMemory) and -N (--navigateToChanged)
Closes #12530
2024-05-30 11:35:02 +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
Joe Mooring
931e096f21 commands: Improve list command
- Improve help text
- Add "kind" and "section" to CSV output
- Add a "published" subcommand to list content that is not draft,
  expired, or future.

Closes #12520
2024-05-22 19:50:58 +02:00
Joe Mooring
548dc21378 config: Remove extraneous BuildConfig setting
Closes #12519
2024-05-21 14:34:49 +02:00
Joe Mooring
b893a09aa6 tpl/tplimpl: Resolve render hook destinations with leading ./
Closes #12514
2024-05-21 09:38:25 +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
hugoreleaser
3d40aba512 releaser: Bump versions for release of 0.126.1
[ci skip]
2024-05-15 10:42:34 +00: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
hugoreleaser
32c967551b releaser: Bump versions for release of 0.126.0
[ci skip]
2024-05-14 13:24:11 +00:00
Bjørn Erik Pedersen
266140251f
docs: Regen docshelper 2024-05-14 14:46:16 +02:00
Joe Mooring
74ab839ccb tpl/tplimpl: Plainify title and description in twitter_cards.html
Closes #12433
Improves #10900
2024-05-14 14:45:04 +02:00
Joe Mooring
92290aa892 tpl/tplimpl: Plainify title and description in schema.html
Closes #12432
2024-05-14 14:18:49 +02:00
Joe Mooring
6dbbe6dd3a resources/images: Handle NaN EXIF latitude and longitude
Fixes #12490
2024-05-14 14:16:58 +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
Joe Mooring
55dea41c1a create/skeletons: Remove superfluous language code fallback
Closes #12479
2024-05-14 10:24:53 +02:00
Joe Mooring
87ab7f7ffc tpl/tplimpl: Improve locale value in opengraph.html
Closes #12480
2024-05-14 10:24:17 +02:00
dependabot[bot]
ee26e69ce3 build(deps): bump golang.org/x/net from 0.24.0 to 0.25.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.24.0 to 0.25.0.
- [Commits](https://github.com/golang/net/compare/v0.24.0...v0.25.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-10 22:33:46 +02:00
dependabot[bot]
6e83d00a83 build(deps): bump golang.org/x/image from 0.15.0 to 0.16.0
Bumps [golang.org/x/image](https://github.com/golang/image) from 0.15.0 to 0.16.0.
- [Commits](https://github.com/golang/image/compare/v0.15.0...v0.16.0)

---
updated-dependencies:
- dependency-name: golang.org/x/image
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-10 22:33:33 +02:00
Bjørn Erik Pedersen
d02f0622b4 livereload: Improve the livereload script build and update to v4.0.2
This script has very infrequent updates, but just copy pasting the minified source creates some potential trust issues.

This JS will now be pulled from a Git version and both the unminified and minified version gets written to disk.

This way it should be easier to reason about changes in the future.

To upgrade, change the commit hash and run `mage generate`.

Closes #12451
Closes #6290
2024-05-10 22:33:08 +02:00
Joe Mooring
6dfeb9f038 tpl/tplimpl: Retain query string and fragment in render-image.html
Closes #12468
2024-05-10 22:32:48 +02:00
Joe Mooring
ca9a77ef92 markup/goldmark: Support extras extension
Enables inclusion of these HTML elements in Markdown:

- Inserted Text (++inserted++)
- Mark Text (==marked==)
- Subscript (H~2~O)
- Superscript (1^st^)
2024-05-10 22:32:02 +02:00
hugoreleaser
b1bf0bff2c releaser: Prepare repository for 0.126.0-DEV
[ci skip]
2024-05-08 15:00:23 +00:00
hugoreleaser
b1d808bc37 releaser: Bump versions for release of 0.125.7
[ci skip]
2024-05-08 14:46:24 +00:00
Bjørn Erik Pedersen
3c6260f046 deps: Downgrade github.com/getkin/kin-openapi v0.124.0 => v0.123.0
We have received reports from users of Hugo's `openapi3.Unmarshal` about breaking behavior in the mentioned `kin-openapi` version, so revert for now, pending further investigation.
2024-05-08 16:42:48 +02:00
Bjørn Erik Pedersen
70c13f444e
readme: Update Sponsors 2024-05-08 11:37:56 +02:00
hugoreleaser
c46d603a02 releaser: Prepare repository for 0.126.0-DEV
[ci skip]
2024-05-05 11:05:28 +00:00
hugoreleaser
69ede10edc releaser: Bump versions for release of 0.125.6
[ci skip]
2024-05-05 10:52:52 +00: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
dependabot[bot]
68e95327f7 build(deps): bump github.com/pelletier/go-toml/v2 from 2.2.1 to 2.2.2
Bumps [github.com/pelletier/go-toml/v2](https://github.com/pelletier/go-toml) from 2.2.1 to 2.2.2.
- [Release notes](https://github.com/pelletier/go-toml/releases)
- [Changelog](https://github.com/pelletier/go-toml/blob/v2/.goreleaser.yaml)
- [Commits](https://github.com/pelletier/go-toml/compare/v2.2.1...v2.2.2)

---
updated-dependencies:
- dependency-name: github.com/pelletier/go-toml/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-02 11:29:07 +02:00
Bjørn Erik Pedersen
9cd7db61d3
Run mage generate 2024-05-02 10:49:09 +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
hugoreleaser
4255d13d3e releaser: Prepare repository for 0.126.0-DEV
[ci skip]
2024-05-01 15:36:00 +00:00
hugoreleaser
c8b9f9f81c releaser: Bump versions for release of 0.125.5
[ci skip]
2024-05-01 15:22:11 +00: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
hugoreleaser
1961327536 releaser: Prepare repository for 0.126.0-DEV
[ci skip]
2024-04-25 13:40:37 +00:00
hugoreleaser
cc3574ef4f releaser: Bump versions for release of 0.125.4
[ci skip]
2024-04-25 13:27:26 +00:00
Peter van Dijk
fe84cc218e
commands: Clarify that create or install a theme are two options 2024-04-25 14:38:22 +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
dependabot[bot]
fb084390cd build(deps): bump github.com/tdewolff/minify/v2 from 2.20.19 to 2.20.20
Bumps [github.com/tdewolff/minify/v2](https://github.com/tdewolff/minify) from 2.20.19 to 2.20.20.
- [Release notes](https://github.com/tdewolff/minify/releases)
- [Commits](https://github.com/tdewolff/minify/compare/v2.20.19...v2.20.20)

---
updated-dependencies:
- dependency-name: github.com/tdewolff/minify/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-25 11:44:14 +02:00
Joe Mooring
fb51b698b3 tpl/tplimpl: Fix double-escaping in opengraph template
Closes #12418
2024-04-25 10:03:17 +02:00
Bjørn Erik Pedersen
6b867972ec Use Apache License without modification
Closes #12415
2024-04-23 09:15:29 +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
2d75f539e1
Delete .hugo_build.lock
Added to Git by accident.
2024-04-22 16:57:48 +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
Joe Mooring
10a8448eee tpl/tplimpl: Improve embedded templates
- Do not call the YouTube oEmbed API
- Do not include the Hugo version in RSS feeds

Closes #12396
2024-04-22 15:57:37 +02:00
Eric Anderson
722c486a34 SECURITY.md: Update link to security model
The security model was moved in https://github.com/gohugoio/hugoDocs/pull/2495
2024-04-22 13:04:53 +02:00
Bjørn Erik Pedersen
f40f50ead0 modules: Fix potential infinite loop in module collection
Fixes #12407
2024-04-22 11:34:11 +02:00
hugoreleaser
4e483f5d4a releaser: Bump versions for release of 0.125.2
[ci skip]
2024-04-20 15:29:44 +00: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
Joe Mooring
da6112fc65 commands: Add gen chromastyles --lineNumbersTableStyle flag
For symmetry, also rename --linesStyle to --lineNumbersInlineStyle.

Closes #12393
2024-04-20 12:25:28 +02:00
Bjørn Erik Pedersen
faf9fedc3d
resources/images: Fix TestColorLuminance on s390x 2024-04-19 11:21:50 +02:00
Joe Mooring
11aa893198
commands: Provide examples for chromastyles flags
Closes #12387
2024-04-18 12:16:36 -07:00
hugoreleaser
d88cb5269a releaser: Prepare repository for 0.126.0-DEV
[ci skip]
2024-04-18 08:34:20 +00:00
2372 changed files with 72346 additions and 47667 deletions

View file

@ -4,7 +4,7 @@ parameters:
defaults: &defaults
resource_class: large
docker:
- image: bepsays/ci-hugoreleaser:1.22200.20201
- image: bepsays/ci-hugoreleaser:1.22400.20000
environment: &buildenv
GOMODCACHE: /root/project/gomodcache
version: 2
@ -14,9 +14,7 @@ jobs:
environment: &buildenv
GOMODCACHE: /root/project/gomodcache
steps:
- &remote-docker
setup_remote_docker:
version: 20.10.14
- setup_remote_docker
- checkout:
path: hugo
- &git-config
@ -60,7 +58,7 @@ jobs:
environment:
<<: [*buildenv]
docker:
- image: bepsays/ci-hugoreleaser-linux-arm64:1.22200.20201
- image: bepsays/ci-hugoreleaser-linux-arm64:1.22400.20000
steps:
- *restore-cache
- &attach-workspace

49
.github/workflows/image.yml vendored Normal file
View file

@ -0,0 +1,49 @@
name: Build Docker image
on:
release:
types: [published]
pull_request:
permissions:
packages: write
env:
REGISTRY_IMAGE: ghcr.io/gohugoio/hugo
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Docker meta
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.REGISTRY_IMAGE }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
- name: Login to GHCR
# Login is only needed when the image is pushed
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
id: build
uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 # v6.6.1
with:
context: .
provenance: mode=max
sbom: true
push: ${{ github.event_name != 'pull_request' }}
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: HUGO_BUILD_TAGS=extended,withdeploy

View file

@ -12,7 +12,7 @@ jobs:
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@08e671be8ac8944d0e132aa71d0ae8ccfb347675
- uses: dessant/lock-threads@7de207be1d3ce97a9abe6ff1306222982d1ca9f9 # v5.0.1
with:
issue-inactive-days: 21
add-issue-labels: 'Outdated'
@ -24,7 +24,7 @@ jobs:
This pull request has been automatically locked since there
has not been any recent activity after it was closed.
Please open a new issue for related bugs.
- uses: actions/stale@04a1828bc18ada028d85a0252a47cd2963a91abe
- uses: actions/stale@28ca1036281a5e5922ead5184a1bbf96e5fc984e # v9.0.0
with:
operations-per-run: 999
days-before-issue-stale: 365

View file

@ -1,86 +0,0 @@
on:
push:
branches: [master]
pull_request:
name: TestDartSassV1
env:
GOPROXY: https://proxy.golang.org
GO111MODULE: on
DART_SASS_VERSION: 1.62.1
DART_SASS_SHA_LINUX: 3574da75a7322a539034648b8ff84ff2cca162eb924d72b663d718cd3936f075
permissions:
contents: read
jobs:
test:
strategy:
matrix:
go-version: [1.22.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- if: matrix.os == 'ubuntu-latest'
name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Install Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version: ${{ matrix.go-version }}
check-latest: true
cache: true
cache-dependency-path: |
**/go.sum
**/go.mod
- name: Install Ruby
uses: ruby/setup-ruby@5f19ec79cedfadb78ab837f95b87734d0003c899
with:
ruby-version: "2.7"
bundler-cache: true #
- name: Install Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
with:
python-version: "3.x"
- name: Install Mage
run: go install github.com/magefile/mage@v1.15.0
- name: Install asciidoctor
uses: reitzig/actions-asciidoctor@03fcc74cd74880b697950c4930c9ec8a67c69ecc
- name: Install docutils
run: |
pip install docutils
rst2html --version
- if: matrix.os == 'ubuntu-latest'
name: Install pandoc on Linux
run: |
sudo apt-get update -y
sudo apt-get install -y pandoc
- if: matrix.os == 'macos-latest'
run: |
brew install pandoc
- if: matrix.os == 'windows-latest'
run: |
Choco-Install -PackageName pandoc
- run: pandoc -v
- name: Install dart-sass-embedded Linux
run: |
echo "Install Dart Sass version ${DART_SASS_VERSION} ..."
curl -LJO "https://github.com/sass/dart-sass-embedded/releases/download/${DART_SASS_VERSION}/sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz";
echo "${DART_SASS_SHA_LINUX} sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz" | sha256sum -c;
tar -xvf "sass_embedded-${DART_SASS_VERSION}-linux-x64.tar.gz";
echo "$GITHUB_WORKSPACE/sass_embedded/" >> $GITHUB_PATH
- name: Check
run: |
dart-sass-embedded --version
mage -v check;
env:
HUGO_BUILD_TAGS: extended

View file

@ -6,23 +6,23 @@ name: Test
env:
GOPROXY: https://proxy.golang.org
GO111MODULE: on
SASS_VERSION: 1.63.2
DART_SASS_SHA_LINUX: 3ea33c95ad5c35fda6e9a0956199eef38a398f496cfb8750e02479d7d1dd42af
DART_SASS_SHA_MACOS: 11c70f259836b250b44a9cb57fed70e030f21f45069b467d371685855f1eb4f0
DART_SASS_SHA_WINDOWS: cd8cd36a619dd8e27f93d3186c52d70eb7d69472aa6c85f5094b29693e773f64
SASS_VERSION: 1.80.3
DART_SASS_SHA_LINUX: 7c933edbad0a7d389192c5b79393485c088bd2c4398e32f5754c32af006a9ffd
DART_SASS_SHA_MACOS: 79e060b0e131c3bb3c16926bafc371dc33feab122bfa8c01aa337a072097967b
DART_SASS_SHA_WINDOWS: 0bc4708b37cd1bac4740e83ac5e3176e66b774f77fd5dd364da5b5cfc9bfb469
permissions:
contents: read
jobs:
test:
strategy:
matrix:
go-version: [1.21.x, 1.22.x]
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [1.23.x, 1.24.x]
os: [ubuntu-latest, windows-latest] # macos disabled for now because of disk space issues.
runs-on: ${{ matrix.os }}
steps:
- if: matrix.os == 'ubuntu-latest'
name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
@ -34,9 +34,9 @@ jobs:
docker-images: true
swap-storage: true
- name: Checkout code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Install Go
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
go-version: ${{ matrix.go-version }}
check-latest: true
@ -45,18 +45,18 @@ jobs:
**/go.sum
**/go.mod
- name: Install Ruby
uses: ruby/setup-ruby@5f19ec79cedfadb78ab837f95b87734d0003c899
uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
with:
ruby-version: "2.7"
bundler-cache: true #
- name: Install Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d
uses: actions/setup-python@39cd14951b08e74b54015e9e001cdefcf80e669f # v5.1.1
with:
python-version: "3.x"
- name: Install Mage
run: go install github.com/magefile/mage@v1.15.0
- name: Install asciidoctor
uses: reitzig/actions-asciidoctor@03fcc74cd74880b697950c4930c9ec8a67c69ecc
uses: reitzig/actions-asciidoctor@c642db5eedd1d729bb8c92034770d0b2f769eda6 # v2.0.2
- name: Install docutils
run: |
pip install docutils
@ -112,17 +112,17 @@ jobs:
sass --version;
mage -v check;
env:
HUGO_BUILD_TAGS: extended
HUGO_BUILD_TAGS: extended,withdeploy
- if: matrix.os == 'windows-latest'
# See issue #11052. We limit the build to regular test (no -race flag) on Windows for now.
name: Test
run: |
mage -v test;
env:
HUGO_BUILD_TAGS: extended
HUGO_BUILD_TAGS: extended,withdeploy
- name: Build tags
run: |
go install -tags extended,nodeploy
go install -tags extended
- if: matrix.os == 'ubuntu-latest'
name: Build for dragonfly
run: |

5
.gitignore vendored
View file

@ -1,3 +1,6 @@
*.test
imports.*
imports.*
dist/
public/
.DS_Store

View file

@ -1,4 +1,4 @@
>**Note:** We would apprecitate if you hold on with any big refactorings (like renaming deprecated Go packages), mainly because of potential for extra merge work for future coming in in the near future.
>**Note:** We would appreciate if you hold on with any big refactoring (like renaming deprecated Go packages), mainly because of potential for extra merge work for future coming in in the near future.
# Contributing to Hugo
@ -93,6 +93,7 @@ Most title/subjects should have a lower-cased prefix with a colon and one whites
* If this commit touches many packages without a common functional topic, prefix with `all:` (e.g. `all: Reformat Go code`)
* If this is a documentation update, prefix with `docs:`.
* If nothing of the above applies, just leave the prefix out.
* Note that the above excludes nouns seen in other repositories, e.g. "chore:".
Also, if your commit references one or more GitHub issues, always end your commit message body with *See #1234* or *Fixes #1234*.
Replace *1234* with the GitHub issue ID. The last example will close the issue when the commit is merged into *master*.

View file

@ -2,44 +2,98 @@
# Twitter: https://twitter.com/gohugoio
# Website: https://gohugo.io/
FROM golang:1.21-alpine AS build
ARG GO_VERSION="1.24"
ARG ALPINE_VERSION="3.22"
ARG DART_SASS_VERSION="1.79.3"
# Optionally set HUGO_BUILD_TAGS to "extended" or "nodeploy" when building like so:
# docker build --build-arg HUGO_BUILD_TAGS=extended .
ARG HUGO_BUILD_TAGS
FROM --platform=$BUILDPLATFORM tonistiigi/xx:1.5.0 AS xx
FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS gobuild
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS gorun
ARG CGO=1
ENV CGO_ENABLED=${CGO}
ENV GOOS=linux
ENV GO111MODULE=on
FROM gobuild AS build
RUN apk add clang lld
# Set up cross-compilation helpers
COPY --from=xx / /
ARG TARGETPLATFORM
RUN xx-apk add musl-dev gcc g++
# Optionally set HUGO_BUILD_TAGS to "none" or "withdeploy" when building like so:
# docker build --build-arg HUGO_BUILD_TAGS=withdeploy .
#
# We build the extended version by default.
ARG HUGO_BUILD_TAGS="extended"
ENV CGO_ENABLED=1
ENV GOPROXY=https://proxy.golang.org
ENV GOCACHE=/root/.cache/go-build
ENV GOMODCACHE=/go/pkg/mod
ARG TARGETPLATFORM
WORKDIR /go/src/github.com/gohugoio/hugo
COPY . /go/src/github.com/gohugoio/hugo/
# For --mount=type=cache the value of target is the default cache id, so
# for the go mod cache it would be good if we could share it with other Go images using the same setup,
# but the go build cache needs to be per platform.
# See this comment: https://github.com/moby/buildkit/issues/1706#issuecomment-702238282
RUN --mount=target=. \
--mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build,id=go-build-$TARGETPLATFORM <<EOT
set -ex
xx-go build -tags "$HUGO_BUILD_TAGS" -ldflags "-s -w -X github.com/gohugoio/hugo/common/hugo.vendorInfo=docker" -o /usr/bin/hugo
xx-verify /usr/bin/hugo
EOT
# gcc/g++ are required to build SASS libraries for extended version
RUN apk update && \
apk add --no-cache gcc g++ musl-dev git && \
go install github.com/magefile/mage
# dart-sass downloads the dart-sass runtime dependency
FROM alpine:${ALPINE_VERSION} AS dart-sass
ARG TARGETARCH
ARG DART_SASS_VERSION
ARG DART_ARCH=${TARGETARCH/amd64/x64}
WORKDIR /out
ADD https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-${DART_ARCH}.tar.gz .
RUN tar -xf dart-sass-${DART_SASS_VERSION}-linux-${DART_ARCH}.tar.gz
RUN mage hugo && mage install
FROM gorun AS final
# ---
COPY --from=build /usr/bin/hugo /usr/bin/hugo
FROM alpine:3.18
# libc6-compat are required for extended libraries (libsass, libwebp).
RUN apk add --no-cache \
libc6-compat \
git \
runuser \
nodejs \
npm
COPY --from=build /go/bin/hugo /usr/bin/hugo
RUN mkdir -p /var/hugo/bin /cache && \
addgroup -Sg 1000 hugo && \
adduser -Sg hugo -u 1000 -h /var/hugo hugo && \
chown -R hugo: /var/hugo /cache && \
# For the Hugo's Git integration to work.
runuser -u hugo -- git config --global --add safe.directory /project && \
# See https://github.com/gohugoio/hugo/issues/9810
runuser -u hugo -- git config --global core.quotepath false
# libc6-compat & libstdc++ are required for extended SASS libraries
# ca-certificates are required to fetch outside resources (like Twitter oEmbeds)
RUN apk update && \
apk add --no-cache ca-certificates libc6-compat libstdc++ git
USER hugo:hugo
VOLUME /project
WORKDIR /project
ENV HUGO_CACHEDIR=/cache
ENV PATH="/var/hugo/bin:$PATH"
VOLUME /site
WORKDIR /site
COPY scripts/docker/entrypoint.sh /entrypoint.sh
COPY --from=dart-sass /out/dart-sass /var/hugo/bin/dart-sass
# Update PATH to reflect the new dependencies.
# For more complex setups, we should probably find a way to
# delegate this to the script itself, but this will have to do for now.
# Also, the dart-sass binary is a little special, other binaries can be put/linked
# directly in /var/hugo/bin.
ENV PATH="/var/hugo/bin/dart-sass:$PATH"
# Expose port for live server
EXPOSE 1313
ENTRYPOINT ["hugo"]
ENTRYPOINT ["/entrypoint.sh"]
CMD ["--help"]

View file

@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2022 The Hugo Authors.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.

238
README.md
View file

@ -5,6 +5,7 @@
[documentation repository]: https://github.com/gohugoio/hugoDocs
[documentation]: https://gohugo.io/documentation
[dragonfly bsd, freebsd, netbsd, and openbsd]: https://gohugo.io/installation/bsd
[features]: https://gohugo.io/about/features/
[forum]: https://discourse.gohugo.io
[friends]: https://github.com/gohugoio/hugo/graphs/contributors
[go]: https://go.dev/
@ -19,7 +20,6 @@
[static site generator]: https://en.wikipedia.org/wiki/Static_site_generator
[support]: https://discourse.gohugo.io
[themes]: https://themes.gohugo.io/
[twitter]: https://twitter.com/gohugoio
[website]: https://gohugo.io
[windows]: https://gohugo.io/installation/windows
@ -52,19 +52,42 @@ Use Hugo's embedded web server during development to instantly see changes to co
Hugo's fast asset pipelines include:
- CSS bundling &ndash; transpilation (Sass), tree shaking, minification, source maps, SRI hashing, and PostCSS integration
- JavaScript bundling &ndash; transpilation (TypeScript, JSX), tree shaking, minification, source maps, and SRI hashing
- Image processing &ndash; convert, resize, crop, rotate, adjust colors, apply filters, overlay text and images, and extract EXIF data
- Image processing &ndash; Convert, resize, crop, rotate, adjust colors, apply filters, overlay text and images, and extract EXIF data
- JavaScript bundling &ndash; Transpile TypeScript and JSX to JavaScript, bundle, tree shake, minify, create source maps, and perform SRI hashing.
- Sass processing &ndash; Transpile Sass to CSS, bundle, tree shake, minify, create source maps, perform SRI hashing, and integrate with PostCSS
- Tailwind CSS processing &ndash; Compile Tailwind CSS utility classes into standard CSS, bundle, tree shake, optimize, minify, perform SRI hashing, and integrate with PostCSS
And with [Hugo Modules], you can share content, assets, data, translations, themes, templates, and configuration with other projects via public or private Git repositories.
See the [features] section of the documentation for a comprehensive summary of Hugo's capabilities.
## Sponsors
<p>&nbsp;</p>
<p float="left">
<a href="https://www.linode.com/?utm_campaign=hugosponsor&utm_medium=banner&utm_source=hugogithub" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/gohugoioTheme/master/assets/images/sponsors/linode-logo_standard_light_medium.png" width="200" alt="Linode"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://cloudcannon.com/hugo-cms/?utm_campaign=HugoSponsorship&utm_source=sponsor&utm_content=gohugo" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/gohugoioTheme/master/assets/images/sponsors/cloudcannon-blue.svg" width="220" alt="CloudCannon"></a>
<p>&nbsp;</p>
<a href="https://www.linode.com/?utm_campaign=hugosponsor&utm_medium=banner&utm_source=hugogithub" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/hugoDocs/master/assets/images/sponsors/linode-logo_standard_light_medium.png" width="200" alt="Linode"></a>
&nbsp;&nbsp;&nbsp;
<a href="https://www.jetbrains.com/go/?utm_source=OSS&utm_medium=referral&utm_campaign=hugo" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/hugoDocs/master/assets/images/sponsors/goland.svg" width="200" alt="The complete IDE crafted for professional Go developers."></a>
&nbsp;&nbsp;&nbsp;
<a href="https://pinme.eth.limo/?s=hugo" target="_blank"><img src="https://raw.githubusercontent.com/gohugoio/hugoDocs/master/assets/images/sponsors/logo-pinme.svg" width="200" alt="PinMe."></a>
</p>
## Editions
Hugo is available in three editions: standard, extended, and extended/deploy. While the standard edition provides core functionality, the extended and extended/deploy editions offer advanced features.
Feature|extended edition|extended/deploy edition
:--|:-:|:-:
Encode to the WebP format when [processing images]. You can decode WebP images with any edition.|:heavy_check_mark:|:heavy_check_mark:
[Transpile Sass to CSS] using the embedded LibSass transpiler. You can use the [Dart Sass] transpiler with any edition.|:heavy_check_mark:|:heavy_check_mark:
Deploy your site directly to a Google Cloud Storage bucket, an AWS S3 bucket, or an Azure Storage container. See&nbsp;[details].|:x:|:heavy_check_mark:
[dart sass]: https://gohugo.io/functions/css/sass/#dart-sass
[processing images]: https://gohugo.io/content-management/image-processing/
[transpile sass to css]: https://gohugo.io/functions/css/sass/
[details]: https://gohugo.io/hosting-and-deployment/hugo-deploy/
Unless your specific deployment needs require the extended/deploy edition, we recommend the extended edition.
## Installation
@ -77,15 +100,11 @@ Install Hugo from a [prebuilt binary], package manager, or package repository. P
## Build from source
Hugo is available in two editions: standard and extended. With the extended edition you can:
- Encode to the WebP format when processing images. You can decode WebP images with either edition.
- Transpile Sass to CSS using the embedded LibSass transpiler. The extended edition is not required to use the Dart Sass transpiler.
Prerequisites to build Hugo from source:
- Standard edition: Go 1.20 or later
- Extended edition: Go 1.20 or later, and GCC
- Standard edition: Go 1.23.0 or later
- Extended edition: Go 1.23.0 or later, and GCC
- Extended/deploy edition: Go 1.23.0 or later, and GCC
Build the standard edition:
@ -99,6 +118,16 @@ Build the extended edition:
CGO_ENABLED=1 go install -tags extended github.com/gohugoio/hugo@latest
```
Build the extended/deploy edition:
```text
CGO_ENABLED=1 go install -tags extended,withdeploy github.com/gohugoio/hugo@latest
```
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=gohugoio/hugo&type=Timeline)](https://star-history.com/#gohugoio/hugo&Timeline)
## Documentation
Hugo's [documentation] includes installation instructions, a quick start guide, conceptual explanations, reference information, and examples.
@ -141,152 +170,113 @@ Hugo stands on the shoulders of great open source libraries. Run `hugo env --log
<summary>See current dependencies</summary>
```text
cloud.google.com/go/compute/metadata="v0.2.3"
cloud.google.com/go/iam="v1.1.3"
cloud.google.com/go/storage="v1.31.0"
cloud.google.com/go="v0.110.8"
github.com/Azure/azure-sdk-for-go/sdk/azcore="v1.7.0"
github.com/Azure/azure-sdk-for-go/sdk/azidentity="v1.3.0"
github.com/Azure/azure-sdk-for-go/sdk/internal="v1.3.0"
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob="v1.1.0"
github.com/Azure/go-autorest/autorest/to="v0.4.0"
github.com/AzureAD/microsoft-authentication-library-for-go="v1.0.0"
github.com/BurntSushi/locker="v0.0.0-20171006230638-a6e239ea1c69"
github.com/PuerkitoBio/purell="v1.1.1"
github.com/PuerkitoBio/urlesc="v0.0.0-20170810143723-de5bf2ad4578"
github.com/alecthomas/chroma/v2="v2.11.1"
github.com/armon/go-radix="v1.0.0"
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream="v1.4.11"
github.com/aws/aws-sdk-go-v2/config="v1.18.32"
github.com/aws/aws-sdk-go-v2/credentials="v1.13.31"
github.com/aws/aws-sdk-go-v2/feature/ec2/imds="v1.13.7"
github.com/aws/aws-sdk-go-v2/feature/s3/manager="v1.11.76"
github.com/aws/aws-sdk-go-v2/internal/configsources="v1.1.37"
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2="v2.4.31"
github.com/aws/aws-sdk-go-v2/internal/ini="v1.3.38"
github.com/aws/aws-sdk-go-v2/internal/v4a="v1.1.0"
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding="v1.9.12"
github.com/aws/aws-sdk-go-v2/service/internal/checksum="v1.1.32"
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url="v1.9.31"
github.com/aws/aws-sdk-go-v2/service/internal/s3shared="v1.15.0"
github.com/aws/aws-sdk-go-v2/service/s3="v1.38.1"
github.com/aws/aws-sdk-go-v2/service/sso="v1.13.1"
github.com/aws/aws-sdk-go-v2/service/ssooidc="v1.15.1"
github.com/aws/aws-sdk-go-v2/service/sts="v1.21.1"
github.com/aws/aws-sdk-go-v2="v1.20.0"
github.com/aws/aws-sdk-go="v1.48.2"
github.com/aws/smithy-go="v1.14.0"
github.com/PuerkitoBio/goquery="v1.10.1"
github.com/alecthomas/chroma/v2="v2.15.0"
github.com/andybalholm/cascadia="v1.3.3"
github.com/armon/go-radix="v1.0.1-0.20221118154546-54df44f2176c"
github.com/bep/clocks="v0.5.0"
github.com/bep/debounce="v1.2.0"
github.com/bep/gitmap="v1.1.2"
github.com/bep/gitmap="v1.6.0"
github.com/bep/goat="v0.5.0"
github.com/bep/godartsass/v2="v2.0.0"
github.com/bep/godartsass="v1.2.0"
github.com/bep/golibsass="v1.1.1"
github.com/bep/godartsass/v2="v2.3.2"
github.com/bep/golibsass="v1.2.0"
github.com/bep/gowebp="v0.3.0"
github.com/bep/lazycache="v0.2.0"
github.com/bep/logg="v0.3.0"
github.com/bep/imagemeta="v0.8.4"
github.com/bep/lazycache="v0.7.0"
github.com/bep/logg="v0.4.0"
github.com/bep/mclib="v1.20400.20402"
github.com/bep/overlayfs="v0.6.0"
github.com/bep/simplecobra="v0.3.2"
github.com/bep/overlayfs="v0.9.2"
github.com/bep/simplecobra="v0.5.0"
github.com/bep/tmc="v0.5.1"
github.com/cespare/xxhash/v2="v2.3.0"
github.com/clbanning/mxj/v2="v2.7.0"
github.com/cli/safeexec="v1.0.1"
github.com/cpuguy83/go-md2man/v2="v2.0.2"
github.com/cpuguy83/go-md2man/v2="v2.0.4"
github.com/disintegration/gift="v1.2.1"
github.com/dlclark/regexp2="v1.10.0"
github.com/dustin/go-humanize="v1.0.1"
github.com/evanw/esbuild="v0.19.7"
github.com/fatih/color="v1.16.0"
github.com/dlclark/regexp2="v1.11.5"
github.com/dop251/goja="v0.0.0-20250125213203-5ef83b82af17"
github.com/evanw/esbuild="v0.24.2"
github.com/fatih/color="v1.18.0"
github.com/frankban/quicktest="v1.14.6"
github.com/fsnotify/fsnotify="v1.7.0"
github.com/getkin/kin-openapi="v0.120.0"
github.com/fsnotify/fsnotify="v1.8.0"
github.com/getkin/kin-openapi="v0.129.0"
github.com/ghodss/yaml="v1.0.0"
github.com/go-openapi/jsonpointer="v0.19.6"
github.com/go-openapi/swag="v0.22.4"
github.com/gobuffalo/flect="v1.0.2"
github.com/go-openapi/jsonpointer="v0.21.0"
github.com/go-openapi/swag="v0.23.0"
github.com/go-sourcemap/sourcemap="v2.1.4+incompatible"
github.com/gobuffalo/flect="v1.0.3"
github.com/gobwas/glob="v0.2.3"
github.com/gohugoio/go-i18n/v2="v2.1.3-0.20230805085216-e63c13218d0e"
github.com/gohugoio/hashstructure="v0.5.0"
github.com/gohugoio/httpcache="v0.7.0"
github.com/gohugoio/hugo-goldmark-extensions/extras="v0.2.0"
github.com/gohugoio/hugo-goldmark-extensions/passthrough="v0.3.0"
github.com/gohugoio/locales="v0.14.0"
github.com/gohugoio/localescompressed="v1.0.1"
github.com/golang-jwt/jwt/v4="v4.5.0"
github.com/golang/groupcache="v0.0.0-20210331224755-41bb18bfe9da"
github.com/golang/protobuf="v1.5.3"
github.com/golang/freetype="v0.0.0-20170609003504-e2365dfdc4a0"
github.com/google/go-cmp="v0.6.0"
github.com/google/s2a-go="v0.1.7"
github.com/google/uuid="v1.4.0"
github.com/google/wire="v0.5.0"
github.com/googleapis/enterprise-certificate-proxy="v0.3.2"
github.com/googleapis/gax-go/v2="v2.12.0"
github.com/gorilla/websocket="v1.5.1"
github.com/hairyhenderson/go-codeowners="v0.4.0"
github.com/hashicorp/golang-lru/v2="v2.0.1"
github.com/invopop/yaml="v0.2.0"
github.com/google/pprof="v0.0.0-20250208200701-d0013a598941"
github.com/gorilla/websocket="v1.5.3"
github.com/hairyhenderson/go-codeowners="v0.7.0"
github.com/hashicorp/golang-lru/v2="v2.0.7"
github.com/jdkato/prose="v1.2.1"
github.com/jmespath/go-jmespath="v0.4.0"
github.com/josharian/intern="v1.0.0"
github.com/kr/pretty="v0.3.1"
github.com/kr/text="v0.2.0"
github.com/kylelemons/godebug="v1.1.0"
github.com/kyokomi/emoji/v2="v2.2.12"
github.com/kyokomi/emoji/v2="v2.2.13"
github.com/lucasb-eyer/go-colorful="v1.2.0"
github.com/mailru/easyjson="v0.7.7"
github.com/makeworld-the-better-one/dither/v2="v2.4.0"
github.com/marekm4/color-extractor="v1.2.1"
github.com/mattn/go-colorable="v0.1.13"
github.com/mattn/go-isatty="v0.0.20"
github.com/mattn/go-runewidth="v0.0.9"
github.com/mitchellh/hashstructure="v1.1.0"
github.com/mitchellh/mapstructure="v1.5.0"
github.com/mazznoer/csscolorparser="v0.1.5"
github.com/mitchellh/mapstructure="v1.5.1-0.20231216201459-8508981c8b6c"
github.com/mohae/deepcopy="v0.0.0-20170929034955-c48cc78d4826"
github.com/muesli/smartcrop="v0.3.0"
github.com/niklasfasching/go-org="v1.7.0"
github.com/oasdiff/yaml3="v0.0.0-20241210130736-a94c01f36349"
github.com/oasdiff/yaml="v0.0.0-20241210131133-6b86fb107d80"
github.com/olekukonko/tablewriter="v0.0.5"
github.com/pelletier/go-toml/v2="v2.1.0"
github.com/pbnjay/memory="v0.0.0-20210728143218-7b4eea64cf58"
github.com/pelletier/go-toml/v2="v2.2.3"
github.com/perimeterx/marshmallow="v1.1.5"
github.com/pkg/browser="v0.0.0-20210911075715-681adbf594b8"
github.com/pkg/browser="v0.0.0-20240102092130-5ac0b6a4141c"
github.com/pkg/errors="v0.9.1"
github.com/rogpeppe/go-internal="v1.11.0"
github.com/rivo/uniseg="v0.4.7"
github.com/rogpeppe/go-internal="v1.13.1"
github.com/russross/blackfriday/v2="v2.1.0"
github.com/rwcarlsen/goexif="v0.0.0-20190401172101-9e8deecbddbd"
github.com/sanity-io/litter="v1.5.5"
github.com/sass/dart-sass/compiler="1.63.2"
github.com/sass/dart-sass/implementation="1.63.2"
github.com/sass/dart-sass/protocol="2.0.0"
github.com/sass/libsass="3.6.5"
github.com/spf13/afero="v1.10.0"
github.com/spf13/cast="v1.5.1"
github.com/spf13/cobra="v1.7.0"
github.com/spf13/fsync="v0.9.0"
github.com/spf13/pflag="v1.0.5"
github.com/tdewolff/minify/v2="v2.20.7"
github.com/tdewolff/parse/v2="v2.7.5"
github.com/sass/libsass="3.6.6"
github.com/spf13/afero="v1.11.0"
github.com/spf13/cast="v1.7.1"
github.com/spf13/cobra="v1.8.1"
github.com/spf13/fsync="v0.10.1"
github.com/spf13/pflag="v1.0.6"
github.com/tdewolff/minify/v2="v2.20.37"
github.com/tdewolff/parse/v2="v2.7.15"
github.com/tetratelabs/wazero="v1.8.2"
github.com/webmproject/libwebp="v1.3.2"
github.com/yuin/goldmark-emoji="v1.0.2"
github.com/yuin/goldmark="v1.6.0"
go.opencensus.io="v0.24.0"
go.uber.org/atomic="v1.11.0"
github.com/yuin/goldmark-emoji="v1.0.4"
github.com/yuin/goldmark="v1.7.8"
go.uber.org/automaxprocs="v1.5.3"
gocloud.dev="v0.34.0"
golang.org/x/crypto="v0.15.0"
golang.org/x/exp="v0.0.0-20221031165847-c99f073a8326"
golang.org/x/image="v0.13.0"
golang.org/x/mod="v0.14.0"
golang.org/x/net="v0.18.0"
golang.org/x/oauth2="v0.13.0"
golang.org/x/sync="v0.5.0"
golang.org/x/sys="v0.14.0"
golang.org/x/text="v0.14.0"
golang.org/x/time="v0.3.0"
golang.org/x/tools="v0.15.0"
golang.org/x/xerrors="v0.0.0-20220907171357-04be3eba64a2"
google.golang.org/api="v0.151.0"
google.golang.org/genproto/googleapis/api="v0.0.0-20231016165738-49dd2c1f3d0b"
google.golang.org/genproto/googleapis/rpc="v0.0.0-20231030173426-d783a09b4405"
google.golang.org/genproto="v0.0.0-20231016165738-49dd2c1f3d0b"
google.golang.org/grpc="v1.59.0"
google.golang.org/protobuf="v1.31.0"
golang.org/x/crypto="v0.33.0"
golang.org/x/exp="v0.0.0-20250210185358-939b2ce775ac"
golang.org/x/image="v0.24.0"
golang.org/x/mod="v0.23.0"
golang.org/x/net="v0.35.0"
golang.org/x/sync="v0.11.0"
golang.org/x/sys="v0.30.0"
golang.org/x/text="v0.22.0"
golang.org/x/tools="v0.30.0"
golang.org/x/xerrors="v0.0.0-20240903120638-7835f813f4da"
gonum.org/v1/plot="v0.15.0"
google.golang.org/protobuf="v1.36.5"
gopkg.in/yaml.v2="v2.4.0"
gopkg.in/yaml.v3="v3.0.1"
howett.net/plist="v1.0.0"
oss.terrastruct.com/d2="v0.6.9"
oss.terrastruct.com/util-go="v0.0.0-20241005222610-44c011a04896"
rsc.io/qr="v0.2.0"
software.sslmate.com/src/go-pkcs12="v0.2.0"
```
</details>

View file

@ -4,4 +4,4 @@
Please report (suspected) security vulnerabilities to **[bjorn.erik.pedersen@gmail.com](mailto:bjorn.erik.pedersen@gmail.com)**. You will receive a response from us within 48 hours. If we can confirm the issue, we will release a patch as soon as possible depending on the complexity of the issue but historically within days.
Also see [Hugo's Security Model](https://gohugo.io/about/security-model/).
Also see [Hugo's Security Model](https://gohugo.io/about/security/).

View file

@ -1,37 +0,0 @@
#!/usr/bin/env bash
# allow user to override go executable by running as GOEXE=xxx make ...
GOEXE="${GOEXE-go}"
# Convenience script to
# - For a given branch
# - Run benchmark tests for a given package
# - Do the same for master
# - then compare the two runs with benchcmp
benchFilter=".*"
if (( $# < 2 ));
then
echo "USAGE: ./bench.sh <git-branch> <package-to-bench> (and <benchmark filter> (regexp, optional))"
exit 1
fi
if [ $# -eq 3 ]; then
benchFilter=$3
fi
BRANCH=$1
PACKAGE=$2
git checkout $BRANCH
"${GOEXE}" test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-$BRANCH.txt
git checkout master
"${GOEXE}" test -test.run=NONE -bench="$benchFilter" -test.benchmem=true ./$PACKAGE > /tmp/bench-$PACKAGE-master.txt
benchcmp /tmp/bench-$PACKAGE-master.txt /tmp/bench-$PACKAGE-$BRANCH.txt

View file

@ -1,12 +0,0 @@
#!/bin/bash
# allow user to override go executable by running as GOEXE=xxx make ...
GOEXE="${GOEXE-go}"
# Send in a regexp matching the benchmarks you want to run, i.e. './benchSite.sh "YAML"'.
# Note the quotes, which will be needed for more complex expressions.
# The above will run all variations, but only for front matter YAML.
echo "Running with BenchmarkSiteBuilding/${1}"
"${GOEXE}" test -run="NONE" -bench="BenchmarkSiteBuilding/${1}" -test.benchmem=true ./hugolib -memprofile mem.prof -count 3 -cpuprofile cpu.prof

View file

@ -1 +0,0 @@
gobench -package=./hugolib -bench="BenchmarkSiteNew/Deep_content_tree"

View file

@ -1 +0,0 @@
docker run --rm --mount type=bind,source="$(pwd)",target=/hugo -w /hugo -i -t bepsays/ci-goreleaser:1.11-2 /bin/bash

View file

@ -38,6 +38,11 @@ import (
const minMaxSize = 10
type KeyIdentity struct {
Key any
Identity identity.Identity
}
// New creates a new cache.
func New(opts Options) *Cache {
if opts.CheckInterval == 0 {
@ -64,14 +69,14 @@ func New(opts Options) *Cache {
infol := opts.Log.InfoCommand("dynacache")
evictedIdentities := collections.NewStack[identity.Identity]()
evictedIdentities := collections.NewStack[KeyIdentity]()
onEvict := func(k, v any) {
if !opts.Running {
if !opts.Watching {
return
}
identity.WalkIdentitiesShallow(v, func(level int, id identity.Identity) bool {
evictedIdentities.Push(id)
evictedIdentities.Push(KeyIdentity{Key: k, Identity: id})
return false
})
resource.MarkStale(v)
@ -97,7 +102,7 @@ type Options struct {
CheckInterval time.Duration
MaxSize int
MinMaxSize int
Running bool
Watching bool
}
// Options for a partition.
@ -124,7 +129,7 @@ type Cache struct {
partitions map[string]PartitionManager
onEvict func(k, v any)
evictedIdentities *collections.Stack[identity.Identity]
evictedIdentities *collections.Stack[KeyIdentity]
opts Options
infol logg.LevelLogger
@ -135,21 +140,35 @@ type Cache struct {
}
// DrainEvictedIdentities drains the evicted identities from the cache.
func (c *Cache) DrainEvictedIdentities() []identity.Identity {
func (c *Cache) DrainEvictedIdentities() []KeyIdentity {
return c.evictedIdentities.Drain()
}
// DrainEvictedIdentitiesMatching drains the evicted identities from the cache that match the given predicate.
func (c *Cache) DrainEvictedIdentitiesMatching(predicate func(KeyIdentity) bool) []KeyIdentity {
return c.evictedIdentities.DrainMatching(predicate)
}
// ClearMatching clears all partition for which the predicate returns true.
func (c *Cache) ClearMatching(predicate func(k, v any) bool) {
func (c *Cache) ClearMatching(predicatePartition func(k string, p PartitionManager) bool, predicateValue func(k, v any) bool) {
if predicatePartition == nil {
predicatePartition = func(k string, p PartitionManager) bool { return true }
}
if predicateValue == nil {
panic("nil predicateValue")
}
g := rungroup.Run[PartitionManager](context.Background(), rungroup.Config[PartitionManager]{
NumWorkers: len(c.partitions),
Handle: func(ctx context.Context, partition PartitionManager) error {
partition.clearMatching(predicate)
partition.clearMatching(predicateValue)
return nil
},
})
for _, p := range c.partitions {
for k, p := range c.partitions {
if !predicatePartition(k, p) {
continue
}
g.Enqueue(p)
}
@ -157,11 +176,12 @@ func (c *Cache) ClearMatching(predicate func(k, v any) bool) {
}
// ClearOnRebuild prepares the cache for a new rebuild taking the given changeset into account.
func (c *Cache) ClearOnRebuild(changeset ...identity.Identity) {
// predicate is optional and will clear any entry for which it returns true.
func (c *Cache) ClearOnRebuild(predicate func(k, v any) bool, changeset ...identity.Identity) {
g := rungroup.Run[PartitionManager](context.Background(), rungroup.Config[PartitionManager]{
NumWorkers: len(c.partitions),
Handle: func(ctx context.Context, partition PartitionManager) error {
partition.clearOnRebuild(changeset...)
partition.clearOnRebuild(predicate, changeset...)
return nil
},
})
@ -356,6 +376,7 @@ func GetOrCreatePartition[K comparable, V any](c *Cache, name string, opts Optio
trace: c.opts.Log.Logger().WithLevel(logg.LevelTrace).WithField("partition", name),
opts: opts,
}
c.partitions[name] = partition
return partition
@ -375,23 +396,60 @@ type Partition[K comparable, V any] struct {
// GetOrCreate gets or creates a value for the given key.
func (p *Partition[K, V]) GetOrCreate(key K, create func(key K) (V, error)) (V, error) {
v, err := p.doGetOrCreate(key, create)
if err != nil {
return p.zero, err
}
if resource.StaleVersion(v) > 0 {
p.c.Delete(key)
return p.doGetOrCreate(key, create)
}
return v, err
}
func (p *Partition[K, V]) doGetOrCreate(key K, create func(key K) (V, error)) (V, error) {
v, _, err := p.c.GetOrCreate(key, create)
return v, err
}
func (p *Partition[K, V]) GetOrCreateWitTimeout(key K, duration time.Duration, create func(key K) (V, error)) (V, error) {
v, err := p.doGetOrCreateWitTimeout(key, duration, create)
if err != nil {
return p.zero, err
}
if resource.StaleVersion(v) > 0 {
p.c.Delete(key)
return p.doGetOrCreateWitTimeout(key, duration, create)
}
return v, err
}
// GetOrCreateWitTimeout gets or creates a value for the given key and times out if the create function
// takes too long.
func (p *Partition[K, V]) GetOrCreateWitTimeout(key K, duration time.Duration, create func(key K) (V, error)) (V, error) {
func (p *Partition[K, V]) doGetOrCreateWitTimeout(key K, duration time.Duration, create func(key K) (V, error)) (V, error) {
resultch := make(chan V, 1)
errch := make(chan error, 1)
go func() {
v, _, err := p.c.GetOrCreate(key, create)
if err != nil {
errch <- err
return
}
resultch <- v
var (
v V
err error
)
defer func() {
if r := recover(); r != nil {
if rerr, ok := r.(error); ok {
err = rerr
} else {
err = fmt.Errorf("panic: %v", r)
}
}
if err != nil {
errch <- err
} else {
resultch <- v
}
}()
v, _, err = p.c.GetOrCreate(key, create)
}()
select {
@ -422,7 +480,12 @@ func (p *Partition[K, V]) clearMatching(predicate func(k, v any) bool) {
})
}
func (p *Partition[K, V]) clearOnRebuild(changeset ...identity.Identity) {
func (p *Partition[K, V]) clearOnRebuild(predicate func(k, v any) bool, changeset ...identity.Identity) {
if predicate == nil {
predicate = func(k, v any) bool {
return false
}
}
opts := p.getOptions()
if opts.ClearWhen == ClearNever {
return
@ -438,7 +501,7 @@ func (p *Partition[K, V]) clearOnRebuild(changeset ...identity.Identity) {
shouldDelete := func(key K, v V) bool {
// We always clear elements marked as stale.
if resource.IsStaleAny(v) {
if resource.StaleVersion(v) > 0 {
return true
}
@ -468,7 +531,7 @@ func (p *Partition[K, V]) clearOnRebuild(changeset ...identity.Identity) {
// Second pass needs to be done in a separate loop to catch any
// elements marked as stale in the other partitions.
p.c.DeleteFunc(func(key K, v V) bool {
if shouldDelete(key, v) {
if predicate(key, v) || shouldDelete(key, v) {
p.trace.Log(
logg.StringFunc(
func() string {
@ -493,8 +556,8 @@ func (p *Partition[K, V]) Keys() []K {
func (p *Partition[K, V]) clearStale() {
p.c.DeleteFunc(func(key K, v V) bool {
isStale := resource.IsStaleAny(v)
if isStale {
staleVersion := resource.StaleVersion(v)
if staleVersion > 0 {
p.trace.Log(
logg.StringFunc(
func() string {
@ -504,7 +567,7 @@ func (p *Partition[K, V]) clearStale() {
)
}
return isStale
return staleVersion > 0
})
}
@ -544,7 +607,7 @@ type PartitionManager interface {
adjustMaxSize(addend int) int
getMaxSize() int
getOptions() OptionsPartition
clearOnRebuild(changeset ...identity.Identity)
clearOnRebuild(predicate func(k, v any) bool, changeset ...identity.Identity)
clearMatching(predicate func(k, v any) bool)
clearStale()
}

View file

@ -14,8 +14,11 @@
package dynacache
import (
"errors"
"fmt"
"path/filepath"
"testing"
"time"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/common/loggers"
@ -29,12 +32,12 @@ var (
)
type testItem struct {
name string
isStale bool
name string
staleVersion uint32
}
func (t testItem) IsStale() bool {
return t.isStale
func (t testItem) StaleVersion() uint32 {
return t.staleVersion
}
func (t testItem) IdentifierBase() string {
@ -109,7 +112,7 @@ func newTestCache(t *testing.T) *Cache {
p2.GetOrCreate("clearBecauseStale", func(string) (testItem, error) {
return testItem{
isStale: true,
staleVersion: 32,
}, nil
})
@ -121,7 +124,7 @@ func newTestCache(t *testing.T) *Cache {
p2.GetOrCreate("clearNever", func(string) (testItem, error) {
return testItem{
isStale: false,
staleVersion: 0,
}, nil
})
@ -144,19 +147,19 @@ func TestClear(t *testing.T) {
c.Assert(cache.Keys(predicateAll), qt.HasLen, 4)
cache.ClearOnRebuild()
cache.ClearOnRebuild(nil)
// Stale items are always cleared.
c.Assert(cache.Keys(predicateAll), qt.HasLen, 2)
cache = newTestCache(t)
cache.ClearOnRebuild(identity.StringIdentity("changed"))
cache.ClearOnRebuild(nil, identity.StringIdentity("changed"))
c.Assert(cache.Keys(nil), qt.HasLen, 1)
cache = newTestCache(t)
cache.ClearMatching(func(k, v any) bool {
cache.ClearMatching(nil, func(k, v any) bool {
return k.(string) == "clearOnRebuild"
})
@ -165,6 +168,58 @@ func TestClear(t *testing.T) {
cache.adjustCurrentMaxSize()
}
func TestPanicInCreate(t *testing.T) {
t.Parallel()
c := qt.New(t)
cache := newTestCache(t)
p1 := GetOrCreatePartition[string, testItem](cache, "/aaaa/bbbb", OptionsPartition{Weight: 30, ClearWhen: ClearOnRebuild})
willPanic := func(i int) func() {
return func() {
p1.GetOrCreate(fmt.Sprintf("panic-%d", i), func(key string) (testItem, error) {
panic(errors.New(key))
})
}
}
// GetOrCreateWitTimeout needs to recover from panics in the create func.
willErr := func(i int) error {
_, err := p1.GetOrCreateWitTimeout(fmt.Sprintf("error-%d", i), 10*time.Second, func(key string) (testItem, error) {
return testItem{}, errors.New(key)
})
return err
}
for i := range 3 {
for range 3 {
c.Assert(willPanic(i), qt.PanicMatches, fmt.Sprintf("panic-%d", i))
c.Assert(willErr(i), qt.ErrorMatches, fmt.Sprintf("error-%d", i))
}
}
// Test the same keys again without the panic.
for i := range 3 {
for range 3 {
v, err := p1.GetOrCreate(fmt.Sprintf("panic-%d", i), func(key string) (testItem, error) {
return testItem{
name: key,
}, nil
})
c.Assert(err, qt.IsNil)
c.Assert(v.name, qt.Equals, fmt.Sprintf("panic-%d", i))
v, err = p1.GetOrCreateWitTimeout(fmt.Sprintf("error-%d", i), 10*time.Second, func(key string) (testItem, error) {
return testItem{
name: key,
}, nil
})
c.Assert(err, qt.IsNil)
c.Assert(v.name, qt.Equals, fmt.Sprintf("error-%d", i))
}
}
}
func TestAdjustCurrentMaxSize(t *testing.T) {
t.Parallel()
c := qt.New(t)

View file

@ -1,4 +1,4 @@
// Copyright 2018 The Hugo Authors. All rights reserved.
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -23,6 +23,7 @@ import (
"sync"
"time"
"github.com/gohugoio/httpcache"
"github.com/gohugoio/hugo/common/hugio"
"github.com/gohugoio/hugo/hugofs"
@ -182,6 +183,15 @@ func (c *Cache) ReadOrCreate(id string,
return
}
// NamedLock locks the given id. The lock is released when the returned function is called.
func (c *Cache) NamedLock(id string) func() {
id = cleanID(id)
c.nlocker.Lock(id)
return func() {
c.nlocker.Unlock(id)
}
}
// GetOrCreate tries to get the file with the given id from cache. If not found or expired, create will
// be invoked and the result cached.
// This method is protected by a named lock using the given id as identifier.
@ -218,7 +228,23 @@ func (c *Cache) GetOrCreate(id string, create func() (io.ReadCloser, error)) (It
var buff bytes.Buffer
return info,
hugio.ToReadCloser(&buff),
afero.WriteReader(c.Fs, id, io.TeeReader(r, &buff))
c.writeReader(id, io.TeeReader(r, &buff))
}
func (c *Cache) writeReader(id string, r io.Reader) error {
dir := filepath.Dir(id)
if dir != "" {
_ = c.Fs.MkdirAll(dir, 0o777)
}
f, err := c.Fs.Create(id)
if err != nil {
return err
}
defer f.Close()
_, _ = io.Copy(f, r)
return nil
}
// GetOrCreateBytes is the same as GetOrCreate, but produces a byte slice.
@ -253,9 +279,10 @@ func (c *Cache) GetOrCreateBytes(id string, create func() ([]byte, error)) (Item
return info, b, nil
}
if err := afero.WriteReader(c.Fs, id, bytes.NewReader(b)); err != nil {
if err := c.writeReader(id, bytes.NewReader(b)); err != nil {
return info, nil, err
}
return info, b, nil
}
@ -305,16 +332,8 @@ func (c *Cache) getOrRemove(id string) hugio.ReadSeekCloser {
return nil
}
if c.maxAge > 0 {
fi, err := c.Fs.Stat(id)
if err != nil {
return nil
}
if c.isExpired(fi.ModTime()) {
c.Fs.Remove(id)
return nil
}
if removed, err := c.removeIfExpired(id); err != nil || removed {
return nil
}
f, err := c.Fs.Open(id)
@ -325,6 +344,49 @@ func (c *Cache) getOrRemove(id string) hugio.ReadSeekCloser {
return f
}
func (c *Cache) getBytesAndRemoveIfExpired(id string) ([]byte, bool) {
if c.maxAge == 0 {
// No caching.
return nil, false
}
f, err := c.Fs.Open(id)
if err != nil {
return nil, false
}
defer f.Close()
b, err := io.ReadAll(f)
if err != nil {
return nil, false
}
removed, err := c.removeIfExpired(id)
if err != nil {
return nil, false
}
return b, removed
}
func (c *Cache) removeIfExpired(id string) (bool, error) {
if c.maxAge <= 0 {
return false, nil
}
fi, err := c.Fs.Stat(id)
if err != nil {
return false, err
}
if c.isExpired(fi.ModTime()) {
c.Fs.Remove(id)
return true, nil
}
return false, nil
}
func (c *Cache) isExpired(modTime time.Time) bool {
if c.maxAge < 0 {
return false
@ -398,3 +460,37 @@ func NewCaches(p *helpers.PathSpec) (Caches, error) {
func cleanID(name string) string {
return strings.TrimPrefix(filepath.Clean(name), helpers.FilePathSeparator)
}
// AsHTTPCache returns an httpcache.Cache implementation for this file cache.
// Note that none of the methods are protected by named locks, so you need to make sure
// to do that in your own code.
func (c *Cache) AsHTTPCache() httpcache.Cache {
return &httpCache{c: c}
}
type httpCache struct {
c *Cache
}
func (h *httpCache) Get(id string) (resp []byte, ok bool) {
id = cleanID(id)
b, removed := h.c.getBytesAndRemoveIfExpired(id)
return b, !removed
}
func (h *httpCache) Set(id string, resp []byte) {
if h.c.maxAge == 0 {
return
}
id = cleanID(id)
if err := h.c.writeReader(id, bytes.NewReader(resp)); err != nil {
panic(err)
}
}
func (h *httpCache) Delete(key string) {
h.c.Fs.Remove(key)
}

View file

@ -46,6 +46,7 @@ const (
CacheKeyAssets = "assets"
CacheKeyModules = "modules"
CacheKeyGetResource = "getresource"
CacheKeyMisc = "misc"
)
type Configs map[string]FileCacheConfig
@ -70,10 +71,14 @@ var defaultCacheConfigs = Configs{
MaxAge: -1,
Dir: resourcesGenDir,
},
CacheKeyGetResource: FileCacheConfig{
CacheKeyGetResource: {
MaxAge: -1, // Never expire
Dir: cacheDirProject,
},
CacheKeyMisc: {
MaxAge: -1,
Dir: cacheDirProject,
},
}
type FileCacheConfig struct {
@ -120,6 +125,11 @@ func (f Caches) AssetsCache() *Cache {
return f[CacheKeyAssets]
}
// MiscCache gets the file cache for miscellaneous stuff.
func (f Caches) MiscCache() *Cache {
return f[CacheKeyMisc]
}
// GetResourceCache gets the file cache for remote resources.
func (f Caches) GetResourceCache() *Cache {
return f[CacheKeyGetResource]

View file

@ -59,7 +59,7 @@ dir = "/path/to/c4"
c.Assert(err, qt.IsNil)
fs := afero.NewMemMapFs()
decoded := testconfig.GetTestConfigs(fs, cfg).Base.Caches
c.Assert(len(decoded), qt.Equals, 6)
c.Assert(len(decoded), qt.Equals, 7)
c2 := decoded["getcsv"]
c.Assert(c2.MaxAge.String(), qt.Equals, "11h0m0s")
@ -106,7 +106,7 @@ dir = "/path/to/c4"
c.Assert(err, qt.IsNil)
fs := afero.NewMemMapFs()
decoded := testconfig.GetTestConfigs(fs, cfg).Base.Caches
c.Assert(len(decoded), qt.Equals, 6)
c.Assert(len(decoded), qt.Equals, 7)
for _, v := range decoded {
c.Assert(v.MaxAge, qt.Equals, time.Duration(0))
@ -129,7 +129,7 @@ func TestDecodeConfigDefault(t *testing.T) {
fs := afero.NewMemMapFs()
decoded := testconfig.GetTestConfigs(fs, cfg).Base.Caches
c.Assert(len(decoded), qt.Equals, 6)
c.Assert(len(decoded), qt.Equals, 7)
imgConfig := decoded[filecache.CacheKeyImages]
jsonConfig := decoded[filecache.CacheKeyGetJSON]

View file

@ -59,7 +59,7 @@ dir = ":resourceDir/_gen"
caches, err := filecache.NewCaches(p)
c.Assert(err, qt.IsNil)
cache := caches[name]
for i := 0; i < 10; i++ {
for i := range 10 {
id := fmt.Sprintf("i%d", i)
cache.GetOrCreateBytes(id, func() ([]byte, error) {
return []byte("abc"), nil
@ -74,7 +74,7 @@ dir = ":resourceDir/_gen"
c.Assert(err, qt.IsNil)
c.Assert(count, qt.Equals, 5, msg)
for i := 0; i < 10; i++ {
for i := range 10 {
id := fmt.Sprintf("i%d", i)
v := cache.GetString(id)
if i < 5 {
@ -97,7 +97,7 @@ dir = ":resourceDir/_gen"
c.Assert(count, qt.Equals, 4)
// Now only the i5 should be left.
for i := 0; i < 10; i++ {
for i := range 10 {
id := fmt.Sprintf("i%d", i)
v := cache.GetString(id)
if i != 5 {

View file

@ -105,7 +105,7 @@ dir = ":cacheDir/c"
}
for _, ca := range []*filecache.Cache{caches.ImageCache(), caches.AssetsCache(), caches.GetJSONCache(), caches.GetCSVCache()} {
for i := 0; i < 2; i++ {
for range 2 {
info, r, err := ca.GetOrCreate("a", rf("abc"))
c.Assert(err, qt.IsNil)
c.Assert(r, qt.Not(qt.IsNil))
@ -193,11 +193,11 @@ dir = "/cache/c"
var wg sync.WaitGroup
for i := 0; i < 50; i++ {
for i := range 50 {
wg.Add(1)
go func(i int) {
defer wg.Done()
for j := 0; j < 20; j++ {
for range 20 {
ca := caches.Get(cacheName)
c.Assert(ca, qt.Not(qt.IsNil))
filename, data := filenameData(i)

229
cache/httpcache/httpcache.go vendored Normal file
View file

@ -0,0 +1,229 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package httpcache
import (
"encoding/json"
"time"
"github.com/gobwas/glob"
"github.com/gohugoio/hugo/common/predicate"
"github.com/gohugoio/hugo/config"
"github.com/mitchellh/mapstructure"
)
// DefaultConfig holds the default configuration for the HTTP cache.
var DefaultConfig = Config{
Cache: Cache{
For: GlobMatcher{
Excludes: []string{"**"},
},
},
Polls: []PollConfig{
{
For: GlobMatcher{
Includes: []string{"**"},
},
Disable: true,
},
},
}
// Config holds the configuration for the HTTP cache.
type Config struct {
// Configures the HTTP cache behavior (RFC 9111).
// When this is not enabled for a resource, Hugo will go straight to the file cache.
Cache Cache
// Polls holds a list of configurations for polling remote resources to detect changes in watch mode.
// This can be disabled for some resources, typically if they are known to not change.
Polls []PollConfig
}
type Cache struct {
// Enable HTTP cache behavior (RFC 9111) for these resources.
For GlobMatcher
}
func (c *Config) Compile() (ConfigCompiled, error) {
var cc ConfigCompiled
p, err := c.Cache.For.CompilePredicate()
if err != nil {
return cc, err
}
cc.For = p
for _, pc := range c.Polls {
p, err := pc.For.CompilePredicate()
if err != nil {
return cc, err
}
cc.PollConfigs = append(cc.PollConfigs, PollConfigCompiled{
For: p,
Config: pc,
})
}
return cc, nil
}
// PollConfig holds the configuration for polling remote resources to detect changes in watch mode.
type PollConfig struct {
// What remote resources to apply this configuration to.
For GlobMatcher
// Disable polling for this configuration.
Disable bool
// Low is the lower bound for the polling interval.
// This is the starting point when the resource has recently changed,
// if that resource stops changing, the polling interval will gradually increase towards High.
Low time.Duration
// High is the upper bound for the polling interval.
// This is the interval used when the resource is stable.
High time.Duration
}
func (c PollConfig) MarshalJSON() (b []byte, err error) {
// Marshal the durations as strings.
type Alias PollConfig
return json.Marshal(&struct {
Low string
High string
Alias
}{
Low: c.Low.String(),
High: c.High.String(),
Alias: (Alias)(c),
})
}
type GlobMatcher struct {
// Excludes holds a list of glob patterns that will be excluded.
Excludes []string
// Includes holds a list of glob patterns that will be included.
Includes []string
}
func (gm GlobMatcher) IsZero() bool {
return len(gm.Includes) == 0 && len(gm.Excludes) == 0
}
type ConfigCompiled struct {
For predicate.P[string]
PollConfigs []PollConfigCompiled
}
func (c *ConfigCompiled) PollConfigFor(s string) PollConfigCompiled {
for _, pc := range c.PollConfigs {
if pc.For(s) {
return pc
}
}
return PollConfigCompiled{}
}
func (c *ConfigCompiled) IsPollingDisabled() bool {
for _, pc := range c.PollConfigs {
if !pc.Config.Disable {
return false
}
}
return true
}
type PollConfigCompiled struct {
For predicate.P[string]
Config PollConfig
}
func (p PollConfigCompiled) IsZero() bool {
return p.For == nil
}
func (gm *GlobMatcher) CompilePredicate() (func(string) bool, error) {
if gm.IsZero() {
panic("no includes or excludes")
}
var p predicate.P[string]
for _, include := range gm.Includes {
g, err := glob.Compile(include, '/')
if err != nil {
return nil, err
}
fn := func(s string) bool {
return g.Match(s)
}
p = p.Or(fn)
}
for _, exclude := range gm.Excludes {
g, err := glob.Compile(exclude, '/')
if err != nil {
return nil, err
}
fn := func(s string) bool {
return !g.Match(s)
}
p = p.And(fn)
}
return p, nil
}
func DecodeConfig(_ config.BaseConfig, m map[string]any) (Config, error) {
if len(m) == 0 {
return DefaultConfig, nil
}
var c Config
dc := &mapstructure.DecoderConfig{
Result: &c,
DecodeHook: mapstructure.StringToTimeDurationHookFunc(),
WeaklyTypedInput: true,
}
decoder, err := mapstructure.NewDecoder(dc)
if err != nil {
return c, err
}
if err := decoder.Decode(m); err != nil {
return c, err
}
if c.Cache.For.IsZero() {
c.Cache.For = DefaultConfig.Cache.For
}
for pci := range c.Polls {
if c.Polls[pci].For.IsZero() {
c.Polls[pci].For = DefaultConfig.Cache.For
c.Polls[pci].Disable = true
}
}
if len(c.Polls) == 0 {
c.Polls = DefaultConfig.Polls
}
return c, nil
}

View file

@ -0,0 +1,95 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package httpcache_test
import (
"testing"
"time"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/hugolib"
)
func TestConfigCustom(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
[httpcache]
[httpcache.cache.for]
includes = ["**gohugo.io**"]
[[httpcache.polls]]
low = "5s"
high = "32s"
[httpcache.polls.for]
includes = ["**gohugo.io**"]
`
b := hugolib.Test(t, files)
httpcacheConf := b.H.Configs.Base.HTTPCache
compiled := b.H.Configs.Base.C.HTTPCache
b.Assert(httpcacheConf.Cache.For.Includes, qt.DeepEquals, []string{"**gohugo.io**"})
b.Assert(httpcacheConf.Cache.For.Excludes, qt.IsNil)
pc := compiled.PollConfigFor("https://gohugo.io/foo.jpg")
b.Assert(pc.Config.Low, qt.Equals, 5*time.Second)
b.Assert(pc.Config.High, qt.Equals, 32*time.Second)
b.Assert(compiled.PollConfigFor("https://example.com/foo.jpg").IsZero(), qt.IsTrue)
}
func TestConfigDefault(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
`
b := hugolib.Test(t, files)
compiled := b.H.Configs.Base.C.HTTPCache
b.Assert(compiled.For("https://gohugo.io/posts.json"), qt.IsFalse)
b.Assert(compiled.For("https://gohugo.io/foo.jpg"), qt.IsFalse)
b.Assert(compiled.PollConfigFor("https://gohugo.io/foo.jpg").Config.Disable, qt.IsTrue)
}
func TestConfigPollsOnly(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
[httpcache]
[[httpcache.polls]]
low = "5s"
high = "32s"
[httpcache.polls.for]
includes = ["**gohugo.io**"]
`
b := hugolib.Test(t, files)
compiled := b.H.Configs.Base.C.HTTPCache
b.Assert(compiled.For("https://gohugo.io/posts.json"), qt.IsFalse)
b.Assert(compiled.For("https://gohugo.io/foo.jpg"), qt.IsFalse)
pc := compiled.PollConfigFor("https://gohugo.io/foo.jpg")
b.Assert(pc.Config.Low, qt.Equals, 5*time.Second)
b.Assert(pc.Config.High, qt.Equals, 32*time.Second)
b.Assert(compiled.PollConfigFor("https://example.com/foo.jpg").IsZero(), qt.IsTrue)
}

73
cache/httpcache/httpcache_test.go vendored Normal file
View file

@ -0,0 +1,73 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package httpcache
import (
"testing"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/config"
)
func TestGlobMatcher(t *testing.T) {
c := qt.New(t)
g := GlobMatcher{
Includes: []string{"**/*.jpg", "**.png", "**/bar/**"},
Excludes: []string{"**/foo.jpg", "**.css"},
}
p, err := g.CompilePredicate()
c.Assert(err, qt.IsNil)
c.Assert(p("foo.jpg"), qt.IsFalse)
c.Assert(p("foo.png"), qt.IsTrue)
c.Assert(p("foo/bar.jpg"), qt.IsTrue)
c.Assert(p("foo/bar.png"), qt.IsTrue)
c.Assert(p("foo/bar/foo.jpg"), qt.IsFalse)
c.Assert(p("foo/bar/foo.css"), qt.IsFalse)
c.Assert(p("foo.css"), qt.IsFalse)
c.Assert(p("foo/bar/foo.css"), qt.IsFalse)
c.Assert(p("foo/bar/foo.xml"), qt.IsTrue)
}
func TestDefaultConfig(t *testing.T) {
c := qt.New(t)
_, err := DefaultConfig.Compile()
c.Assert(err, qt.IsNil)
}
func TestDecodeConfigInjectsDefaultAndCompiles(t *testing.T) {
c := qt.New(t)
cfg, err := DecodeConfig(config.BaseConfig{}, map[string]interface{}{})
c.Assert(err, qt.IsNil)
c.Assert(cfg, qt.DeepEquals, DefaultConfig)
_, err = cfg.Compile()
c.Assert(err, qt.IsNil)
cfg, err = DecodeConfig(config.BaseConfig{}, map[string]any{
"cache": map[string]any{
"polls": []map[string]any{
{"disable": true},
},
},
})
c.Assert(err, qt.IsNil)
_, err = cfg.Compile()
c.Assert(err, qt.IsNil)
}

View file

@ -26,6 +26,7 @@ import (
"path/filepath"
"reflect"
"regexp"
"slices"
"sort"
"strings"
"sync"
@ -102,7 +103,7 @@ func (c *Inspector) MethodsFromTypes(include []reflect.Type, exclude []reflect.T
}
for _, t := range include {
for i := 0; i < t.NumMethod(); i++ {
for i := range t.NumMethod() {
m := t.Method(i)
if excludes[m.Name] || seen[m.Name] {
@ -122,7 +123,7 @@ func (c *Inspector) MethodsFromTypes(include []reflect.Type, exclude []reflect.T
method := Method{Owner: t, OwnerName: ownerName, Name: m.Name}
for i := 0; i < numIn; i++ {
for i := range numIn {
in := m.Type.In(i)
name, pkg := nameAndPackage(in)
@ -137,7 +138,7 @@ func (c *Inspector) MethodsFromTypes(include []reflect.Type, exclude []reflect.T
numOut := m.Type.NumOut()
if numOut > 0 {
for i := 0; i < numOut; i++ {
for i := range numOut {
out := m.Type.Out(i)
name, pkg := nameAndPackage(out)
@ -304,7 +305,7 @@ func (m Method) inOutStr() string {
}
args := make([]string, len(m.In))
for i := 0; i < len(args); i++ {
for i := range args {
args[i] = fmt.Sprintf("arg%d", i)
}
return "(" + strings.Join(args, ", ") + ")"
@ -316,7 +317,7 @@ func (m Method) inStr() string {
}
args := make([]string, len(m.In))
for i := 0; i < len(args); i++ {
for i := range args {
args[i] = fmt.Sprintf("arg%d %s", i, m.In[i])
}
return "(" + strings.Join(args, ", ") + ")"
@ -339,7 +340,7 @@ func (m Method) outStrNamed() string {
}
outs := make([]string, len(m.Out))
for i := 0; i < len(outs); i++ {
for i := range outs {
outs[i] = fmt.Sprintf("o%d %s", i, m.Out[i])
}
@ -435,7 +436,7 @@ func (m Methods) ToMarshalJSON(receiver, pkgPath string, excludes ...string) (st
// Exclude self
for i, pkgImp := range pkgImports {
if pkgImp == pkgPath {
pkgImports = append(pkgImports[:i], pkgImports[i+1:]...)
pkgImports = slices.Delete(pkgImports, i, i+1)
}
}
}

View file

@ -39,15 +39,16 @@ import (
"github.com/gohugoio/hugo/common/hstrings"
"github.com/gohugoio/hugo/common/htime"
"github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/common/paths"
"github.com/gohugoio/hugo/common/types"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/config/allconfig"
"github.com/gohugoio/hugo/deps"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/resources/kinds"
"github.com/spf13/afero"
"github.com/spf13/cobra"
@ -65,6 +66,12 @@ func Execute(args []string) error {
}
args = mapLegacyArgs(args)
cd, err := x.Execute(context.Background(), args)
if cd != nil {
if closer, ok := cd.Root.Command.(types.Closer); ok {
closer.Close()
}
}
if err != nil {
if err == errHelp {
cd.CobraCommand.Help()
@ -87,11 +94,17 @@ type commonConfig struct {
fs *hugofs.Fs
}
type configKey struct {
counter int32
ignoreModulesDoesNotExists bool
}
// This is the root command.
type rootCommand struct {
Printf func(format string, v ...interface{})
Println func(a ...interface{})
Out io.Writer
Printf func(format string, v ...any)
Println func(a ...any)
StdOut io.Writer
StdErr io.Writer
logger loggers.Logger
@ -100,8 +113,11 @@ type rootCommand struct {
// Some, but not all commands need access to these.
// Some needs more than one, so keep them in a small cache.
commonConfigs *lazycache.Cache[int32, *commonConfig]
hugoSites *lazycache.Cache[int32, *hugolib.HugoSites]
commonConfigs *lazycache.Cache[configKey, *commonConfig]
hugoSites *lazycache.Cache[configKey, *hugolib.HugoSites]
// changesFromBuild received from Hugo in watch mode.
changesFromBuild chan []identity.Identity
commands []simplecobra.Commander
@ -125,9 +141,8 @@ type rootCommand struct {
logLevel string
verbose bool
debug bool
quiet bool
devMode bool // Hidden flag.
renderToMemory bool
@ -139,6 +154,18 @@ func (r *rootCommand) isVerbose() bool {
return r.logger.Level() <= logg.LevelInfo
}
func (r *rootCommand) Close() error {
if r.hugoSites != nil {
r.hugoSites.DeleteFunc(func(key configKey, value *hugolib.HugoSites) bool {
if value != nil {
value.Close()
}
return false
})
}
return nil
}
func (r *rootCommand) Build(cd *simplecobra.Commandeer, bcfg hugolib.BuildCfg, cfg config.Provider) (*hugolib.HugoSites, error) {
h, err := r.Hugo(cfg)
if err != nil {
@ -155,17 +182,18 @@ func (r *rootCommand) Commands() []simplecobra.Commander {
return r.commands
}
func (r *rootCommand) ConfigFromConfig(key int32, oldConf *commonConfig) (*commonConfig, error) {
cc, _, err := r.commonConfigs.GetOrCreate(key, func(key int32) (*commonConfig, error) {
func (r *rootCommand) ConfigFromConfig(key configKey, oldConf *commonConfig) (*commonConfig, error) {
cc, _, err := r.commonConfigs.GetOrCreate(key, func(key configKey) (*commonConfig, error) {
fs := oldConf.fs
configs, err := allconfig.LoadConfig(
allconfig.ConfigSourceDescriptor{
Flags: oldConf.cfg,
Fs: fs.Source,
Filename: r.cfgFile,
ConfigDir: r.cfgDir,
Logger: r.logger,
Environment: r.environment,
Flags: oldConf.cfg,
Fs: fs.Source,
Filename: r.cfgFile,
ConfigDir: r.cfgDir,
Logger: r.logger,
Environment: r.environment,
IgnoreModuleDoesNotExist: key.ignoreModulesDoesNotExists,
},
)
if err != nil {
@ -188,11 +216,11 @@ func (r *rootCommand) ConfigFromConfig(key int32, oldConf *commonConfig) (*commo
return cc, err
}
func (r *rootCommand) ConfigFromProvider(key int32, cfg config.Provider) (*commonConfig, error) {
func (r *rootCommand) ConfigFromProvider(key configKey, cfg config.Provider) (*commonConfig, error) {
if cfg == nil {
panic("cfg must be set")
}
cc, _, err := r.commonConfigs.GetOrCreate(key, func(key int32) (*commonConfig, error) {
cc, _, err := r.commonConfigs.GetOrCreate(key, func(key configKey) (*commonConfig, error) {
var dir string
if r.source != "" {
dir, _ = filepath.Abs(r.source)
@ -215,12 +243,13 @@ func (r *rootCommand) ConfigFromProvider(key int32, cfg config.Provider) (*commo
// Load the config first to allow publishDir to be configured in config file.
configs, err := allconfig.LoadConfig(
allconfig.ConfigSourceDescriptor{
Flags: cfg,
Fs: hugofs.Os,
Filename: r.cfgFile,
ConfigDir: r.cfgDir,
Environment: r.environment,
Logger: r.logger,
Flags: cfg,
Fs: hugofs.Os,
Filename: r.cfgFile,
ConfigDir: r.cfgDir,
Environment: r.environment,
Logger: r.logger,
IgnoreModuleDoesNotExist: key.ignoreModulesDoesNotExists,
},
)
if err != nil {
@ -302,36 +331,46 @@ func (r *rootCommand) ConfigFromProvider(key int32, cfg config.Provider) (*commo
}
func (r *rootCommand) HugFromConfig(conf *commonConfig) (*hugolib.HugoSites, error) {
h, _, err := r.hugoSites.GetOrCreate(r.configVersionID.Load(), func(key int32) (*hugolib.HugoSites, error) {
depsCfg := deps.DepsCfg{Configs: conf.configs, Fs: conf.fs, LogOut: r.logger.Out(), LogLevel: r.logger.Level()}
k := configKey{counter: r.configVersionID.Load()}
h, _, err := r.hugoSites.GetOrCreate(k, func(key configKey) (*hugolib.HugoSites, error) {
depsCfg := r.newDepsConfig(conf)
return hugolib.NewHugoSites(depsCfg)
})
return h, err
}
func (r *rootCommand) Hugo(cfg config.Provider) (*hugolib.HugoSites, error) {
h, _, err := r.hugoSites.GetOrCreate(r.configVersionID.Load(), func(key int32) (*hugolib.HugoSites, error) {
return r.getOrCreateHugo(cfg, false)
}
func (r *rootCommand) getOrCreateHugo(cfg config.Provider, ignoreModuleDoesNotExist bool) (*hugolib.HugoSites, error) {
k := configKey{counter: r.configVersionID.Load(), ignoreModulesDoesNotExists: ignoreModuleDoesNotExist}
h, _, err := r.hugoSites.GetOrCreate(k, func(key configKey) (*hugolib.HugoSites, error) {
conf, err := r.ConfigFromProvider(key, cfg)
if err != nil {
return nil, err
}
depsCfg := deps.DepsCfg{Configs: conf.configs, Fs: conf.fs, LogOut: r.logger.Out(), LogLevel: r.logger.Level()}
depsCfg := r.newDepsConfig(conf)
return hugolib.NewHugoSites(depsCfg)
})
return h, err
}
func (r *rootCommand) newDepsConfig(conf *commonConfig) deps.DepsCfg {
return deps.DepsCfg{Configs: conf.configs, Fs: conf.fs, StdOut: r.logger.StdOut(), StdErr: r.logger.StdErr(), LogLevel: r.logger.Level(), ChangesFromBuild: r.changesFromBuild}
}
func (r *rootCommand) Name() string {
return "hugo"
}
func (r *rootCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error {
if !r.buildWatch {
defer r.timeTrack(time.Now(), "Total")
}
b := newHugoBuilder(r, nil)
if !r.buildWatch {
defer b.postBuild("Total", time.Now())
}
if err := b.loadConfig(cd, false); err != nil {
return err
}
@ -383,21 +422,23 @@ func (r *rootCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args
}
func (r *rootCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
r.Out = os.Stdout
r.StdOut = os.Stdout
r.StdErr = os.Stderr
if r.quiet {
r.Out = io.Discard
r.StdOut = io.Discard
r.StdErr = io.Discard
}
// Used by mkcert (server).
log.SetOutput(r.Out)
log.SetOutput(r.StdOut)
r.Printf = func(format string, v ...interface{}) {
r.Printf = func(format string, v ...any) {
if !r.quiet {
fmt.Fprintf(r.Out, format, v...)
fmt.Fprintf(r.StdOut, format, v...)
}
}
r.Println = func(a ...interface{}) {
r.Println = func(a ...any) {
if !r.quiet {
fmt.Fprintln(r.Out, a...)
fmt.Fprintln(r.StdOut, a...)
}
}
_, running := runner.Command.(*serverCommand)
@ -406,12 +447,16 @@ func (r *rootCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
if err != nil {
return err
}
// Set up the global logger early to allow info deprecations during config load.
loggers.SetGlobalLogger(r.logger)
r.commonConfigs = lazycache.New(lazycache.Options[int32, *commonConfig]{MaxEntries: 5})
r.changesFromBuild = make(chan []identity.Identity, 10)
r.commonConfigs = lazycache.New(lazycache.Options[configKey, *commonConfig]{MaxEntries: 5})
// We don't want to keep stale HugoSites in memory longer than needed.
r.hugoSites = lazycache.New(lazycache.Options[int32, *hugolib.HugoSites]{
r.hugoSites = lazycache.New(lazycache.Options[configKey, *hugolib.HugoSites]{
MaxEntries: 1,
OnEvict: func(key int32, value *hugolib.HugoSites) {
OnEvict: func(key configKey, value *hugolib.HugoSites) {
value.Close()
runtime.GC()
},
@ -423,44 +468,37 @@ func (r *rootCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
func (r *rootCommand) createLogger(running bool) (loggers.Logger, error) {
level := logg.LevelWarn
if r.logLevel != "" {
switch strings.ToLower(r.logLevel) {
case "debug":
level = logg.LevelDebug
case "info":
level = logg.LevelInfo
case "warn", "warning":
level = logg.LevelWarn
case "error":
level = logg.LevelError
default:
return nil, fmt.Errorf("invalid log level: %q, must be one of debug, warn, info or error", r.logLevel)
}
if r.devMode {
level = logg.LevelTrace
} else {
if r.verbose {
hugo.Deprecate("--verbose", "use --logLevel info", "v0.114.0")
hugo.Deprecate("--verbose", "use --logLevel info", "v0.114.0")
level = logg.LevelInfo
}
if r.debug {
hugo.Deprecate("--debug", "use --logLevel debug", "v0.114.0")
level = logg.LevelDebug
if r.logLevel != "" {
switch strings.ToLower(r.logLevel) {
case "debug":
level = logg.LevelDebug
case "info":
level = logg.LevelInfo
case "warn", "warning":
level = logg.LevelWarn
case "error":
level = logg.LevelError
default:
return nil, fmt.Errorf("invalid log level: %q, must be one of debug, warn, info or error", r.logLevel)
}
}
}
optsLogger := loggers.Options{
DistinctLevel: logg.LevelWarn,
Level: level,
Stdout: r.Out,
Stderr: r.Out,
StdOut: r.StdOut,
StdErr: r.StdErr,
StoreErrors: running,
}
return loggers.New(optsLogger), nil
}
func (r *rootCommand) Reset() {
func (r *rootCommand) resetLogs() {
r.logger.Reset()
loggers.Log().Reset()
}
@ -471,16 +509,26 @@ func (r *rootCommand) IsTestRun() bool {
}
func (r *rootCommand) Init(cd *simplecobra.Commandeer) error {
return r.initRootCommand("", cd)
}
func (r *rootCommand) initRootCommand(subCommandName string, cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand
cmd.Use = "hugo [flags]"
cmd.Short = "hugo builds your site"
cmd.Long = `hugo is the main command, used to build your Hugo site.
commandName := "hugo"
if subCommandName != "" {
commandName = subCommandName
}
cmd.Use = fmt.Sprintf("%s [flags]", commandName)
cmd.Short = "Build your site"
cmd.Long = `COMMAND_NAME is the main command, used to build your Hugo site.
Hugo is a Fast and Flexible Static Site Generator
built with love by spf13 and friends in Go.
Complete documentation is available at https://gohugo.io/.`
cmd.Long = strings.ReplaceAll(cmd.Long, "COMMAND_NAME", commandName)
// Configure persistent flags
cmd.PersistentFlags().StringVarP(&r.source, "source", "s", "", "filesystem path to read files relative from")
_ = cmd.MarkFlagDirname("source")
@ -492,6 +540,7 @@ Complete documentation is available at https://gohugo.io/.`
cmd.PersistentFlags().StringP("themesDir", "", "", "filesystem path to themes directory")
_ = cmd.MarkFlagDirname("themesDir")
cmd.PersistentFlags().StringP("ignoreVendorPaths", "", "", "ignores any _vendor for module paths matching the given Glob pattern")
cmd.PersistentFlags().BoolP("noBuildLock", "", false, "don't create .hugo_build.lock file")
_ = cmd.RegisterFlagCompletionFunc("ignoreVendorPaths", cobra.NoFileCompletions)
cmd.PersistentFlags().String("clock", "", "set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00")
_ = cmd.RegisterFlagCompletionFunc("clock", cobra.NoFileCompletions)
@ -501,14 +550,15 @@ Complete documentation is available at https://gohugo.io/.`
cmd.PersistentFlags().StringVar(&r.cfgDir, "configDir", "config", "config dir")
_ = cmd.MarkFlagDirname("configDir")
cmd.PersistentFlags().BoolVar(&r.quiet, "quiet", false, "build in quiet mode")
cmd.PersistentFlags().BoolVar(&r.renderToMemory, "renderToMemory", false, "render to memory (mostly useful when running the server)")
cmd.PersistentFlags().BoolVarP(&r.renderToMemory, "renderToMemory", "M", false, "render to memory (mostly useful when running the server)")
cmd.PersistentFlags().BoolVarP(&r.verbose, "verbose", "v", false, "verbose output")
cmd.PersistentFlags().BoolVarP(&r.debug, "debug", "", false, "debug output")
cmd.PersistentFlags().BoolVarP(&r.devMode, "devMode", "", false, "only used for internal testing, flag hidden.")
cmd.PersistentFlags().StringVar(&r.logLevel, "logLevel", "", "log level (debug|info|warn|error)")
_ = cmd.RegisterFlagCompletionFunc("logLevel", cobra.FixedCompletions([]string{"debug", "info", "warn", "error"}, cobra.ShellCompDirectiveNoFileComp))
cmd.Flags().BoolVarP(&r.buildWatch, "watch", "w", false, "watch filesystem for changes and recreate as needed")
cmd.PersistentFlags().MarkHidden("devMode")
// Configure local flags
applyLocalFlagsBuild(cmd, r)
@ -546,7 +596,6 @@ func applyLocalFlagsBuild(cmd *cobra.Command, r *rootCommand) {
cmd.Flags().BoolVar(&r.forceSyncStatic, "forceSyncStatic", false, "copy all files when static is changed.")
cmd.Flags().BoolP("noTimes", "", false, "don't sync modification time of files")
cmd.Flags().BoolP("noChmod", "", false, "don't sync permission mode of files")
cmd.Flags().BoolP("noBuildLock", "", false, "don't create .hugo_build.lock file")
cmd.Flags().BoolP("printI18nWarnings", "", false, "print missing translations")
cmd.Flags().BoolP("printPathWarnings", "", false, "print warnings on duplicate target paths etc.")
cmd.Flags().BoolP("printUnusedTemplates", "", false, "print warnings on unused templates.")

View file

@ -14,6 +14,8 @@
package commands
import (
"context"
"github.com/bep/simplecobra"
)
@ -21,6 +23,7 @@ import (
func newExec() (*simplecobra.Exec, error) {
rootCmd := &rootCommand{
commands: []simplecobra.Commander{
newHugoBuildCmd(),
newVersionCmd(),
newEnvCommand(),
newServerCommand(),
@ -38,3 +41,33 @@ func newExec() (*simplecobra.Exec, error) {
return simplecobra.New(rootCmd)
}
func newHugoBuildCmd() simplecobra.Commander {
return &hugoBuildCommand{}
}
// hugoBuildCommand just delegates to the rootCommand.
type hugoBuildCommand struct {
rootCmd *rootCommand
}
func (c *hugoBuildCommand) Commands() []simplecobra.Commander {
return nil
}
func (c *hugoBuildCommand) Name() string {
return "build"
}
func (c *hugoBuildCommand) Init(cd *simplecobra.Commandeer) error {
c.rootCmd = cd.Root.Command.(*rootCommand)
return c.rootCmd.initRootCommand("build", cd)
}
func (c *hugoBuildCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
return c.rootCmd.PreRun(cd, runner)
}
func (c *hugoBuildCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error {
return c.rootCmd.Run(ctx, cd, args)
}

View file

@ -43,8 +43,9 @@ func newConfigCommand() *configCommand {
type configCommand struct {
r *rootCommand
format string
lang string
format string
lang string
printZero bool
commands []simplecobra.Commander
}
@ -58,7 +59,7 @@ func (c *configCommand) Name() string {
}
func (c *configCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error {
conf, err := c.r.ConfigFromProvider(c.r.configVersionID.Load(), flagsToCfg(cd, nil))
conf, err := c.r.ConfigFromProvider(configKey{counter: c.r.configVersionID.Load()}, flagsToCfg(cd, nil))
if err != nil {
return err
}
@ -78,7 +79,7 @@ func (c *configCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg
dec.SetIndent("", " ")
dec.SetEscapeHTML(false)
if err := dec.Encode(parser.ReplacingJSONMarshaller{Value: config, KeysToLower: true, OmitEmpty: true}); err != nil {
if err := dec.Encode(parser.ReplacingJSONMarshaller{Value: config, KeysToLower: true, OmitEmpty: !c.printZero}); err != nil {
return err
}
@ -89,7 +90,7 @@ func (c *configCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg
os.Stdout.Write(buf.Bytes())
default:
// Decode the JSON to a map[string]interface{} and then unmarshal it again to the correct format.
var m map[string]interface{}
var m map[string]any
if err := json.Unmarshal(buf.Bytes(), &m); err != nil {
return err
}
@ -110,11 +111,12 @@ func (c *configCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg
func (c *configCommand) Init(cd *simplecobra.Commandeer) error {
c.r = cd.Root.Command.(*rootCommand)
cmd := cd.CobraCommand
cmd.Short = "Print the site configuration"
cmd.Long = `Print the site configuration, both default and custom settings.`
cmd.Short = "Display site configuration"
cmd.Long = `Display site configuration, both default and custom settings.`
cmd.Flags().StringVar(&c.format, "format", "toml", "preferred file format (toml, yaml or json)")
_ = cmd.RegisterFlagCompletionFunc("format", cobra.FixedCompletions([]string{"toml", "yaml", "json"}, cobra.ShellCompDirectiveNoFileComp))
cmd.Flags().StringVar(&c.lang, "lang", "", "the language to display config for. Defaults to the first language defined.")
cmd.Flags().BoolVar(&c.printZero, "printZero", false, `include config options with zero values (e.g. false, 0, "") in the output`)
_ = cmd.RegisterFlagCompletionFunc("lang", cobra.NoFileCompletions)
applyLocalFlagsBuildConfig(cmd, c.r)
@ -209,7 +211,7 @@ func (c *configMountsCommand) Name() string {
func (c *configMountsCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error {
r := c.configCmd.r
conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, nil))
conf, err := r.ConfigFromProvider(configKey{counter: c.r.configVersionID.Load()}, flagsToCfg(cd, nil))
if err != nil {
return err
}

View file

@ -105,8 +105,8 @@ func (c *convertCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, ar
func (c *convertCommand) Init(cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand
cmd.Short = "Convert your content to different formats"
cmd.Long = `Convert your content (e.g. front matter) to different formats.
cmd.Short = "Convert front matter to another format"
cmd.Long = `Convert front matter to another format.
See convert's subcommands toJSON, toTOML and toYAML for more information.`

View file

@ -11,21 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build !nodeploy
// +build !nodeploy
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build withdeploy
package commands
@ -33,7 +19,6 @@ import (
"context"
"github.com/gohugoio/hugo/deploy"
"github.com/gohugoio/hugo/deploy/deployconfig"
"github.com/bep/simplecobra"
"github.com/spf13/cobra"
@ -42,8 +27,8 @@ import (
func newDeployCommand() simplecobra.Commander {
return &simpleCommand{
name: "deploy",
short: "Deploy your site to a Cloud provider.",
long: `Deploy your site to a Cloud provider.
short: "Deploy your site to a cloud provider",
long: `Deploy your site to a cloud provider
See https://gohugo.io/hosting-and-deployment/hugo-deploy/ for detailed
documentation.
@ -60,17 +45,7 @@ documentation.
return deployer.Deploy(ctx)
},
withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.ValidArgsFunction = cobra.NoFileCompletions
cmd.Flags().String("target", "", "target deployment from deployments section in config file; defaults to the first one")
_ = cmd.RegisterFlagCompletionFunc("target", cobra.NoFileCompletions)
cmd.Flags().Bool("confirm", false, "ask for confirmation before making changes to the target")
cmd.Flags().Bool("dryRun", false, "dry run")
cmd.Flags().Bool("force", false, "force upload of all files")
cmd.Flags().Bool("invalidateCDN", deployconfig.DefaultConfig.InvalidateCDN, "invalidate the CDN cache listed in the deployment target")
cmd.Flags().Int("maxDeletes", deployconfig.DefaultConfig.MaxDeletes, "maximum # of files to delete, or -1 to disable")
_ = cmd.RegisterFlagCompletionFunc("maxDeletes", cobra.NoFileCompletions)
cmd.Flags().Int("workers", deployconfig.DefaultConfig.Workers, "number of workers to transfer files. defaults to 10")
_ = cmd.RegisterFlagCompletionFunc("workers", cobra.NoFileCompletions)
applyDeployFlags(cmd, r)
},
}
}

33
commands/deploy_flags.go Normal file
View file

@ -0,0 +1,33 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package commands
import (
"github.com/gohugoio/hugo/deploy/deployconfig"
"github.com/spf13/cobra"
)
func applyDeployFlags(cmd *cobra.Command, r *rootCommand) {
cmd.ValidArgsFunction = cobra.NoFileCompletions
cmd.Flags().String("target", "", "target deployment from deployments section in config file; defaults to the first one")
_ = cmd.RegisterFlagCompletionFunc("target", cobra.NoFileCompletions)
cmd.Flags().Bool("confirm", false, "ask for confirmation before making changes to the target")
cmd.Flags().Bool("dryRun", false, "dry run")
cmd.Flags().Bool("force", false, "force upload of all files")
cmd.Flags().Bool("invalidateCDN", deployconfig.DefaultConfig.InvalidateCDN, "invalidate the CDN cache listed in the deployment target")
cmd.Flags().Int("maxDeletes", deployconfig.DefaultConfig.MaxDeletes, "maximum # of files to delete, or -1 to disable")
_ = cmd.RegisterFlagCompletionFunc("maxDeletes", cobra.NoFileCompletions)
cmd.Flags().Int("workers", deployconfig.DefaultConfig.Workers, "number of workers to transfer files. defaults to 10")
_ = cmd.RegisterFlagCompletionFunc("workers", cobra.NoFileCompletions)
}

View file

@ -11,8 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
//go:build nodeploy
// +build nodeploy
//go:build !withdeploy
// Copyright 2024 The Hugo Authors. All rights reserved.
//
@ -31,6 +30,7 @@ package commands
import (
"context"
"errors"
"github.com/bep/simplecobra"
"github.com/spf13/cobra"
@ -40,9 +40,10 @@ func newDeployCommand() simplecobra.Commander {
return &simpleCommand{
name: "deploy",
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
return nil
return errors.New("deploy not supported in this version of Hugo; install a release with 'withdeploy' in the archive filename or build yourself with the 'withdeploy' build tag. Also see https://github.com/gohugoio/hugo/pull/12995")
},
withc: func(cmd *cobra.Command, r *rootCommand) {
applyDeployFlags(cmd, r)
cmd.Hidden = true
},
}

View file

@ -25,8 +25,8 @@ import (
func newEnvCommand() simplecobra.Commander {
return &simpleCommand{
name: "env",
short: "Print Hugo version and environment info",
long: "Print Hugo version and environment info. This is useful in Hugo bug reports",
short: "Display version and environment info",
long: "Display version and environment info. This is useful in Hugo bug reports",
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
r.Printf("%s\n", hugo.BuildVersionString())
r.Printf("GOOS=%q\n", runtime.GOOS)
@ -61,8 +61,8 @@ func newVersionCmd() simplecobra.Commander {
r.Println(hugo.BuildVersionString())
return nil
},
short: "Print Hugo version and environment info",
long: "Print Hugo version and environment info. This is useful in Hugo bug reports.",
short: "Display version",
long: "Display version and environment info. This is useful in Hugo bug reports.",
withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.ValidArgsFunction = cobra.NoFileCompletions
},

View file

@ -21,6 +21,7 @@ import (
"os"
"path"
"path/filepath"
"slices"
"strings"
"github.com/alecthomas/chroma/v2"
@ -45,9 +46,11 @@ func newGenCommand() *genCommand {
genmandir string
// Chroma flags.
style string
highlightStyle string
linesStyle string
style string
highlightStyle string
lineNumbersInlineStyle string
lineNumbersTableStyle string
omitEmpty bool
)
newChromaStyles := func() simplecobra.Commander {
@ -59,29 +62,49 @@ func newGenCommand() *genCommand {
See https://xyproto.github.io/splash/docs/all.html for a preview of the available styles`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
style = strings.ToLower(style)
if !slices.Contains(styles.Names(), style) {
return fmt.Errorf("invalid style: %s", style)
}
builder := styles.Get(style).Builder()
if highlightStyle != "" {
builder.Add(chroma.LineHighlight, highlightStyle)
}
if linesStyle != "" {
builder.Add(chroma.LineNumbers, linesStyle)
if lineNumbersInlineStyle != "" {
builder.Add(chroma.LineNumbers, lineNumbersInlineStyle)
}
if lineNumbersTableStyle != "" {
builder.Add(chroma.LineNumbersTable, lineNumbersTableStyle)
}
style, err := builder.Build()
if err != nil {
return err
}
formatter := html.New(html.WithAllClasses(true))
formatter.WriteCSS(os.Stdout, style)
var formatter *html.Formatter
if omitEmpty {
formatter = html.New(html.WithClasses(true))
} else {
formatter = html.New(html.WithAllClasses(true))
}
w := os.Stdout
fmt.Fprintf(w, "/* Generated using: hugo %s */\n\n", strings.Join(os.Args[1:], " "))
formatter.WriteCSS(w, style)
return nil
},
withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.ValidArgsFunction = cobra.NoFileCompletions
cmd.PersistentFlags().StringVar(&style, "style", "friendly", "highlighter style (see https://xyproto.github.io/splash/docs/)")
_ = cmd.RegisterFlagCompletionFunc("style", cobra.NoFileCompletions)
cmd.PersistentFlags().StringVar(&highlightStyle, "highlightStyle", "", "style used for highlighting lines (see https://github.com/alecthomas/chroma)")
cmd.PersistentFlags().StringVar(&highlightStyle, "highlightStyle", "", `foreground and background colors for highlighted lines, e.g. --highlightStyle "#fff000 bg:#000fff"`)
_ = cmd.RegisterFlagCompletionFunc("highlightStyle", cobra.NoFileCompletions)
cmd.PersistentFlags().StringVar(&linesStyle, "linesStyle", "", "style used for line numbers (see https://github.com/alecthomas/chroma)")
_ = cmd.RegisterFlagCompletionFunc("linesStyle", cobra.NoFileCompletions)
cmd.PersistentFlags().StringVar(&lineNumbersInlineStyle, "lineNumbersInlineStyle", "", `foreground and background colors for inline line numbers, e.g. --lineNumbersInlineStyle "#fff000 bg:#000fff"`)
_ = cmd.RegisterFlagCompletionFunc("lineNumbersInlineStyle", cobra.NoFileCompletions)
cmd.PersistentFlags().StringVar(&lineNumbersTableStyle, "lineNumbersTableStyle", "", `foreground and background colors for table line numbers, e.g. --lineNumbersTableStyle "#fff000 bg:#000fff"`)
_ = cmd.RegisterFlagCompletionFunc("lineNumbersTableStyle", cobra.NoFileCompletions)
cmd.PersistentFlags().BoolVar(&omitEmpty, "omitEmpty", false, `omit empty CSS rules`)
_ = cmd.RegisterFlagCompletionFunc("omitEmpty", cobra.NoFileCompletions)
},
}
}
@ -136,7 +159,7 @@ url: %s
return &simpleCommand{
name: "doc",
short: "Generate Markdown documentation for the Hugo CLI.",
short: "Generate Markdown documentation for the Hugo CLI",
long: `Generate Markdown documentation for the Hugo CLI.
This command is, mostly, used to create up-to-date documentation
of Hugo's command-line interface for https://gohugo.io/.
@ -161,13 +184,13 @@ url: %s
prepender := func(filename string) string {
name := filepath.Base(filename)
base := strings.TrimSuffix(name, path.Ext(name))
url := "/commands/" + strings.ToLower(base) + "/"
url := "/docs/reference/commands/" + strings.ToLower(base) + "/"
return fmt.Sprintf(gendocFrontmatterTemplate, strings.Replace(base, "_", " ", -1), base, url)
}
linkHandler := func(name string) string {
base := strings.TrimSuffix(name, path.Ext(name))
return "/commands/" + strings.ToLower(base) + "/"
return "/docs/reference/commands/" + strings.ToLower(base) + "/"
}
r.Println("Generating Hugo command-line documentation in", gendocdir, "...")
doc.GenMarkdownTreeCustom(cd.CobraCommand.Root(), gendocdir, prepender, linkHandler)
@ -188,7 +211,7 @@ url: %s
newDocsHelper := func() simplecobra.Commander {
return &simpleCommand{
name: "docshelper",
short: "Generate some data files for the Hugo docs.",
short: "Generate some data files for the Hugo docs",
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
r.Println("Generate docs data to", docsHelperTarget)
@ -209,7 +232,7 @@ url: %s
}
// Decode the JSON to a map[string]interface{} and then unmarshal it again to the correct format.
var m map[string]interface{}
var m map[string]any
if err := json.Unmarshal(buf.Bytes(), &m); err != nil {
return err
}
@ -267,7 +290,8 @@ func (c *genCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args [
func (c *genCommand) Init(cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand
cmd.Short = "A collection of several useful generators."
cmd.Short = "Generate documentation and syntax highlighting styles"
cmd.Long = "Generate documentation for your project using Hugo's documentation engine, including syntax highlighting for various programming languages."
cmd.RunE = nil
return nil

View file

@ -27,7 +27,6 @@ import (
"sync/atomic"
"time"
"github.com/bep/logg"
"github.com/bep/simplecobra"
"github.com/fsnotify/fsnotify"
"github.com/gohugoio/hugo/common/herrors"
@ -43,6 +42,7 @@ import (
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/hugolib/filesystems"
"github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/livereload"
"github.com/gohugoio/hugo/resources/page"
"github.com/gohugoio/hugo/watcher"
@ -62,7 +62,7 @@ type hugoBuilder struct {
// Currently only set when in "fast render mode".
changeDetector *fileChangeDetector
visitedURLs *types.EvictingStringQueue
visitedURLs *types.EvictingQueue[string]
fullRebuildSem *semaphore.Weighted
debounce func(f func())
@ -75,9 +75,14 @@ type hugoBuilder struct {
errState hugoBuilderErrState
}
var errConfigNotSet = errors.New("config not set")
func (c *hugoBuilder) withConfE(fn func(conf *commonConfig) error) error {
c.confmu.Lock()
defer c.confmu.Unlock()
if c.conf == nil {
return errConfigNotSet
}
return fn(c.conf)
}
@ -130,10 +135,6 @@ func (e *hugoBuilderErrState) wasErr() bool {
return e.waserr
}
func (c *hugoBuilder) errCount() int {
return c.r.logger.LoggCount(logg.LevelError) + loggers.Log().LoggCount(logg.LevelError)
}
// getDirList provides NewWatcher() with a list of directories to watch for changes.
func (c *hugoBuilder) getDirList() ([]string, error) {
h, err := c.hugo()
@ -338,6 +339,26 @@ func (c *hugoBuilder) newWatcher(pollIntervalStr string, dirList ...string) (*wa
go func() {
for {
select {
case changes := <-c.r.changesFromBuild:
unlock, err := h.LockBuild()
if err != nil {
c.r.logger.Errorln("Failed to acquire a build lock: %s", err)
return
}
c.changeDetector.PrepareNew()
err = c.rebuildSitesForChanges(changes)
if err != nil {
c.r.logger.Errorln("Error while watching:", err)
}
if c.s != nil && c.s.doLiveReload {
doReload := c.changeDetector == nil || len(c.changeDetector.changed()) > 0
doReload = doReload || c.showErrorInBrowser && c.errState.buildErr() != nil
if doReload {
livereload.ForceRefresh()
}
}
unlock()
case evs := <-watcher.Events:
unlock, err := h.LockBuild()
if err != nil {
@ -345,7 +366,7 @@ func (c *hugoBuilder) newWatcher(pollIntervalStr string, dirList ...string) (*wa
return
}
c.handleEvents(watcher, staticSyncer, evs, configSet)
if c.showErrorInBrowser && c.errCount() > 0 {
if c.showErrorInBrowser && c.errState.buildErr() != nil {
// Need to reload browser to show the error
livereload.ForceRefresh()
}
@ -392,11 +413,17 @@ func (c *hugoBuilder) build() error {
}
func (c *hugoBuilder) buildSites(noBuildLock bool) (err error) {
h, err := c.hugo()
defer func() {
c.errState.setBuildErr(err)
}()
var h *hugolib.HugoSites
h, err = c.hugo()
if err != nil {
return err
return
}
return h.Build(hugolib.BuildCfg{NoBuildLock: noBuildLock})
err = h.Build(hugolib.BuildCfg{NoBuildLock: noBuildLock})
return
}
func (c *hugoBuilder) copyStatic() (map[string]uint64, error) {
@ -585,13 +612,16 @@ func (c *hugoBuilder) fullRebuild(changeType string) {
time.Sleep(2 * time.Second)
}()
defer c.r.timeTrack(time.Now(), "Rebuilt")
defer c.postBuild("Rebuilt", time.Now())
err := c.reloadConfig()
if err != nil {
// Set the processing on pause until the state is recovered.
c.errState.setPaused(true)
c.handleBuildErr(err, "Failed to reload config")
if c.s.doLiveReload {
livereload.ForceRefresh()
}
} else {
c.errState.setPaused(false)
}
@ -633,7 +663,20 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
var n int
for _, ev := range evs {
keep := true
if ev.Has(fsnotify.Create) || ev.Has(fsnotify.Write) {
// Write and rename operations are often followed by CHMOD.
// There may be valid use cases for rebuilding the site on CHMOD,
// but that will require more complex logic than this simple conditional.
// On OS X this seems to be related to Spotlight, see:
// https://github.com/go-fsnotify/fsnotify/issues/15
// A workaround is to put your site(s) on the Spotlight exception list,
// but that may be a little mysterious for most end users.
// So, for now, we skip reload on CHMOD.
// We do have to check for WRITE though. On slower laptops a Chmod
// could be aggregated with other important events, and we still want
// to rebuild on those
if ev.Op == fsnotify.Chmod {
keep = false
} else if ev.Has(fsnotify.Create) || ev.Has(fsnotify.Write) {
if _, err := os.Stat(ev.Name); err != nil {
keep = false
}
@ -717,6 +760,20 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
staticEvents := []fsnotify.Event{}
dynamicEvents := []fsnotify.Event{}
filterDuplicateEvents := func(evs []fsnotify.Event) []fsnotify.Event {
seen := make(map[string]bool)
var n int
for _, ev := range evs {
if seen[ev.Name] {
continue
}
seen[ev.Name] = true
evs[n] = ev
n++
}
return evs[:n]
}
h, err := c.hugo()
if err != nil {
c.r.logger.Errorln("Error getting the Hugo object:", err)
@ -738,6 +795,7 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
istemp := strings.HasSuffix(ext, "~") ||
(ext == ".swp") || // vim
(ext == ".swx") || // vim
(ext == ".bck") || // helix
(ext == ".tmp") || // generic temp file
(ext == ".DS_Store") || // OSX Thumbnail
baseName == "4913" || // vim
@ -760,21 +818,6 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
continue
}
// Write and rename operations are often followed by CHMOD.
// There may be valid use cases for rebuilding the site on CHMOD,
// but that will require more complex logic than this simple conditional.
// On OS X this seems to be related to Spotlight, see:
// https://github.com/go-fsnotify/fsnotify/issues/15
// A workaround is to put your site(s) on the Spotlight exception list,
// but that may be a little mysterious for most end users.
// So, for now, we skip reload on CHMOD.
// We do have to check for WRITE though. On slower laptops a Chmod
// could be aggregated with other important events, and we still want
// to rebuild on those
if ev.Op&(fsnotify.Chmod|fsnotify.Write|fsnotify.Create) == fsnotify.Chmod {
continue
}
walkAdder := func(path string, f hugofs.FileMetaInfo) error {
if f.IsDir() {
c.r.logger.Println("adding created directory to watchlist", path)
@ -806,6 +849,11 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
}
}
lrl := c.r.logger.InfoCommand("livereload")
staticEvents = filterDuplicateEvents(staticEvents)
dynamicEvents = filterDuplicateEvents(dynamicEvents)
if len(staticEvents) > 0 {
c.printChangeDetected("Static files")
@ -826,19 +874,20 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
if c.s != nil && c.s.doLiveReload {
// Will block forever trying to write to a channel that nobody is reading if livereload isn't initialized
// force refresh when more than one file
if !c.errState.wasErr() && len(staticEvents) == 1 {
ev := staticEvents[0]
h, err := c.hugo()
if err != nil {
c.r.logger.Errorln("Error getting the Hugo object:", err)
return
}
path := h.BaseFs.SourceFilesystems.MakeStaticPathRelative(ev.Name)
path := h.BaseFs.SourceFilesystems.MakeStaticPathRelative(staticEvents[0].Name)
path = h.RelURL(paths.ToSlashTrimLeading(path), false)
lrl.Logf("refreshing static file %q", path)
livereload.RefreshPath(path)
} else {
lrl.Logf("got %d static file change events, force refresh", len(staticEvents))
livereload.ForceRefresh()
}
}
@ -849,33 +898,47 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
h.BaseFs.SourceFilesystems,
dynamicEvents)
onePageName := pickOneWriteOrCreatePath(partitionedEvents.ContentEvents)
onePageName := pickOneWriteOrCreatePath(h.Conf.ContentTypes(), partitionedEvents.ContentEvents)
c.printChangeDetected("")
c.changeDetector.PrepareNew()
func() {
defer c.r.timeTrack(time.Now(), "Total")
defer c.postBuild("Total", time.Now())
if err := c.rebuildSites(dynamicEvents); err != nil {
c.handleBuildErr(err, "Rebuild failed")
}
}()
if c.s != nil && c.s.doLiveReload {
if len(partitionedEvents.ContentEvents) == 0 && len(partitionedEvents.AssetEvents) > 0 {
if c.errState.wasErr() {
livereload.ForceRefresh()
return
if c.errState.wasErr() {
livereload.ForceRefresh()
return
}
changed := c.changeDetector.changed()
if c.changeDetector != nil {
if len(changed) >= 10 {
lrl.Logf("build changed %d files", len(changed))
} else {
lrl.Logf("build changed %d files: %q", len(changed), changed)
}
changed := c.changeDetector.changed()
if c.changeDetector != nil && len(changed) == 0 {
if len(changed) == 0 {
// Nothing has changed.
return
} else if len(changed) == 1 {
pathToRefresh := h.PathSpec.RelURL(paths.ToSlashTrimLeading(changed[0]), false)
livereload.RefreshPath(pathToRefresh)
}
}
// If this change set also contains one or more CSS files, we need to
// refresh these as well.
var cssChanges []string
var otherChanges []string
for _, ev := range changed {
if strings.HasSuffix(ev, ".css") {
cssChanges = append(cssChanges, ev)
} else {
livereload.ForceRefresh()
otherChanges = append(otherChanges, ev)
}
}
@ -891,16 +954,51 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
}
}
if p != nil {
livereload.NavigateToPathForPort(p.RelPermalink(), p.Site().ServerPort())
if p != nil && p.RelPermalink() != "" {
link, port := p.RelPermalink(), p.Site().ServerPort()
lrl.Logf("navigating to %q using port %d", link, port)
livereload.NavigateToPathForPort(link, port)
} else {
lrl.Logf("no page to navigate to, force refresh")
livereload.ForceRefresh()
}
} else if len(otherChanges) > 0 {
if len(otherChanges) == 1 {
// Allow single changes to be refreshed without a full page reload.
pathToRefresh := h.PathSpec.RelURL(paths.ToSlashTrimLeading(otherChanges[0]), false)
lrl.Logf("refreshing %q", pathToRefresh)
livereload.RefreshPath(pathToRefresh)
} else if len(cssChanges) == 0 || len(otherChanges) > 1 {
lrl.Logf("force refresh")
livereload.ForceRefresh()
}
} else {
lrl.Logf("force refresh")
livereload.ForceRefresh()
}
if len(cssChanges) > 0 {
// Allow some time for the live reload script to get reconnected.
if len(otherChanges) > 0 {
time.Sleep(200 * time.Millisecond)
}
for _, ev := range cssChanges {
pathToRefresh := h.PathSpec.RelURL(paths.ToSlashTrimLeading(ev), false)
lrl.Logf("refreshing CSS %q", pathToRefresh)
livereload.RefreshPath(pathToRefresh)
}
}
}
}
}
func (c *hugoBuilder) postBuild(what string, start time.Time) {
if h, err := c.hugo(); err == nil && h.Conf.Running() {
h.LogServerAddresses()
}
c.r.timeTrack(start, what)
}
func (c *hugoBuilder) hugo() (*hugolib.HugoSites, error) {
var h *hugolib.HugoSites
if err := c.withConfE(func(conf *commonConfig) error {
@ -957,7 +1055,7 @@ func (c *hugoBuilder) loadConfig(cd *simplecobra.Commandeer, running bool) error
"fastRenderMode": c.fastRenderMode,
})
conf, err := c.r.ConfigFromProvider(c.r.configVersionID.Load(), flagsToCfg(cd, cfg))
conf, err := c.r.ConfigFromProvider(configKey{counter: c.r.configVersionID.Load()}, flagsToCfg(cd, cfg))
if err != nil {
return err
}
@ -991,29 +1089,49 @@ func (c *hugoBuilder) printChangeDetected(typ string) {
c.r.logger.Println(htime.Now().Format(layout))
}
func (c *hugoBuilder) rebuildSites(events []fsnotify.Event) error {
func (c *hugoBuilder) rebuildSites(events []fsnotify.Event) (err error) {
defer func() {
c.errState.setBuildErr(err)
}()
if err := c.errState.buildErr(); err != nil {
ferrs := herrors.UnwrapFileErrorsWithErrorContext(err)
for _, err := range ferrs {
events = append(events, fsnotify.Event{Name: err.Position().Filename, Op: fsnotify.Write})
}
}
c.errState.setBuildErr(nil)
h, err := c.hugo()
var h *hugolib.HugoSites
h, err = c.hugo()
if err != nil {
return err
return
}
err = h.Build(hugolib.BuildCfg{NoBuildLock: true, RecentlyTouched: c.visitedURLs, ErrRecovery: c.errState.wasErr()}, events...)
return
}
return h.Build(hugolib.BuildCfg{NoBuildLock: true, RecentlyVisited: c.visitedURLs, ErrRecovery: c.errState.wasErr()}, events...)
func (c *hugoBuilder) rebuildSitesForChanges(ids []identity.Identity) (err error) {
defer func() {
c.errState.setBuildErr(err)
}()
var h *hugolib.HugoSites
h, err = c.hugo()
if err != nil {
return
}
whatChanged := &hugolib.WhatChanged{}
whatChanged.Add(ids...)
err = h.Build(hugolib.BuildCfg{NoBuildLock: true, WhatChanged: whatChanged, RecentlyTouched: c.visitedURLs, ErrRecovery: c.errState.wasErr()})
return
}
func (c *hugoBuilder) reloadConfig() error {
c.r.Reset()
c.r.resetLogs()
c.r.configVersionID.Add(1)
if err := c.withConfE(func(conf *commonConfig) error {
oldConf := conf
newConf, err := c.r.ConfigFromConfig(c.r.configVersionID.Load(), conf)
newConf, err := c.r.ConfigFromConfig(configKey{counter: c.r.configVersionID.Load()}, conf)
if err != nil {
return err
}

View file

@ -90,8 +90,8 @@ func (c *importCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg
func (c *importCommand) Init(cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand
cmd.Short = "Import your site from others."
cmd.Long = `Import your site from other web site generators like Jekyll.
cmd.Short = "Import a site from another system"
cmd.Long = `Import a site from another system.
Import requires a subcommand, e.g. ` + "`hugo import jekyll jekyll_root_path target_path`."

View file

@ -41,6 +41,8 @@ func newListCommand() *listCommand {
p.PublishDate().Format(time.RFC3339),
strconv.FormatBool(p.Draft()),
p.Permalink(),
p.Kind(),
p.Section(),
}
}
@ -55,7 +57,7 @@ func newListCommand() *listCommand {
return err
}
writer := csv.NewWriter(r.Out)
writer := csv.NewWriter(r.StdOut)
defer writer.Flush()
writer.Write([]string{
@ -67,6 +69,8 @@ func newListCommand() *listCommand {
"publishDate",
"draft",
"permalink",
"kind",
"section",
})
for _, p := range h.Pages() {
@ -75,9 +79,6 @@ func newListCommand() *listCommand {
if err := writer.Write(record); err != nil {
return err
}
if err != nil {
return err
}
}
}
@ -88,8 +89,8 @@ func newListCommand() *listCommand {
commands: []simplecobra.Commander{
&simpleCommand{
name: "drafts",
short: "List all drafts",
long: `List all of the drafts in your content directory.`,
short: "List draft content",
long: `List draft content.`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
shouldInclude := func(p page.Page) bool {
if !p.Draft() || p.File() == nil {
@ -109,8 +110,8 @@ func newListCommand() *listCommand {
},
&simpleCommand{
name: "future",
short: "List all posts dated in the future",
long: `List all of the posts in your content directory which will be posted in the future.`,
short: "List future content",
long: `List content with a future publication date.`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
shouldInclude := func(p page.Page) bool {
if !resource.IsFuture(p) || p.File() == nil {
@ -129,8 +130,8 @@ func newListCommand() *listCommand {
},
&simpleCommand{
name: "expired",
short: "List all posts already expired",
long: `List all of the posts in your content directory which has already expired.`,
short: "List expired content",
long: `List content with a past expiration date.`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
shouldInclude := func(p page.Page) bool {
if !resource.IsExpired(p) || p.File() == nil {
@ -149,8 +150,8 @@ func newListCommand() *listCommand {
},
&simpleCommand{
name: "all",
short: "List all posts",
long: `List all of the posts in your content directory, include drafts, future and expired pages.`,
short: "List all content",
long: `List all content including draft, future, and expired.`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
shouldInclude := func(p page.Page) bool {
return p.File() != nil
@ -161,6 +162,20 @@ func newListCommand() *listCommand {
cmd.ValidArgsFunction = cobra.NoFileCompletions
},
},
&simpleCommand{
name: "published",
short: "List published content",
long: `List content that is not draft, future, or expired.`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
shouldInclude := func(p page.Page) bool {
return !p.Draft() && !resource.IsFuture(p) && !resource.IsExpired(p) && p.File() != nil
}
return list(cd, r, shouldInclude)
},
withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.ValidArgsFunction = cobra.NoFileCompletions
},
},
},
}
}
@ -184,8 +199,8 @@ func (c *listCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args
func (c *listCommand) Init(cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand
cmd.Short = "Listing out various types of content"
cmd.Long = `Listing out various types of content.
cmd.Short = "List content"
cmd.Long = `List content.
List requires a subcommand, e.g. hugo list drafts`

View file

@ -44,16 +44,16 @@ func newModCommands() *modCommands {
npmCommand := &simpleCommand{
name: "npm",
short: "Various npm helpers.",
short: "Various npm helpers",
long: `Various npm (Node package manager) helpers.`,
commands: []simplecobra.Commander{
&simpleCommand{
name: "pack",
short: "Experimental: Prepares and writes a composite package.json file for your project.",
short: "Experimental: Prepares and writes a composite package.json file for your project",
long: `Prepares and writes a composite package.json file for your project.
On first run it creates a "package.hugo.json" in the project root if not already there. This file will be used as a template file
with the base dependency set.
with the base dependency set.
This set will be merged with all "package.hugo.json" files found in the dependency tree, picking the version closest to the project.
@ -80,12 +80,12 @@ so this may/will change in future versions of Hugo.
commands: []simplecobra.Commander{
&simpleCommand{
name: "init",
short: "Initialize this project as a Hugo Module.",
short: "Initialize this project as a Hugo Module",
long: `Initialize this project as a Hugo Module.
It will try to guess the module path, but you may help by passing it as an argument, e.g:
hugo mod init github.com/gohugoio/testshortcodes
Note that Hugo Modules supports multi-module projects, so you can initialize a Hugo Module
inside a subfolder on GitHub, as one example.
`,
@ -94,7 +94,7 @@ so this may/will change in future versions of Hugo.
applyLocalFlagsBuildConfig(cmd, r)
},
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
h, err := r.Hugo(flagsToCfg(cd, nil))
h, err := r.getOrCreateHugo(flagsToCfg(cd, nil), true)
if err != nil {
return err
}
@ -102,12 +102,16 @@ so this may/will change in future versions of Hugo.
if len(args) >= 1 {
initPath = args[0]
}
return h.Configs.ModulesClient.Init(initPath)
c := h.Configs.ModulesClient
if err := c.Init(initPath); err != nil {
return err
}
return nil
},
},
&simpleCommand{
name: "verify",
short: "Verify dependencies.",
short: "Verify dependencies",
long: `Verify checks that the dependencies of the current module, which are stored in a local downloaded source cache, have not been modified since being downloaded.`,
withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.ValidArgsFunction = cobra.NoFileCompletions
@ -115,7 +119,7 @@ so this may/will change in future versions of Hugo.
cmd.Flags().BoolVarP(&clean, "clean", "", false, "delete module cache for dependencies that fail verification")
},
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, nil))
conf, err := r.ConfigFromProvider(configKey{counter: r.configVersionID.Load()}, flagsToCfg(cd, nil))
if err != nil {
return err
}
@ -125,7 +129,7 @@ so this may/will change in future versions of Hugo.
},
&simpleCommand{
name: "graph",
short: "Print a module dependency graph.",
short: "Print a module dependency graph",
long: `Print a module dependency graph with information about module status (disabled, vendored).
Note that for vendored modules, that is the version listed and not the one from go.mod.
`,
@ -135,7 +139,7 @@ Note that for vendored modules, that is the version listed and not the one from
cmd.Flags().BoolVarP(&clean, "clean", "", false, "delete module cache for dependencies that fail verification")
},
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, nil))
conf, err := r.ConfigFromProvider(configKey{counter: r.configVersionID.Load()}, flagsToCfg(cd, nil))
if err != nil {
return err
}
@ -145,7 +149,7 @@ Note that for vendored modules, that is the version listed and not the one from
},
&simpleCommand{
name: "clean",
short: "Delete the Hugo Module cache for the current project.",
short: "Delete the Hugo Module cache for the current project",
long: `Delete the Hugo Module cache for the current project.`,
withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.ValidArgsFunction = cobra.NoFileCompletions
@ -171,7 +175,7 @@ Note that for vendored modules, that is the version listed and not the one from
},
&simpleCommand{
name: "tidy",
short: "Remove unused entries in go.mod and go.sum.",
short: "Remove unused entries in go.mod and go.sum",
withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.ValidArgsFunction = cobra.NoFileCompletions
applyLocalFlagsBuildConfig(cmd, r)
@ -186,7 +190,7 @@ Note that for vendored modules, that is the version listed and not the one from
},
&simpleCommand{
name: "vendor",
short: "Vendor all module dependencies into the _vendor directory.",
short: "Vendor all module dependencies into the _vendor directory",
long: `Vendor all module dependencies into the _vendor directory.
If a module is vendored, that is where Hugo will look for it's dependencies.
`,
@ -205,16 +209,16 @@ Note that for vendored modules, that is the version listed and not the one from
&simpleCommand{
name: "get",
short: "Resolves dependencies in your current Hugo Project.",
short: "Resolves dependencies in your current Hugo project",
long: `
Resolves dependencies in your current Hugo Project.
Resolves dependencies in your current Hugo project.
Some examples:
Install the latest version possible for a given module:
hugo mod get github.com/gohugoio/testshortcodes
Install a specific version:
hugo mod get github.com/gohugoio/testshortcodes@v0.3.0
@ -268,13 +272,14 @@ Run "go help get" for more information. All flags available for "go get" is also
if info.Name() == "go.mod" {
// Found a module.
dir := filepath.Dir(path)
r.Println("Update module in", dir)
cfg := config.New()
cfg.Set("workingDir", dir)
conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, cfg))
conf, err := r.ConfigFromProvider(configKey{counter: r.configVersionID.Add(1)}, flagsToCfg(cd, cfg))
if err != nil {
return err
}
r.Println("Update module in", conf.configs.Base.WorkingDir)
client := conf.configs.ModulesClient
return client.Get(args...)
@ -283,7 +288,7 @@ Run "go help get" for more information. All flags available for "go get" is also
})
return nil
} else {
conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, nil))
conf, err := r.ConfigFromProvider(configKey{counter: r.configVersionID.Load()}, flagsToCfg(cd, nil))
if err != nil {
return err
}
@ -312,7 +317,7 @@ func (c *modCommands) Name() string {
}
func (c *modCommands) Run(ctx context.Context, cd *simplecobra.Commandeer, args []string) error {
_, err := c.r.ConfigFromProvider(c.r.configVersionID.Load(), nil)
_, err := c.r.ConfigFromProvider(configKey{counter: c.r.configVersionID.Load()}, nil)
if err != nil {
return err
}
@ -323,7 +328,7 @@ func (c *modCommands) Run(ctx context.Context, cd *simplecobra.Commandeer, args
func (c *modCommands) Init(cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand
cmd.Short = "Various Hugo Modules helpers."
cmd.Short = "Manage modules"
cmd.Long = `Various helpers to help manage the modules in your project's dependency graph.
Most operations here requires a Go version installed on your system (>= Go 1.12) and the relevant VCS client (typically Git).
This is not needed if you only operate on modules inside /themes or if you have vendored them via "hugo mod vendor".

View file

@ -40,7 +40,7 @@ func newNewCommand() *newCommand {
&simpleCommand{
name: "content",
use: "content [path]",
short: "Create new content for your site",
short: "Create new content",
long: `Create a new content file and automatically set the date and title.
It will guess which kind of file to create based on the path provided.
@ -76,10 +76,8 @@ Ensure you run this within the root directory of your site.`,
&simpleCommand{
name: "site",
use: "site [path]",
short: "Create a new site (skeleton)",
long: `Create a new site in the provided directory.
The new site will have the correct structure, but no content or theme yet.
Use ` + "`hugo new [contentPath]`" + ` to create new content.`,
short: "Create a new site",
long: `Create a new site at the specified path.`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
if len(args) < 1 {
return newUserError("path needs to be provided")
@ -93,7 +91,7 @@ Use ` + "`hugo new [contentPath]`" + ` to create new content.`,
cfg.Set("workingDir", createpath)
cfg.Set("publishDir", "public")
conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, cfg))
conf, err := r.ConfigFromProvider(configKey{counter: r.configVersionID.Load()}, flagsToCfg(cd, cfg))
if err != nil {
return err
}
@ -124,11 +122,9 @@ Use ` + "`hugo new [contentPath]`" + ` to create new content.`,
&simpleCommand{
name: "theme",
use: "theme [name]",
short: "Create a new theme (skeleton)",
long: `Create a new theme (skeleton) called [name] in ./themes.
New theme is a skeleton. Please add content to the touched files. Add your
name to the copyright line in the license and adjust the theme.toml file
according to your needs.`,
short: "Create a new theme",
long: `Create a new theme with the specified name in the ./themes directory.
This generates a functional theme including template examples and sample content.`,
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
if len(args) < 1 {
return newUserError("theme name needs to be provided")
@ -136,7 +132,7 @@ according to your needs.`,
cfg := config.New()
cfg.Set("publishDir", "public")
conf, err := r.ConfigFromProvider(r.configVersionID.Load(), flagsToCfg(cd, cfg))
conf, err := r.ConfigFromProvider(configKey{counter: r.configVersionID.Load()}, flagsToCfg(cd, cfg))
if err != nil {
return err
}
@ -144,7 +140,7 @@ according to your needs.`,
createpath := paths.AbsPathify(conf.configs.Base.WorkingDir, filepath.Join(conf.configs.Base.ThemesDir, args[0]))
r.Println("Creating new theme in", createpath)
err = skeletons.CreateTheme(createpath, sourceFs)
err = skeletons.CreateTheme(createpath, sourceFs, format)
if err != nil {
return err
}
@ -152,7 +148,14 @@ according to your needs.`,
return nil
},
withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.ValidArgsFunction = cobra.NoFileCompletions
cmd.ValidArgsFunction = func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if len(args) != 0 {
return []string{}, cobra.ShellCompDirectiveNoFileComp
}
return []string{}, cobra.ShellCompDirectiveNoFileComp | cobra.ShellCompDirectiveFilterDirs
}
cmd.Flags().StringVar(&format, "format", "toml", "preferred file format (toml, yaml or json)")
_ = cmd.RegisterFlagCompletionFunc("format", cobra.FixedCompletions([]string{"toml", "yaml", "json"}, cobra.ShellCompDirectiveNoFileComp))
},
},
},
@ -181,7 +184,7 @@ func (c *newCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, args [
func (c *newCommand) Init(cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand
cmd.Short = "Create new content for your site"
cmd.Short = "Create new content"
cmd.Long = `Create a new content file and automatically set the date and title.
It will guess which kind of file to create based on the path provided.
@ -209,7 +212,7 @@ func (c *newCommand) newSiteNextStepsText(path string, format string) string {
1. Change the current directory to ` + path + `.
2. Create or install a theme:
- Create a new theme with the command "hugo new theme <THEMENAME>"
- Install a theme from https://themes.gohugo.io/
- Or, install a theme from https://themes.gohugo.io/
3. Edit hugo.` + format + `, setting the "theme" property to the theme name.
4. Create new content with the command "hugo new content `)

View file

@ -32,7 +32,7 @@ func newReleaseCommand() simplecobra.Commander {
return &simpleCommand{
name: "release",
short: "Release a new version of Hugo.",
short: "Release a new version of Hugo",
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
rel, err := releaser.New(skipPush, try, step)
if err != nil {

View file

@ -23,6 +23,7 @@ import (
"errors"
"fmt"
"io"
"maps"
"net"
"net/http"
_ "net/http/pprof"
@ -32,6 +33,7 @@ import (
"path"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"sync"
@ -40,22 +42,23 @@ import (
"time"
"github.com/bep/mclib"
"github.com/pkg/browser"
"github.com/bep/debounce"
"github.com/bep/simplecobra"
"github.com/fsnotify/fsnotify"
"github.com/gohugoio/hugo/common/herrors"
"github.com/gohugoio/hugo/common/hugo"
"github.com/gohugoio/hugo/tpl/tplimpl"
"github.com/gohugoio/hugo/common/types"
"github.com/gohugoio/hugo/common/urls"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/hugofs/files"
"github.com/gohugoio/hugo/hugolib"
"github.com/gohugoio/hugo/hugolib/filesystems"
"github.com/gohugoio/hugo/livereload"
"github.com/gohugoio/hugo/tpl"
"github.com/gohugoio/hugo/transform"
"github.com/gohugoio/hugo/transform/livereloadinject"
"github.com/spf13/afero"
@ -82,10 +85,14 @@ const (
configChangeGoWork = "go work file"
)
const (
hugoHeaderRedirect = "X-Hugo-Redirect"
)
func newHugoBuilder(r *rootCommand, s *serverCommand, onConfigLoaded ...func(reloaded bool) error) *hugoBuilder {
var visitedURLs *types.EvictingStringQueue
var visitedURLs *types.EvictingQueue[string]
if s != nil && !s.disableFastRender {
visitedURLs = types.NewEvictingStringQueue(20)
visitedURLs = types.NewEvictingQueue[string](20)
}
return &hugoBuilder{
r: r,
@ -113,7 +120,7 @@ func newServerCommand() *serverCommand {
commands: []simplecobra.Commander{
&simpleCommand{
name: "trust",
short: "Install the local CA in the system trust store.",
short: "Install the local CA in the system trust store",
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
action := "-install"
if uninstall {
@ -162,16 +169,16 @@ type dynamicEvents struct {
type fileChangeDetector struct {
sync.Mutex
current map[string]string
prev map[string]string
current map[string]uint64
prev map[string]uint64
irrelevantRe *regexp.Regexp
}
func (f *fileChangeDetector) OnFileClose(name, md5sum string) {
func (f *fileChangeDetector) OnFileClose(name string, checksum uint64) {
f.Lock()
defer f.Unlock()
f.current[name] = md5sum
f.current[name] = checksum
}
func (f *fileChangeDetector) PrepareNew() {
@ -183,16 +190,14 @@ func (f *fileChangeDetector) PrepareNew() {
defer f.Unlock()
if f.current == nil {
f.current = make(map[string]string)
f.prev = make(map[string]string)
f.current = make(map[string]uint64)
f.prev = make(map[string]uint64)
return
}
f.prev = make(map[string]string)
for k, v := range f.current {
f.prev[k] = v
}
f.current = make(map[string]string)
f.prev = make(map[string]uint64)
maps.Copy(f.prev, f.current)
f.current = make(map[string]uint64)
}
func (f *fileChangeDetector) changed() []string {
@ -209,16 +214,17 @@ func (f *fileChangeDetector) changed() []string {
}
}
return f.filterIrrelevant(c)
return f.filterIrrelevantAndSort(c)
}
func (f *fileChangeDetector) filterIrrelevant(in []string) []string {
func (f *fileChangeDetector) filterIrrelevantAndSort(in []string) []string {
var filtered []string
for _, v := range in {
if !f.irrelevantRe.MatchString(v) {
filtered = append(filtered, v)
}
}
sort.Strings(filtered)
return filtered
}
@ -304,64 +310,65 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, net.Listener, string
w.Header().Set(header.Key, header.Value)
}
if redirect := serverConfig.MatchRedirect(requestURI); !redirect.IsZero() {
// fullName := filepath.Join(dir, filepath.FromSlash(path.Clean("/"+name)))
doRedirect := true
// This matches Netlify's behavior and is needed for SPA behavior.
// See https://docs.netlify.com/routing/redirects/rewrites-proxies/
if !redirect.Force {
path := filepath.Clean(strings.TrimPrefix(requestURI, baseURL.Path()))
if root != "" {
path = filepath.Join(root, path)
}
var fs afero.Fs
f.c.withConf(func(conf *commonConfig) {
fs = conf.fs.PublishDirServer
})
fi, err := fs.Stat(path)
if err == nil {
if fi.IsDir() {
// There will be overlapping directories, so we
// need to check for a file.
_, err = fs.Stat(filepath.Join(path, "index.html"))
doRedirect = err != nil
} else {
doRedirect = false
if canRedirect(requestURI, r) {
if redirect := serverConfig.MatchRedirect(requestURI, r.Header); !redirect.IsZero() {
doRedirect := true
// This matches Netlify's behavior and is needed for SPA behavior.
// See https://docs.netlify.com/routing/redirects/rewrites-proxies/
if !redirect.Force {
path := filepath.Clean(strings.TrimPrefix(requestURI, baseURL.Path()))
if root != "" {
path = filepath.Join(root, path)
}
}
}
var fs afero.Fs
f.c.withConf(func(conf *commonConfig) {
fs = conf.fs.PublishDirServer
})
fi, err := fs.Stat(path)
if doRedirect {
switch redirect.Status {
case 404:
w.WriteHeader(404)
file, err := fs.Open(strings.TrimPrefix(redirect.To, baseURL.Path()))
if err == nil {
defer file.Close()
io.Copy(w, file)
} else {
fmt.Fprintln(w, "<h1>Page Not Found</h1>")
if fi.IsDir() {
// There will be overlapping directories, so we
// need to check for a file.
_, err = fs.Stat(filepath.Join(path, "index.html"))
doRedirect = err != nil
} else {
doRedirect = false
}
}
return
case 200:
if r2 := f.rewriteRequest(r, strings.TrimPrefix(redirect.To, baseURL.Path())); r2 != nil {
requestURI = redirect.To
r = r2
}
default:
w.Header().Set("Content-Type", "")
http.Redirect(w, r, redirect.To, redirect.Status)
return
}
if doRedirect {
w.Header().Set(hugoHeaderRedirect, "true")
switch redirect.Status {
case 404:
w.WriteHeader(404)
file, err := fs.Open(strings.TrimPrefix(redirect.To, baseURL.Path()))
if err == nil {
defer file.Close()
io.Copy(w, file)
} else {
fmt.Fprintln(w, "<h1>Page Not Found</h1>")
}
return
case 200:
if r2 := f.rewriteRequest(r, strings.TrimPrefix(redirect.To, baseURL.Path())); r2 != nil {
requestURI = redirect.To
r = r2
}
default:
w.Header().Set("Content-Type", "")
http.Redirect(w, r, redirect.To, redirect.Status)
return
}
}
}
}
if f.c.fastRenderMode && f.c.errState.buildErr() == nil {
if strings.HasSuffix(requestURI, "/") || strings.HasSuffix(requestURI, "html") || strings.HasSuffix(requestURI, "htm") {
if isNavigation(requestURI, r) {
if !f.c.visitedURLs.Contains(requestURI) {
// If not already on stack, re-render that single page.
if err := f.c.partialReRender(requestURI); err != nil {
@ -448,6 +455,7 @@ type serverCommand struct {
// Flags.
renderStaticToDisk bool
navigateToChanged bool
openBrowser bool
serverAppend bool
serverInterface string
tlsCertFile string
@ -508,7 +516,7 @@ func (c *serverCommand) Run(ctx context.Context, cd *simplecobra.Commandeer, arg
func (c *serverCommand) Init(cd *simplecobra.Commandeer) error {
cmd := cd.CobraCommand
cmd.Short = "A high performance webserver"
cmd.Short = "Start the embedded web server"
cmd.Long = `Hugo provides its own webserver which builds and serves the site.
While hugo server is high performance, it is a webserver with limited options.
@ -538,7 +546,8 @@ of a second, you will be able to save and see your changes nearly instantly.`
cmd.Flags().BoolVar(&c.noHTTPCache, "noHTTPCache", false, "prevent HTTP caching")
cmd.Flags().BoolVarP(&c.serverAppend, "appendPort", "", true, "append port to baseURL")
cmd.Flags().BoolVar(&c.disableLiveReload, "disableLiveReload", false, "watch without enabling live browser reload on rebuild")
cmd.Flags().BoolVar(&c.navigateToChanged, "navigateToChanged", false, "navigate to changed content file on live browser reload")
cmd.Flags().BoolVarP(&c.navigateToChanged, "navigateToChanged", "N", false, "navigate to changed content file on live browser reload")
cmd.Flags().BoolVarP(&c.openBrowser, "openBrowser", "O", false, "open the site in a browser after server startup")
cmd.Flags().BoolVar(&c.renderStaticToDisk, "renderStaticToDisk", false, "serve static files from disk and dynamic files from memory")
cmd.Flags().BoolVar(&c.disableFastRender, "disableFastRender", false, "enables full re-renders on changes")
cmd.Flags().BoolVar(&c.disableBrowserError, "disableBrowserError", false, "do not show build errors in the browser")
@ -618,7 +627,7 @@ func (c *serverCommand) setServerInfoInConfig() error {
panic("no server ports set")
}
return c.withConfE(func(conf *commonConfig) error {
for i, language := range conf.configs.Languages {
for i, language := range conf.configs.LanguagesDefaultFirst {
isMultihost := conf.configs.IsMultihost
var serverPort int
if isMultihost {
@ -648,9 +657,8 @@ func (c *serverCommand) setServerInfoInConfig() error {
}
func (c *serverCommand) getErrorWithContext() any {
errCount := c.errCount()
if errCount == 0 {
buildErr := c.errState.buildErr()
if buildErr == nil {
return nil
}
@ -659,7 +667,7 @@ func (c *serverCommand) getErrorWithContext() any {
m["Error"] = cleanErrorLog(c.r.logger.Errors())
m["Version"] = hugo.BuildVersionString()
ferrors := herrors.UnwrapFileErrorsWithErrorContext(c.errState.buildErr())
ferrors := herrors.UnwrapFileErrorsWithErrorContext(buildErr)
m["Files"] = ferrors
return m
@ -750,7 +758,7 @@ func (c *serverCommand) createServerPorts(cd *simplecobra.Commandeer) error {
c.serverPorts = make([]serverPortListener, len(conf.configs.Languages))
}
currentServerPort := c.serverPort
for i := 0; i < len(c.serverPorts); i++ {
for i := range c.serverPorts {
l, err := net.Listen("tcp", net.JoinHostPort(c.serverInterface, strconv.Itoa(currentServerPort)))
if err == nil {
c.serverPorts[i] = serverPortListener{ln: l, p: currentServerPort}
@ -830,22 +838,25 @@ func (c *serverCommand) fixURL(baseURLFromConfig, baseURLFromFlag string, port i
return u.String(), nil
}
func (c *serverCommand) partialReRender(urls ...string) error {
func (c *serverCommand) partialReRender(urls ...string) (err error) {
defer func() {
c.errState.setWasErr(false)
}()
c.errState.setBuildErr(nil)
visited := types.NewEvictingStringQueue(len(urls))
visited := types.NewEvictingQueue[string](len(urls))
for _, url := range urls {
visited.Add(url)
}
h, err := c.hugo()
var h *hugolib.HugoSites
h, err = c.hugo()
if err != nil {
return err
return
}
// Note: We do not set NoBuildLock as the file lock is not acquired at this stage.
return h.Build(hugolib.BuildCfg{NoBuildLock: false, RecentlyVisited: visited, PartialReRender: true, ErrRecovery: c.errState.wasErr()})
err = h.Build(hugolib.BuildCfg{NoBuildLock: false, RecentlyTouched: visited, PartialReRender: true, ErrRecovery: c.errState.wasErr()})
return
}
func (c *serverCommand) serve() error {
@ -886,16 +897,16 @@ func (c *serverCommand) serve() error {
// To allow the en user to change the error template while the server is running, we use
// the freshest template we can provide.
var (
errTempl tpl.Template
templHandler tpl.TemplateHandler
errTempl *tplimpl.TemplInfo
templHandler *tplimpl.TemplateStore
)
getErrorTemplateAndHandler := func(h *hugolib.HugoSites) (tpl.Template, tpl.TemplateHandler) {
getErrorTemplateAndHandler := func(h *hugolib.HugoSites) (*tplimpl.TemplInfo, *tplimpl.TemplateStore) {
if h == nil {
return errTempl, templHandler
}
templHandler := h.Tmpl()
errTempl, found := templHandler.Lookup("_server/error.html")
if !found {
templHandler := h.GetTemplateStore()
errTempl := templHandler.LookupByPath("/_server/error.html")
if errTempl == nil {
panic("template server/error.html not found")
}
return errTempl, templHandler
@ -996,6 +1007,13 @@ func (c *serverCommand) serve() error {
c.r.Println("Press Ctrl+C to stop")
if c.openBrowser {
// There may be more than one baseURL in multihost mode, open the first.
if err := browser.OpenURL(baseURLs[0].String()); err != nil {
c.r.logger.Warnf("Failed to open browser: %s", err)
}
}
err = func() error {
for {
select {
@ -1012,10 +1030,6 @@ func (c *serverCommand) serve() error {
c.r.Println("Error:", err)
}
if h := c.hugoTry(); h != nil {
h.Close()
}
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
wg2, ctx := errgroup.WithContext(ctx)
@ -1188,16 +1202,16 @@ func partitionDynamicEvents(sourceFs *filesystems.SourceFilesystems, events []fs
return
}
func pickOneWriteOrCreatePath(events []fsnotify.Event) string {
func pickOneWriteOrCreatePath(contentTypes config.ContentTypesProvider, events []fsnotify.Event) string {
name := ""
for _, ev := range events {
if ev.Op&fsnotify.Write == fsnotify.Write || ev.Op&fsnotify.Create == fsnotify.Create {
if files.IsIndexContentFile(ev.Name) {
if contentTypes.IsIndexContentFile(ev.Name) {
return ev.Name
}
if files.IsContentFile(ev.Name) {
if contentTypes.IsContentFile(ev.Name) {
name = ev.Name
}
@ -1220,3 +1234,24 @@ func formatByteCount(b uint64) string {
return fmt.Sprintf("%.1f %cB",
float64(b)/float64(div), "kMGTPE"[exp])
}
func canRedirect(requestURIWithoutQuery string, r *http.Request) bool {
if r.Header.Get(hugoHeaderRedirect) != "" {
return false
}
return isNavigation(requestURIWithoutQuery, r)
}
// Sec-Fetch-Mode should be sent by all recent browser versions, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Sec-Fetch-Mode#navigate
// Fall back to the file extension if not set.
// The main take here is that we don't want to have CSS/JS files etc. partake in this logic.
func isNavigation(requestURIWithoutQuery string, r *http.Request) bool {
return r.Header.Get("Sec-Fetch-Mode") == "navigate" || isPropablyHTMLRequest(requestURIWithoutQuery)
}
func isPropablyHTMLRequest(requestURIWithoutQuery string) bool {
if strings.HasSuffix(requestURIWithoutQuery, "/") || strings.HasSuffix(requestURIWithoutQuery, "html") || strings.HasSuffix(requestURIWithoutQuery, "htm") {
return true
}
return !strings.Contains(requestURIWithoutQuery, ".")
}

View file

@ -117,7 +117,7 @@ func appendToInterfaceSliceFromValues(slice1, slice2 reflect.Value) ([]any, erro
tos = append(tos, nil)
continue
}
for i := 0; i < slice.Len(); i++ {
for i := range slice.Len() {
tos = append(tos, slice.Index(i).Interface())
}
}
@ -128,7 +128,7 @@ func appendToInterfaceSliceFromValues(slice1, slice2 reflect.Value) ([]any, erro
func appendToInterfaceSlice(tov reflect.Value, from ...any) ([]any, error) {
var tos []any
for i := 0; i < tov.Len(); i++ {
for i := range tov.Len() {
tos = append(tos, tov.Index(i).Interface())
}

View file

@ -15,6 +15,7 @@ package collections
import (
"html/template"
"reflect"
"testing"
qt "github.com/frankban/quicktest"
@ -77,6 +78,7 @@ func TestAppend(t *testing.T) {
{[]string{"a", "b"}, []any{nil}, []any{"a", "b", nil}},
{[]string{"a", "b"}, []any{nil, "d", nil}, []any{"a", "b", nil, "d", nil}},
{[]any{"a", nil, "c"}, []any{"d", nil, "f"}, []any{"a", nil, "c", "d", nil, "f"}},
{[]string{"a", "b"}, []any{}, []string{"a", "b"}},
} {
result, err := Append(test.start, test.addend...)
@ -146,3 +148,66 @@ func TestAppendShouldMakeACopyOfTheInputSlice(t *testing.T) {
c.Assert(result, qt.DeepEquals, []string{"a", "b", "c"})
c.Assert(slice, qt.DeepEquals, []string{"d", "b"})
}
func TestIndirect(t *testing.T) {
t.Parallel()
c := qt.New(t)
type testStruct struct {
Field string
}
var (
nilPtr *testStruct
nilIface interface{} = nil
nonNilIface interface{} = &testStruct{Field: "hello"}
)
tests := []struct {
name string
input any
wantKind reflect.Kind
wantNil bool
}{
{
name: "nil pointer",
input: nilPtr,
wantKind: reflect.Ptr,
wantNil: true,
},
{
name: "nil interface",
input: nilIface,
wantKind: reflect.Invalid,
wantNil: false,
},
{
name: "non-nil pointer to struct",
input: &testStruct{Field: "abc"},
wantKind: reflect.Struct,
wantNil: false,
},
{
name: "non-nil interface holding pointer",
input: nonNilIface,
wantKind: reflect.Struct,
wantNil: false,
},
{
name: "plain value",
input: testStruct{Field: "xyz"},
wantKind: reflect.Struct,
wantNil: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
v := reflect.ValueOf(tt.input)
got, isNil := indirect(v)
c.Assert(got.Kind(), qt.Equals, tt.wantKind)
c.Assert(isNil, qt.Equals, tt.wantNil)
})
}
}

View file

@ -136,3 +136,37 @@ func TestSortedStringSlice(t *testing.T) {
c.Assert(s.Count("z"), qt.Equals, 0)
c.Assert(s.Count("a"), qt.Equals, 1)
}
func TestStringSliceToInterfaceSlice(t *testing.T) {
t.Parallel()
c := qt.New(t)
tests := []struct {
name string
in []string
want []any
}{
{
name: "empty slice",
in: []string{},
want: []any{},
},
{
name: "single element",
in: []string{"hello"},
want: []any{"hello"},
},
{
name: "multiple elements",
in: []string{"a", "b", "c"},
want: []any{"a", "b", "c"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := StringSliceToInterfaceSlice(tt.in)
c.Assert(got, qt.DeepEquals, tt.want)
})
}
}

View file

@ -13,6 +13,8 @@
package collections
import "slices"
import "sync"
// Stack is a simple LIFO stack that is safe for concurrent use.
@ -65,3 +67,16 @@ func (s *Stack[T]) Drain() []T {
s.items = nil
return items
}
func (s *Stack[T]) DrainMatching(predicate func(T) bool) []T {
s.mu.Lock()
defer s.mu.Unlock()
var items []T
for i := len(s.items) - 1; i >= 0; i-- {
if predicate(s.items[i]) {
items = append(items, s.items[i])
s.items = slices.Delete(s.items, i, i+1)
}
}
return items
}

View file

@ -0,0 +1,77 @@
package collections
import (
"testing"
qt "github.com/frankban/quicktest"
)
func TestNewStack(t *testing.T) {
t.Parallel()
c := qt.New(t)
s := NewStack[int]()
c.Assert(s, qt.IsNotNil)
}
func TestStackBasic(t *testing.T) {
t.Parallel()
c := qt.New(t)
s := NewStack[int]()
c.Assert(s.Len(), qt.Equals, 0)
s.Push(1)
s.Push(2)
s.Push(3)
c.Assert(s.Len(), qt.Equals, 3)
top, ok := s.Peek()
c.Assert(ok, qt.Equals, true)
c.Assert(top, qt.Equals, 3)
popped, ok := s.Pop()
c.Assert(ok, qt.Equals, true)
c.Assert(popped, qt.Equals, 3)
c.Assert(s.Len(), qt.Equals, 2)
_, _ = s.Pop()
_, _ = s.Pop()
_, ok = s.Pop()
c.Assert(ok, qt.Equals, false)
}
func TestStackDrain(t *testing.T) {
t.Parallel()
c := qt.New(t)
s := NewStack[string]()
s.Push("a")
s.Push("b")
got := s.Drain()
c.Assert(got, qt.DeepEquals, []string{"a", "b"})
c.Assert(s.Len(), qt.Equals, 0)
}
func TestStackDrainMatching(t *testing.T) {
t.Parallel()
c := qt.New(t)
s := NewStack[int]()
s.Push(1)
s.Push(2)
s.Push(3)
s.Push(4)
got := s.DrainMatching(func(v int) bool { return v%2 == 0 })
c.Assert(got, qt.DeepEquals, []int{4, 2})
c.Assert(s.Drain(), qt.DeepEquals, []int{1, 3})
}

View file

@ -21,6 +21,10 @@ const (
ErrRemoteGetCSV = "error-remote-getcsv"
WarnFrontMatterParamsOverrides = "warning-frontmatter-params-overrides"
WarnRenderShortcodesInHTML = "warning-rendershortcodes-in-html"
WarnGoldmarkRawHTML = "warning-goldmark-raw-html"
WarnPartialSuperfluousPrefix = "warning-partial-superfluous-prefix"
WarnHomePageIsLeafBundle = "warning-home-page-is-leaf-bundle"
)
// Field/method names with special meaning.
@ -39,7 +43,7 @@ const (
ResourceTransformationFingerprint = "fingerprint"
)
// IsResourceTransformationLinkChange returns whether the given name is a resource transformation that changes the permalink based on the content.
// IsResourceTransformationPermalinkHash returns whether the given name is a resource transformation that changes the permalink based on the content.
func IsResourceTransformationPermalinkHash(name string) bool {
return name == ResourceTransformationFingerprint
}

194
common/hashing/hashing.go Normal file
View file

@ -0,0 +1,194 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Package hashing provides common hashing utilities.
package hashing
import (
"crypto/md5"
"encoding/hex"
"io"
"strconv"
"sync"
"github.com/cespare/xxhash/v2"
"github.com/gohugoio/hashstructure"
"github.com/gohugoio/hugo/identity"
)
// XXHashFromReader calculates the xxHash for the given reader.
func XXHashFromReader(r io.Reader) (uint64, int64, error) {
h := getXxHashReadFrom()
defer putXxHashReadFrom(h)
size, err := io.Copy(h, r)
if err != nil {
return 0, 0, err
}
return h.Sum64(), size, nil
}
// XxHashFromReaderHexEncoded calculates the xxHash for the given reader
// and returns the hash as a hex encoded string.
func XxHashFromReaderHexEncoded(r io.Reader) (string, error) {
h := getXxHashReadFrom()
defer putXxHashReadFrom(h)
_, err := io.Copy(h, r)
if err != nil {
return "", err
}
hash := h.Sum(nil)
return hex.EncodeToString(hash), nil
}
// XXHashFromString calculates the xxHash for the given string.
func XXHashFromString(s string) (uint64, error) {
h := xxhash.New()
h.WriteString(s)
return h.Sum64(), nil
}
// XxHashFromStringHexEncoded calculates the xxHash for the given string
// and returns the hash as a hex encoded string.
func XxHashFromStringHexEncoded(f string) string {
h := xxhash.New()
h.WriteString(f)
hash := h.Sum(nil)
return hex.EncodeToString(hash)
}
// MD5FromStringHexEncoded returns the MD5 hash of the given string.
func MD5FromStringHexEncoded(f string) string {
h := md5.New()
h.Write([]byte(f))
return hex.EncodeToString(h.Sum(nil))
}
// HashString returns a hash from the given elements.
// It will panic if the hash cannot be calculated.
// Note that this hash should be used primarily for identity, not for change detection as
// it in the more complex values (e.g. Page) will not hash the full content.
func HashString(vs ...any) string {
hash := HashUint64(vs...)
return strconv.FormatUint(hash, 10)
}
// HashStringHex returns a hash from the given elements as a hex encoded string.
// See HashString for more information.
func HashStringHex(vs ...any) string {
hash := HashUint64(vs...)
return strconv.FormatUint(hash, 16)
}
var hashOptsPool = sync.Pool{
New: func() any {
return &hashstructure.HashOptions{
Hasher: xxhash.New(),
}
},
}
func getHashOpts() *hashstructure.HashOptions {
return hashOptsPool.Get().(*hashstructure.HashOptions)
}
func putHashOpts(opts *hashstructure.HashOptions) {
opts.Hasher.Reset()
hashOptsPool.Put(opts)
}
// HashUint64 returns a hash from the given elements.
// It will panic if the hash cannot be calculated.
// Note that this hash should be used primarily for identity, not for change detection as
// it in the more complex values (e.g. Page) will not hash the full content.
func HashUint64(vs ...any) uint64 {
var o any
if len(vs) == 1 {
o = toHashable(vs[0])
} else {
elements := make([]any, len(vs))
for i, e := range vs {
elements[i] = toHashable(e)
}
o = elements
}
hash, err := Hash(o)
if err != nil {
panic(err)
}
return hash
}
// Hash returns a hash from vs.
func Hash(vs ...any) (uint64, error) {
hashOpts := getHashOpts()
defer putHashOpts(hashOpts)
var v any = vs
if len(vs) == 1 {
v = vs[0]
}
return hashstructure.Hash(v, hashOpts)
}
type keyer interface {
Key() string
}
// For structs, hashstructure.Hash only works on the exported fields,
// so rewrite the input slice for known identity types.
func toHashable(v any) any {
switch t := v.(type) {
case keyer:
return t.Key()
case identity.IdentityProvider:
return t.GetIdentity()
default:
return v
}
}
type xxhashReadFrom struct {
buff []byte
*xxhash.Digest
}
func (x *xxhashReadFrom) ReadFrom(r io.Reader) (int64, error) {
for {
n, err := r.Read(x.buff)
if n > 0 {
x.Digest.Write(x.buff[:n])
}
if err != nil {
if err == io.EOF {
err = nil
}
return int64(n), err
}
}
}
var xXhashReadFromPool = sync.Pool{
New: func() any {
return &xxhashReadFrom{Digest: xxhash.New(), buff: make([]byte, 48*1024)}
},
}
func getXxHashReadFrom() *xxhashReadFrom {
return xXhashReadFromPool.Get().(*xxhashReadFrom)
}
func putXxHashReadFrom(h *xxhashReadFrom) {
h.Reset()
xXhashReadFromPool.Put(h)
}

View file

@ -0,0 +1,157 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package hashing
import (
"fmt"
"math"
"strings"
"sync"
"testing"
qt "github.com/frankban/quicktest"
)
func TestXxHashFromReader(t *testing.T) {
c := qt.New(t)
s := "Hello World"
r := strings.NewReader(s)
got, size, err := XXHashFromReader(r)
c.Assert(err, qt.IsNil)
c.Assert(size, qt.Equals, int64(len(s)))
c.Assert(got, qt.Equals, uint64(7148569436472236994))
}
func TestXxHashFromReaderPara(t *testing.T) {
c := qt.New(t)
var wg sync.WaitGroup
for i := range 10 {
i := i
wg.Add(1)
go func() {
defer wg.Done()
for j := range 100 {
s := strings.Repeat("Hello ", i+j+1*42)
r := strings.NewReader(s)
got, size, err := XXHashFromReader(r)
c.Assert(size, qt.Equals, int64(len(s)))
c.Assert(err, qt.IsNil)
expect, _ := XXHashFromString(s)
c.Assert(got, qt.Equals, expect)
}
}()
}
wg.Wait()
}
func TestXxHashFromString(t *testing.T) {
c := qt.New(t)
s := "Hello World"
got, err := XXHashFromString(s)
c.Assert(err, qt.IsNil)
c.Assert(got, qt.Equals, uint64(7148569436472236994))
}
func TestXxHashFromStringHexEncoded(t *testing.T) {
c := qt.New(t)
s := "The quick brown fox jumps over the lazy dog"
got := XxHashFromStringHexEncoded(s)
// Facit: https://asecuritysite.com/encryption/xxhash?val=The%20quick%20brown%20fox%20jumps%20over%20the%20lazy%20dog
c.Assert(got, qt.Equals, "0b242d361fda71bc")
}
func BenchmarkXXHashFromReader(b *testing.B) {
r := strings.NewReader("Hello World")
b.ResetTimer()
for i := 0; i < b.N; i++ {
XXHashFromReader(r)
r.Seek(0, 0)
}
}
func BenchmarkXXHashFromString(b *testing.B) {
s := "Hello World"
b.ResetTimer()
for i := 0; i < b.N; i++ {
XXHashFromString(s)
}
}
func BenchmarkXXHashFromStringHexEncoded(b *testing.B) {
s := "The quick brown fox jumps over the lazy dog"
b.ResetTimer()
for i := 0; i < b.N; i++ {
XxHashFromStringHexEncoded(s)
}
}
func TestHashString(t *testing.T) {
c := qt.New(t)
c.Assert(HashString("a", "b"), qt.Equals, "3176555414984061461")
c.Assert(HashString("ab"), qt.Equals, "7347350983217793633")
var vals []any = []any{"a", "b", tstKeyer{"c"}}
c.Assert(HashString(vals...), qt.Equals, "4438730547989914315")
c.Assert(vals[2], qt.Equals, tstKeyer{"c"})
}
type tstKeyer struct {
key string
}
func (t tstKeyer) Key() string {
return t.key
}
func (t tstKeyer) String() string {
return "key: " + t.key
}
func BenchmarkHashString(b *testing.B) {
word := " hello "
var tests []string
for i := 1; i <= 5; i++ {
sentence := strings.Repeat(word, int(math.Pow(4, float64(i))))
tests = append(tests, sentence)
}
b.ResetTimer()
for _, test := range tests {
b.Run(fmt.Sprintf("n%d", len(test)), func(b *testing.B) {
for i := 0; i < b.N; i++ {
HashString(test)
}
})
}
}
func BenchmarkHashMap(b *testing.B) {
m := map[string]any{}
for i := range 1000 {
m[fmt.Sprintf("key%d", i)] = i
}
b.ResetTimer()
for i := 0; i < b.N; i++ {
HashString(m)
}
}

View file

@ -152,10 +152,7 @@ func locateError(r io.Reader, le FileError, matches LineMatcherFn) *ErrorContext
}
if ectx.Position.LineNumber > 0 {
low := ectx.Position.LineNumber - 3
if low < 0 {
low = 0
}
low := max(ectx.Position.LineNumber-3, 0)
if ectx.Position.LineNumber > 2 {
ectx.LinesPos = 2
@ -163,10 +160,7 @@ func locateError(r io.Reader, le FileError, matches LineMatcherFn) *ErrorContext
ectx.LinesPos = ectx.Position.LineNumber - 1
}
high := ectx.Position.LineNumber + 2
if high > len(lines) {
high = len(lines)
}
high := min(ectx.Position.LineNumber+2, len(lines))
ectx.Lines = lines[low:high]

View file

@ -68,6 +68,20 @@ func (e *TimeoutError) Is(target error) bool {
return ok
}
// errMessage wraps an error with a message.
type errMessage struct {
msg string
err error
}
func (e *errMessage) Error() string {
return e.msg
}
func (e *errMessage) Unwrap() error {
return e.err
}
// IsFeatureNotAvailableError returns true if the given error is or contains a FeatureNotAvailableError.
func IsFeatureNotAvailableError(err error) bool {
return errors.Is(err, &FeatureNotAvailableError{})
@ -119,21 +133,55 @@ func IsNotExist(err error) bool {
return false
}
// IsExist returns true if the error is a file exists error.
// Unlike os.IsExist, this also considers wrapped errors.
func IsExist(err error) bool {
if os.IsExist(err) {
return true
}
// os.IsExist does not consider wrapped errors.
if os.IsExist(errors.Unwrap(err)) {
return true
}
return false
}
var nilPointerErrRe = regexp.MustCompile(`at <(.*)>: error calling (.*?): runtime error: invalid memory address or nil pointer dereference`)
func ImproveIfNilPointer(inErr error) (outErr error) {
outErr = inErr
const deferredPrefix = "__hdeferred/"
var deferredStringToRemove = regexp.MustCompile(`executing "__hdeferred/.*?" `)
// ImproveRenderErr improves the error message for rendering errors.
func ImproveRenderErr(inErr error) (outErr error) {
outErr = inErr
msg := improveIfNilPointerMsg(inErr)
if msg != "" {
outErr = &errMessage{msg: msg, err: outErr}
}
if strings.Contains(inErr.Error(), deferredPrefix) {
msg := deferredStringToRemove.ReplaceAllString(inErr.Error(), "executing ")
outErr = &errMessage{msg: msg, err: outErr}
}
return
}
func improveIfNilPointerMsg(inErr error) string {
m := nilPointerErrRe.FindStringSubmatch(inErr.Error())
if len(m) == 0 {
return
return ""
}
call := m[1]
field := m[2]
parts := strings.Split(call, ".")
if len(parts) < 2 {
return ""
}
receiverName := parts[len(parts)-2]
receiver := strings.Join(parts[:len(parts)-1], ".")
s := fmt.Sprintf(" %s is nil; wrap it in if or with: {{ with %s }}{{ .%s }}{{ end }}", receiverName, receiver, field)
outErr = errors.New(nilPointerErrRe.ReplaceAllString(inErr.Error(), s))
return
return nilPointerErrRe.ReplaceAllString(inErr.Error(), s)
}

View file

@ -20,8 +20,6 @@ import (
"io"
"path/filepath"
godartsassv1 "github.com/bep/godartsass"
"github.com/bep/godartsass/v2"
"github.com/bep/golibsass/libsass/libsasserrors"
"github.com/gohugoio/hugo/common/paths"
@ -153,8 +151,6 @@ func (e *fileError) causeString() string {
// Avoid repeating the file info in the error message.
case godartsass.SassError:
return v.Message
case godartsassv1.SassError:
return v.Message
case libsasserrors.Error:
return v.Message
default:
@ -262,8 +258,27 @@ func openFile(filename string, fs afero.Fs) (afero.File, string, error) {
return f, realFilename, nil
}
// Cause returns the underlying error or itself if it does not implement Unwrap.
// Cause returns the underlying error, that is,
// it unwraps errors until it finds one that does not implement
// the Unwrap method.
// For a shallow variant, see Unwrap.
func Cause(err error) error {
type unwrapper interface {
Unwrap() error
}
for err != nil {
cause, ok := err.(unwrapper)
if !ok {
break
}
err = cause.Unwrap()
}
return err
}
// Unwrap returns the underlying error or itself if it does not implement Unwrap.
func Unwrap(err error) error {
if u := errors.Unwrap(err); u != nil {
return u
}
@ -271,7 +286,7 @@ func Cause(err error) error {
}
func extractFileTypePos(err error) (string, text.Position) {
err = Cause(err)
err = Unwrap(err)
var fileType string
@ -388,14 +403,7 @@ func extractPosition(e error) (pos text.Position) {
case godartsass.SassError:
span := v.Span
start := span.Start
filename, _ := paths.UrlToFilename(span.Url)
pos.Filename = filename
pos.Offset = start.Offset
pos.ColumnNumber = start.Column
case godartsassv1.SassError:
span := v.Span
start := span.Start
filename, _ := paths.UrlToFilename(span.Url)
filename, _ := paths.UrlStringToFilename(span.Url)
pos.Filename = filename
pos.Offset = start.Offset
pos.ColumnNumber = start.Column

View file

@ -21,10 +21,14 @@ import (
"io"
"os"
"os/exec"
"path/filepath"
"regexp"
"strings"
"sync"
"github.com/cli/safeexec"
"github.com/bep/logg"
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/config"
"github.com/gohugoio/hugo/config/security"
)
@ -84,7 +88,7 @@ var WithEnviron = func(env []string) func(c *commandeer) {
}
// New creates a new Exec using the provided security config.
func New(cfg security.Config) *Exec {
func New(cfg security.Config, workingDir string, log loggers.Logger) *Exec {
var baseEnviron []string
for _, v := range os.Environ() {
k, _ := config.SplitEnvVar(v)
@ -94,8 +98,11 @@ func New(cfg security.Config) *Exec {
}
return &Exec{
sc: cfg,
baseEnviron: baseEnviron,
sc: cfg,
workingDir: workingDir,
infol: log.InfoCommand("exec"),
baseEnviron: baseEnviron,
newNPXRunnerCache: maps.NewCache[string, func(arg ...any) (Runner, error)](),
}
}
@ -105,29 +112,27 @@ func IsNotFound(err error) bool {
return errors.As(err, &notFoundErr)
}
// SafeCommand is a wrapper around os/exec Command which uses a LookPath
// implementation that does not search in current directory before looking in PATH.
// See https://github.com/cli/safeexec and the linked issues.
func SafeCommand(name string, arg ...string) (*exec.Cmd, error) {
bin, err := safeexec.LookPath(name)
if err != nil {
return nil, err
}
return exec.Command(bin, arg...), nil
}
// Exec enforces a security policy for commands run via os/exec.
type Exec struct {
sc security.Config
sc security.Config
workingDir string
infol logg.LevelLogger
// os.Environ filtered by the Exec.OsEnviron whitelist filter.
baseEnviron []string
newNPXRunnerCache *maps.Cache[string, func(arg ...any) (Runner, error)]
npxInit sync.Once
npxAvailable bool
}
func (e *Exec) New(name string, arg ...any) (Runner, error) {
return e.new(name, "", arg...)
}
// New will fail if name is not allowed according to the configured security policy.
// Else a configured Runner will be returned ready to be Run.
func (e *Exec) New(name string, arg ...any) (Runner, error) {
func (e *Exec) new(name string, fullyQualifiedName string, arg ...any) (Runner, error) {
if err := e.sc.CheckAllowedExec(name); err != nil {
return nil, err
}
@ -136,17 +141,112 @@ func (e *Exec) New(name string, arg ...any) (Runner, error) {
copy(env, e.baseEnviron)
cm := &commandeer{
name: name,
env: env,
name: name,
fullyQualifiedName: fullyQualifiedName,
env: env,
}
return cm.command(arg...)
}
// Npx is a convenience method to create a Runner running npx --no-install <name> <args.
type binaryLocation int
func (b binaryLocation) String() string {
switch b {
case binaryLocationNodeModules:
return "node_modules/.bin"
case binaryLocationNpx:
return "npx"
case binaryLocationPath:
return "PATH"
}
return "unknown"
}
const (
binaryLocationNodeModules binaryLocation = iota + 1
binaryLocationNpx
binaryLocationPath
)
// Npx will in order:
// 1. Try fo find the binary in the WORKINGDIR/node_modules/.bin directory.
// 2. If not found, and npx is available, run npx --no-install <name> <args>.
// 3. Fall back to the PATH.
// If name is "tailwindcss", we will try the PATH as the second option.
func (e *Exec) Npx(name string, arg ...any) (Runner, error) {
arg = append(arg[:0], append([]any{"--no-install", name}, arg[0:]...)...)
return e.New("npx", arg...)
if err := e.sc.CheckAllowedExec(name); err != nil {
return nil, err
}
newRunner, err := e.newNPXRunnerCache.GetOrCreate(name, func() (func(...any) (Runner, error), error) {
type tryFunc func() func(...any) (Runner, error)
tryFuncs := map[binaryLocation]tryFunc{
binaryLocationNodeModules: func() func(...any) (Runner, error) {
nodeBinFilename := filepath.Join(e.workingDir, nodeModulesBinPath, name)
_, err := exec.LookPath(nodeBinFilename)
if err != nil {
return nil
}
return func(arg2 ...any) (Runner, error) {
return e.new(name, nodeBinFilename, arg2...)
}
},
binaryLocationNpx: func() func(...any) (Runner, error) {
e.checkNpx()
if !e.npxAvailable {
return nil
}
return func(arg2 ...any) (Runner, error) {
return e.npx(name, arg2...)
}
},
binaryLocationPath: func() func(...any) (Runner, error) {
if _, err := exec.LookPath(name); err != nil {
return nil
}
return func(arg2 ...any) (Runner, error) {
return e.New(name, arg2...)
}
},
}
locations := []binaryLocation{binaryLocationNodeModules, binaryLocationNpx, binaryLocationPath}
if name == "tailwindcss" {
// See https://github.com/gohugoio/hugo/issues/13221#issuecomment-2574801253
locations = []binaryLocation{binaryLocationNodeModules, binaryLocationPath, binaryLocationNpx}
}
for _, loc := range locations {
if f := tryFuncs[loc](); f != nil {
e.infol.Logf("resolve %q using %s", name, loc)
return f, nil
}
}
return nil, &NotFoundError{name: name, method: fmt.Sprintf("in %s", locations[len(locations)-1])}
})
if err != nil {
return nil, err
}
return newRunner(arg...)
}
const (
npxNoInstall = "--no-install"
npxBinary = "npx"
nodeModulesBinPath = "node_modules/.bin"
)
func (e *Exec) checkNpx() {
e.npxInit.Do(func() {
e.npxAvailable = InPath(npxBinary)
})
}
// npx is a convenience method to create a Runner running npx --no-install <name> <args.
func (e *Exec) npx(name string, arg ...any) (Runner, error) {
arg = append(arg[:0], append([]any{npxNoInstall, name}, arg[0:]...)...)
return e.New(npxBinary, arg...)
}
// Sec returns the security policies this Exec is configured with.
@ -155,11 +255,12 @@ func (e *Exec) Sec() security.Config {
}
type NotFoundError struct {
name string
name string
method string
}
func (e *NotFoundError) Error() string {
return fmt.Sprintf("binary with name %q not found", e.name)
return fmt.Sprintf("binary with name %q not found %s", e.name, e.method)
}
// Runner wraps a *os.Cmd.
@ -182,8 +283,14 @@ func (c *cmdWrapper) Run() error {
if err == nil {
return nil
}
name := c.name
method := "in PATH"
if name == npxBinary {
name = c.c.Args[2]
method = "using npx"
}
if notFoundRe.MatchString(c.outerr.String()) {
return &NotFoundError{name: c.name}
return &NotFoundError{name: name, method: method}
}
return fmt.Errorf("failed to execute binary %q with args %v: %s", c.name, c.c.Args[1:], c.outerr.String())
}
@ -199,8 +306,9 @@ type commandeer struct {
dir string
ctx context.Context
name string
env []string
name string
fullyQualifiedName string
env []string
}
func (c *commandeer) command(arg ...any) (*cmdWrapper, error) {
@ -220,10 +328,17 @@ func (c *commandeer) command(arg ...any) (*cmdWrapper, error) {
}
}
bin, err := safeexec.LookPath(c.name)
if err != nil {
return nil, &NotFoundError{
name: c.name,
var bin string
if c.fullyQualifiedName != "" {
bin = c.fullyQualifiedName
} else {
var err error
bin, err = exec.LookPath(c.name)
if err != nil {
return nil, &NotFoundError{
name: c.name,
method: "in PATH",
}
}
}
@ -256,7 +371,7 @@ func InPath(binaryName string) bool {
if strings.Contains(binaryName, "/") {
panic("binary name should not contain any slash")
}
_, err := safeexec.LookPath(binaryName)
_, err := exec.LookPath(binaryName)
return err == nil
}
@ -266,7 +381,7 @@ func LookPath(binaryName string) string {
if strings.Contains(binaryName, "/") {
panic("binary name should not contain any slash")
}
s, err := safeexec.LookPath(binaryName)
s, err := exec.LookPath(binaryName)
if err != nil {
return ""
}

View file

@ -74,6 +74,16 @@ func IsTruthful(in any) bool {
}
}
// IsMap reports whether v is a map.
func IsMap(v any) bool {
return reflect.ValueOf(v).Kind() == reflect.Map
}
// IsSlice reports whether v is a slice.
func IsSlice(v any) bool {
return reflect.ValueOf(v).Kind() == reflect.Slice
}
var zeroType = reflect.TypeOf((*types.Zeroer)(nil)).Elem()
// IsTruthfulValue returns whether the given value has a meaningful truth value.
@ -124,12 +134,7 @@ type methodKey struct {
name string
}
type methods struct {
sync.RWMutex
cache map[methodKey]int
}
var methodCache = &methods{cache: make(map[methodKey]int)}
var methodCache sync.Map
// GetMethodByName is the same as reflect.Value.MethodByName, but it caches the
// type lookup.
@ -147,22 +152,16 @@ func GetMethodByName(v reflect.Value, name string) reflect.Value {
// -1 if no such method exists.
func GetMethodIndexByName(tp reflect.Type, name string) int {
k := methodKey{tp, name}
methodCache.RLock()
index, found := methodCache.cache[k]
methodCache.RUnlock()
v, found := methodCache.Load(k)
if found {
return index
return v.(int)
}
methodCache.Lock()
defer methodCache.Unlock()
m, ok := tp.MethodByName(name)
index = m.Index
index := m.Index
if !ok {
index = -1
}
methodCache.cache[k] = index
methodCache.Store(k, index)
if !ok {
return -1
@ -223,6 +222,27 @@ func AsTime(v reflect.Value, loc *time.Location) (time.Time, bool) {
return time.Time{}, false
}
// ToSliceAny converts the given value to a slice of any if possible.
func ToSliceAny(v any) ([]any, bool) {
if v == nil {
return nil, false
}
switch vv := v.(type) {
case []any:
return vv, true
default:
vvv := reflect.ValueOf(v)
if vvv.Kind() == reflect.Slice {
out := make([]any, vvv.Len())
for i := range vvv.Len() {
out[i] = vvv.Index(i).Interface()
}
return out, true
}
}
return nil, false
}
func CallMethodByName(cxt context.Context, name string, v reflect.Value) []reflect.Value {
fn := v.MethodByName(name)
var args []reflect.Value
@ -268,7 +288,8 @@ func IsContextType(tp reflect.Type) bool {
return true
}
return isContextCache.GetOrCreate(tp, func() bool {
return tp.Implements(contextInterface)
isContext, _ := isContextCache.GetOrCreate(tp, func() (bool, error) {
return tp.Implements(contextInterface), nil
})
return isContext
}

View file

@ -50,6 +50,19 @@ func TestIsContextType(t *testing.T) {
c.Assert(IsContextType(reflect.TypeOf(valueCtx)), qt.IsTrue)
}
func TestToSliceAny(t *testing.T) {
c := qt.New(t)
checkOK := func(in any, expected []any) {
out, ok := ToSliceAny(in)
c.Assert(ok, qt.Equals, true)
c.Assert(out, qt.DeepEquals, expected)
}
checkOK([]any{1, 2, 3}, []any{1, 2, 3})
checkOK([]int{1, 2, 3}, []any{1, 2, 3})
}
func BenchmarkIsContextType(b *testing.B) {
type k string
b.Run("value", func(b *testing.B) {
@ -121,3 +134,17 @@ func BenchmarkGetMethodByName(b *testing.B) {
}
}
}
func BenchmarkGetMethodByNamePara(b *testing.B) {
v := reflect.ValueOf(&testStruct{})
methods := []string{"Method1", "Method2", "Method3", "Method4", "Method5"}
b.ResetTimer()
b.RunParallel(func(pb *testing.PB) {
for pb.Next() {
for _, method := range methods {
_ = GetMethodByName(v, method)
}
}
})
}

View file

@ -16,6 +16,7 @@ package hstrings
import (
"fmt"
"regexp"
"slices"
"strings"
"sync"
@ -50,12 +51,7 @@ func (s StringEqualFold) Eq(s2 any) bool {
// EqualAny returns whether a string is equal to any of the given strings.
func EqualAny(a string, b ...string) bool {
for _, s := range b {
if a == s {
return true
}
}
return false
return slices.Contains(b, a)
}
// regexpCache represents a cache of regexp objects protected by a mutex.
@ -103,12 +99,7 @@ func GetOrCompileRegexp(pattern string) (re *regexp.Regexp, err error) {
// InSlice checks if a string is an element of a slice of strings
// and returns a boolean value.
func InSlice(arr []string, el string) bool {
for _, v := range arr {
if v == el {
return true
}
}
return false
return slices.Contains(arr, el)
}
// InSlicEqualFold checks if a string is an element of a slice of strings
@ -137,7 +128,7 @@ func ToString(v any) (string, bool) {
return "", false
}
type Tuple struct {
First string
Second string
}
type (
Strings2 [2]string
Strings3 [3]string
)

View file

@ -17,24 +17,35 @@ import (
"bytes"
)
// HasBytesWriter is a writer that will set Match to true if the given pattern
// is found in the stream.
// HasBytesWriter is a writer will match against a slice of patterns.
type HasBytesWriter struct {
Match bool
Pattern []byte
Patterns []*HasBytesPattern
i int
done bool
buff []byte
}
type HasBytesPattern struct {
Match bool
Pattern []byte
}
func (h *HasBytesWriter) patternLen() int {
l := 0
for _, p := range h.Patterns {
l += len(p.Pattern)
}
return l
}
func (h *HasBytesWriter) Write(p []byte) (n int, err error) {
if h.done {
return len(p), nil
}
if len(h.buff) == 0 {
h.buff = make([]byte, len(h.Pattern)*2)
h.buff = make([]byte, h.patternLen()*2)
}
for i := range p {
@ -46,11 +57,23 @@ func (h *HasBytesWriter) Write(p []byte) (n int, err error) {
h.i = len(h.buff) / 2
}
if bytes.Contains(h.buff, h.Pattern) {
h.Match = true
h.done = true
return len(p), nil
for _, pp := range h.Patterns {
if bytes.Contains(h.buff, pp.Pattern) {
pp.Match = true
done := true
for _, ppp := range h.Patterns {
if !ppp.Match {
done = false
break
}
}
if done {
h.done = true
}
return len(p), nil
}
}
}
return len(p), nil

View file

@ -34,8 +34,11 @@ func TestHasBytesWriter(t *testing.T) {
var b bytes.Buffer
h := &HasBytesWriter{
Pattern: []byte("__foo"),
Patterns: []*HasBytesPattern{
{Pattern: []byte("__foo")},
},
}
return h, io.MultiWriter(&b, h)
}
@ -43,22 +46,22 @@ func TestHasBytesWriter(t *testing.T) {
return strings.Repeat("ab cfo", r.Intn(33))
}
for i := 0; i < 22; i++ {
for range 22 {
h, w := neww()
fmt.Fprintf(w, rndStr()+"abc __foobar"+rndStr())
c.Assert(h.Match, qt.Equals, true)
fmt.Fprint(w, rndStr()+"abc __foobar"+rndStr())
c.Assert(h.Patterns[0].Match, qt.Equals, true)
h, w = neww()
fmt.Fprintf(w, rndStr()+"abc __f")
fmt.Fprintf(w, "oo bar"+rndStr())
c.Assert(h.Match, qt.Equals, true)
fmt.Fprint(w, rndStr()+"abc __f")
fmt.Fprint(w, "oo bar"+rndStr())
c.Assert(h.Patterns[0].Match, qt.Equals, true)
h, w = neww()
fmt.Fprintf(w, rndStr()+"abc __moo bar")
c.Assert(h.Match, qt.Equals, false)
fmt.Fprint(w, rndStr()+"abc __moo bar")
c.Assert(h.Patterns[0].Match, qt.Equals, false)
}
h, w := neww()
fmt.Fprintf(w, "__foo")
c.Assert(h.Match, qt.Equals, true)
c.Assert(h.Patterns[0].Match, qt.Equals, true)
}

View file

@ -74,13 +74,13 @@ type StringReader interface {
ReadString() string
}
// NewReadSeekerNoOpCloserFromString uses strings.NewReader to create a new ReadSeekerNoOpCloser
// NewReadSeekerNoOpCloserFromBytes uses bytes.NewReader to create a new ReadSeekerNoOpCloser
// from the given bytes slice.
func NewReadSeekerNoOpCloserFromBytes(content []byte) readSeekerNopCloser {
return readSeekerNopCloser{bytes.NewReader(content)}
}
// NewReadSeekCloser creates a new ReadSeekCloser from the given ReadSeeker.
// NewOpenReadSeekCloser creates a new ReadSeekCloser from the given ReadSeeker.
// The ReadSeeker will be seeked to the beginning before returned.
func NewOpenReadSeekCloser(r ReadSeekCloser) OpenReadSeekCloser {
return func() (ReadSeekCloser, error) {

View file

@ -81,3 +81,33 @@ func ToReadCloser(r io.Reader) io.ReadCloser {
io.NopCloser(nil),
}
}
type ReadWriteCloser interface {
io.Reader
io.Writer
io.Closer
}
// PipeReadWriteCloser is a convenience type to create a pipe with a ReadCloser and a WriteCloser.
type PipeReadWriteCloser struct {
*io.PipeReader
*io.PipeWriter
}
// NewPipeReadWriteCloser creates a new PipeReadWriteCloser.
func NewPipeReadWriteCloser() PipeReadWriteCloser {
pr, pw := io.Pipe()
return PipeReadWriteCloser{pr, pw}
}
func (c PipeReadWriteCloser) Close() (err error) {
if err = c.PipeReader.Close(); err != nil {
return
}
err = c.PipeWriter.Close()
return
}
func (c PipeReadWriteCloser) WriteString(s string) (int, error) {
return c.PipeWriter.Write([]byte(s))
}

View file

@ -14,6 +14,7 @@
package hugo
import (
"context"
"fmt"
"html/template"
"os"
@ -24,13 +25,13 @@ import (
"sync"
"time"
godartsassv1 "github.com/bep/godartsass"
"github.com/bep/logg"
"github.com/mitchellh/mapstructure"
"github.com/bep/godartsass/v2"
"github.com/gohugoio/hugo/common/hcontext"
"github.com/gohugoio/hugo/common/hexec"
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/common/maps"
"github.com/gohugoio/hugo/hugofs/files"
"github.com/spf13/afero"
@ -53,6 +54,8 @@ var (
vendorInfo string
)
var _ maps.StoreProvider = (*HugoInfo)(nil)
// HugoInfo contains information about the current Hugo environment
type HugoInfo struct {
CommitHash string
@ -69,6 +72,11 @@ type HugoInfo struct {
conf ConfigProvider
deps []*Dependency
store *maps.Scratch
// Context gives access to some of the context scoped variables.
Context Context
}
// Version returns the current version as a comparable version string.
@ -111,6 +119,10 @@ func (i HugoInfo) Deps() []*Dependency {
return i.deps
}
func (i HugoInfo) Store() *maps.Scratch {
return i.store
}
// Deprecated: Use hugo.IsMultihost instead.
func (i HugoInfo) IsMultiHost() bool {
Deprecate("hugo.IsMultiHost", "Use hugo.IsMultihost instead.", "v0.124.0")
@ -127,6 +139,30 @@ func (i HugoInfo) IsMultilingual() bool {
return i.conf.IsMultilingual()
}
type contextKey uint8
const (
contextKeyMarkupScope contextKey = iota
)
var markupScope = hcontext.NewContextDispatcher[string](contextKeyMarkupScope)
type Context struct{}
func (c Context) MarkupScope(ctx context.Context) string {
return GetMarkupScope(ctx)
}
// SetMarkupScope sets the markup scope in the context.
func SetMarkupScope(ctx context.Context, s string) context.Context {
return markupScope.Set(ctx, s)
}
// GetMarkupScope gets the markup scope from the context.
func GetMarkupScope(ctx context.Context) string {
return markupScope.Get(ctx)
}
// ConfigProvider represents the config options that are relevant for HugoInfo.
type ConfigProvider interface {
Environment() string
@ -160,6 +196,7 @@ func NewInfo(conf ConfigProvider, deps []*Dependency) HugoInfo {
Environment: conf.Environment(),
conf: conf,
deps: deps,
store: maps.NewScratch(),
GoVersion: goVersion,
}
}
@ -276,14 +313,14 @@ func GetDependencyListNonGo() []string {
if IsExtended {
deps = append(
deps,
formatDep("github.com/sass/libsass", "3.6.5"),
formatDep("github.com/sass/libsass", "3.6.6"),
formatDep("github.com/webmproject/libwebp", "v1.3.2"),
)
}
if dartSass := dartSassVersion(); dartSass.ProtocolVersion != "" {
dartSassPath := "github.com/sass/dart-sass-embedded"
if IsDartSassV2() {
if IsDartSassGeV2() {
dartSassPath = "github.com/sass/dart-sass"
}
deps = append(deps,
@ -330,22 +367,15 @@ type Dependency struct {
}
func dartSassVersion() godartsass.DartSassVersion {
if DartSassBinaryName == "" {
if DartSassBinaryName == "" || !IsDartSassGeV2() {
return godartsass.DartSassVersion{}
}
if IsDartSassV2() {
v, _ := godartsass.Version(DartSassBinaryName)
return v
}
v, _ := godartsassv1.Version(DartSassBinaryName)
var vv godartsass.DartSassVersion
mapstructure.WeakDecode(v, &vv)
return vv
v, _ := godartsass.Version(DartSassBinaryName)
return v
}
// DartSassBinaryName is the name of the Dart Sass binary to use.
// TODO(beop) find a better place for this.
// TODO(bep) find a better place for this.
var DartSassBinaryName string
func init() {
@ -370,7 +400,10 @@ var (
dartSassBinaryNamesV2 = []string{"dart-sass", "sass"}
)
func IsDartSassV2() bool {
// TODO(bep) we eventually want to remove this, but keep it for a while to throw an informative error.
// We stopped supporting the old binary in Hugo 0.139.0.
func IsDartSassGeV2() bool {
// dart-sass-embedded was the first version of the embedded Dart Sass before it was moved into the main project.
return !strings.Contains(DartSassBinaryName, "embedded")
}
@ -382,22 +415,39 @@ func IsDartSassV2() bool {
// 2. Their theme to work for at least the last few Hugo versions.
func Deprecate(item, alternative string, version string) {
level := deprecationLogLevelFromVersion(version)
DeprecateLevel(item, alternative, version, level)
deprecateLevel(item, alternative, version, level)
}
// See Deprecate for details.
func DeprecateWithLogger(item, alternative string, version string, log logg.Logger) {
level := deprecationLogLevelFromVersion(version)
deprecateLevelWithLogger(item, alternative, version, level, log)
}
// DeprecateLevelMin informs about a deprecation starting at the given version, but with a minimum log level.
func DeprecateLevelMin(item, alternative string, version string, minLevel logg.Level) {
level := max(deprecationLogLevelFromVersion(version), minLevel)
deprecateLevel(item, alternative, version, level)
}
// deprecateLevel informs about a deprecation logging at the given level.
func deprecateLevel(item, alternative, version string, level logg.Level) {
deprecateLevelWithLogger(item, alternative, version, level, loggers.Log().Logger())
}
// DeprecateLevel informs about a deprecation logging at the given level.
func DeprecateLevel(item, alternative, version string, level logg.Level) {
func deprecateLevelWithLogger(item, alternative, version string, level logg.Level, log logg.Logger) {
var msg string
if level == logg.LevelError {
msg = fmt.Sprintf("%s was deprecated in Hugo %s and will be removed in Hugo %s. %s", item, version, CurrentVersion.Next().ReleaseVersion(), alternative)
msg = fmt.Sprintf("%s was deprecated in Hugo %s and subsequently removed. %s", item, version, alternative)
} else {
msg = fmt.Sprintf("%s was deprecated in Hugo %s and will be removed in a future release. %s", item, version, alternative)
}
loggers.Log().Logger().WithLevel(level).WithField(loggers.FieldNameCmd, "deprecated").Logf(msg)
log.WithLevel(level).WithField(loggers.FieldNameCmd, "deprecated").Logf("%s", msg)
}
// We ususally do about one minor version a month.
// We usually do about one minor version a month.
// We want people to run at least the current and previous version without any warnings.
// We want people who don't update Hugo that often to see the warnings and errors before we remove the feature.
func deprecationLogLevelFromVersion(ver string) logg.Level {
@ -405,11 +455,11 @@ func deprecationLogLevelFromVersion(ver string) logg.Level {
to := CurrentVersion
minorDiff := to.Minor - from.Minor
switch {
case minorDiff >= 12:
// Start failing the build after about a year.
case minorDiff >= 15:
// Start failing the build after about 15 months.
return logg.LevelError
case minorDiff >= 6:
// Start printing warnings after about six months.
case minorDiff >= 3:
// Start printing warnings after about 3 months.
return logg.LevelWarn
default:
return logg.LevelInfo

View file

@ -14,6 +14,7 @@
package hugo
import (
"context"
"fmt"
"testing"
@ -56,12 +57,29 @@ func TestDeprecationLogLevelFromVersion(t *testing.T) {
c.Assert(deprecationLogLevelFromVersion("0.55.0"), qt.Equals, logg.LevelError)
ver := CurrentVersion
c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelInfo)
ver.Minor -= 1
c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelInfo)
ver.Minor -= 6
ver.Minor -= 3
c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelWarn)
ver.Minor -= 6
ver.Minor -= 4
c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelWarn)
ver.Minor -= 13
c.Assert(deprecationLogLevelFromVersion(ver.String()), qt.Equals, logg.LevelError)
// Added just to find the threshold for where we can remove deprecated items.
// Subtract 5 from the minor version of the first ERRORed version => 0.122.0.
c.Assert(deprecationLogLevelFromVersion("0.127.0"), qt.Equals, logg.LevelError)
}
func TestMarkupScope(t *testing.T) {
c := qt.New(t)
conf := testConfig{environment: "production", workingDir: "/mywork", running: false}
info := NewInfo(conf, nil)
ctx := context.Background()
ctx = SetMarkupScope(ctx, "foo")
c.Assert(info.Context.MarkupScope(ctx), qt.Equals, "foo")
}
type testConfig struct {

View file

@ -12,7 +12,6 @@
// limitations under the License.
//go:build extended
// +build extended
package hugo

View file

@ -12,7 +12,6 @@
// limitations under the License.
//go:build !extended
// +build !extended
package hugo

View file

@ -1,4 +1,4 @@
// Copyright 2019 The Hugo Authors. All rights reserved.
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -11,4 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package tplimpl
//go:build withdeploy
package hugo
var IsWithdeploy = true

View file

@ -1,4 +1,4 @@
// Copyright 2020 The Hugo Authors. All rights reserved.
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -11,4 +11,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package js
//go:build !withdeploy
package hugo
var IsWithdeploy = false

View file

@ -152,6 +152,9 @@ func BuildVersionString() string {
if IsExtended {
version += "+extended"
}
if IsWithdeploy {
version += "+withdeploy"
}
osArch := bi.GoOS + "/" + bi.GoArch

View file

@ -17,7 +17,7 @@ package hugo
// This should be the only one.
var CurrentVersion = Version{
Major: 0,
Minor: 125,
PatchLevel: 1,
Suffix: "",
Minor: 148,
PatchLevel: 0,
Suffix: "-DEV",
}

View file

@ -21,7 +21,7 @@ import (
"sync"
"github.com/bep/logg"
"github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/common/hashing"
)
// PanicOnWarningHook panics on warnings.
@ -85,7 +85,7 @@ func (h *logOnceHandler) HandleLog(e *logg.Entry) error {
}
h.mu.Lock()
defer h.mu.Unlock()
hash := identity.HashUint64(e.Level, e.Message, e.Fields)
hash := hashing.HashUint64(e.Level, e.Message, e.Fields)
if h.seen[hash] {
return errStop
}

View file

@ -18,18 +18,19 @@ package loggers
import (
"fmt"
"io"
"regexp"
"strings"
"sync"
"github.com/bep/logg"
)
// newNoColoursHandler creates a new NoColoursHandler
func newNoColoursHandler(outWriter, errWriter io.Writer, noLevelPrefix bool, predicate func(*logg.Entry) bool) *noColoursHandler {
// newNoAnsiEscapeHandler creates a new noAnsiEscapeHandler
func newNoAnsiEscapeHandler(outWriter, errWriter io.Writer, noLevelPrefix bool, predicate func(*logg.Entry) bool) *noAnsiEscapeHandler {
if predicate == nil {
predicate = func(e *logg.Entry) bool { return true }
}
return &noColoursHandler{
return &noAnsiEscapeHandler{
noLevelPrefix: noLevelPrefix,
outWriter: outWriter,
errWriter: errWriter,
@ -37,15 +38,15 @@ func newNoColoursHandler(outWriter, errWriter io.Writer, noLevelPrefix bool, pre
}
}
type noColoursHandler struct {
type noAnsiEscapeHandler struct {
mu sync.Mutex
outWriter io.Writer // Defaults to os.Stdout.
errWriter io.Writer // Defaults to os.Stderr.
outWriter io.Writer
errWriter io.Writer
predicate func(*logg.Entry) bool
noLevelPrefix bool
}
func (h *noColoursHandler) HandleLog(e *logg.Entry) error {
func (h *noAnsiEscapeHandler) HandleLog(e *logg.Entry) error {
if !h.predicate(e) {
return nil
}
@ -71,10 +72,12 @@ func (h *noColoursHandler) HandleLog(e *logg.Entry) error {
prefix = prefix + ": "
}
msg := stripANSI(e.Message)
if h.noLevelPrefix {
fmt.Fprintf(w, "%s%s", prefix, e.Message)
fmt.Fprintf(w, "%s%s", prefix, msg)
} else {
fmt.Fprintf(w, "%s %s%s", levelString[e.Level], prefix, e.Message)
fmt.Fprintf(w, "%s %s%s", levelString[e.Level], prefix, msg)
}
for _, field := range e.Fields {
@ -88,3 +91,10 @@ func (h *noColoursHandler) HandleLog(e *logg.Entry) error {
return nil
}
var ansiRe = regexp.MustCompile(`\x1b\[[0-9;]*m`)
// stripANSI removes ANSI escape codes from s.
func stripANSI(s string) string {
return ansiRe.ReplaceAllString(s, "")
}

View file

@ -0,0 +1,40 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
// Some functions in this file (see comments) is based on the Go source code,
// copyright The Go Authors and governed by a BSD-style license.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package loggers
import (
"bytes"
"testing"
"github.com/bep/logg"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/common/terminal"
)
func TestNoAnsiEscapeHandler(t *testing.T) {
c := qt.New(t)
test := func(s string) {
c.Assert(stripANSI(terminal.Notice(s)), qt.Equals, s)
}
test(`error in "file.md:1:2"`)
var buf bytes.Buffer
h := newNoAnsiEscapeHandler(&buf, &buf, false, nil)
h.HandleLog(&logg.Entry{Message: terminal.Notice(`error in "file.md:1:2"`), Level: logg.LevelInfo})
c.Assert(buf.String(), qt.Equals, "INFO error in \"file.md:1:2\"\n")
}

View file

@ -38,8 +38,8 @@ var (
// Options defines options for the logger.
type Options struct {
Level logg.Level
Stdout io.Writer
Stderr io.Writer
StdOut io.Writer
StdErr io.Writer
DistinctLevel logg.Level
StoreErrors bool
HandlerPost func(e *logg.Entry) error
@ -48,21 +48,22 @@ type Options struct {
// New creates a new logger with the given options.
func New(opts Options) Logger {
if opts.Stdout == nil {
opts.Stdout = os.Stdout
if opts.StdOut == nil {
opts.StdOut = os.Stdout
}
if opts.Stderr == nil {
opts.Stderr = os.Stdout
if opts.StdErr == nil {
opts.StdErr = os.Stderr
}
if opts.Level == 0 {
opts.Level = logg.LevelWarn
}
var logHandler logg.Handler
if terminal.PrintANSIColors(os.Stdout) {
logHandler = newDefaultHandler(opts.Stdout, opts.Stderr)
if terminal.PrintANSIColors(os.Stderr) {
logHandler = newDefaultHandler(opts.StdErr, opts.StdErr)
} else {
logHandler = newNoColoursHandler(opts.Stdout, opts.Stderr, false, nil)
logHandler = newNoAnsiEscapeHandler(opts.StdErr, opts.StdErr, false, nil)
}
errorsw := &strings.Builder{}
@ -95,7 +96,7 @@ func New(opts Options) Logger {
}
if opts.StoreErrors {
h := newNoColoursHandler(io.Discard, errorsw, true, func(e *logg.Entry) bool {
h := newNoAnsiEscapeHandler(io.Discard, errorsw, true, func(e *logg.Entry) bool {
return e.Level >= logg.LevelError
})
@ -110,7 +111,7 @@ func New(opts Options) Logger {
logHandler = newStopHandler(logOnce, logHandler)
}
if opts.SuppressStatements != nil && len(opts.SuppressStatements) > 0 {
if len(opts.SuppressStatements) > 0 {
logHandler = newStopHandler(newSuppressStatementsHandler(opts.SuppressStatements), logHandler)
}
@ -137,7 +138,8 @@ func New(opts Options) Logger {
logCounters: logCounters,
errors: errorsw,
reset: reset,
out: opts.Stdout,
stdOut: opts.StdOut,
stdErr: opts.StdErr,
level: opts.Level,
logger: logger,
tracel: l.WithLevel(logg.LevelTrace),
@ -153,8 +155,6 @@ func NewDefault() Logger {
opts := Options{
DistinctLevel: logg.LevelWarn,
Level: logg.LevelWarn,
Stdout: os.Stdout,
Stderr: os.Stdout,
}
return New(opts)
}
@ -163,8 +163,6 @@ func NewTrace() Logger {
opts := Options{
DistinctLevel: logg.LevelWarn,
Level: logg.LevelTrace,
Stdout: os.Stdout,
Stderr: os.Stdout,
}
return New(opts)
}
@ -189,7 +187,8 @@ type Logger interface {
Level() logg.Level
LoggCount(logg.Level) int
Logger() logg.Logger
Out() io.Writer
StdOut() io.Writer
StdErr() io.Writer
Printf(format string, v ...any)
Println(v ...any)
PrintTimerIfDelayed(start time.Time, name string)
@ -207,7 +206,8 @@ type logAdapter struct {
logCounters *logLevelCounter
errors *strings.Builder
reset func()
out io.Writer
stdOut io.Writer
stdErr io.Writer
level logg.Level
logger logg.Logger
tracel logg.LevelLogger
@ -259,8 +259,12 @@ func (l *logAdapter) Logger() logg.Logger {
return l.logger
}
func (l *logAdapter) Out() io.Writer {
return l.out
func (l *logAdapter) StdOut() io.Writer {
return l.stdOut
}
func (l *logAdapter) StdErr() io.Writer {
return l.stdErr
}
// PrintTimerIfDelayed prints a time statement to the FEEDBACK logger
@ -271,7 +275,7 @@ func (l *logAdapter) PrintTimerIfDelayed(start time.Time, name string) {
if milli < 500 {
return
}
l.Printf("%s in %v ms", name, milli)
fmt.Fprintf(l.stdErr, "%s in %v ms", name, milli)
}
func (l *logAdapter) Printf(format string, v ...any) {
@ -279,11 +283,11 @@ func (l *logAdapter) Printf(format string, v ...any) {
if !strings.HasSuffix(format, "\n") {
format += "\n"
}
fmt.Fprintf(l.out, format, v...)
fmt.Fprintf(l.stdOut, format, v...)
}
func (l *logAdapter) Println(v ...any) {
fmt.Fprintln(l.out, v...)
fmt.Fprintln(l.stdOut, v...)
}
func (l *logAdapter) Reset() {
@ -323,11 +327,13 @@ func (l *logAdapter) Errors() string {
}
func (l *logAdapter) Erroridf(id, format string, v ...any) {
id = strings.ToLower(id)
format += l.idfInfoStatement("error", id, format)
l.errorl.WithField(FieldNameStatementID, id).Logf(format, v...)
}
func (l *logAdapter) Warnidf(id, format string, v ...any) {
id = strings.ToLower(id)
format += l.idfInfoStatement("warning", id, format)
l.warnl.WithField(FieldNameStatementID, id).Logf(format, v...)
}

View file

@ -31,13 +31,13 @@ func TestLogDistinct(t *testing.T) {
opts := loggers.Options{
DistinctLevel: logg.LevelWarn,
StoreErrors: true,
Stdout: io.Discard,
Stderr: io.Discard,
StdOut: io.Discard,
StdErr: io.Discard,
}
l := loggers.New(opts)
for i := 0; i < 10; i++ {
for range 10 {
l.Errorln("error 1")
l.Errorln("error 2")
l.Warnln("warn 1")
@ -54,8 +54,8 @@ func TestHookLast(t *testing.T) {
HandlerPost: func(e *logg.Entry) error {
panic(e.Message)
},
Stdout: io.Discard,
Stderr: io.Discard,
StdOut: io.Discard,
StdErr: io.Discard,
}
l := loggers.New(opts)
@ -70,8 +70,8 @@ func TestOptionStoreErrors(t *testing.T) {
opts := loggers.Options{
StoreErrors: true,
Stderr: &sb,
Stdout: &sb,
StdErr: &sb,
StdOut: &sb,
}
l := loggers.New(opts)
@ -131,13 +131,13 @@ func TestReset(t *testing.T) {
opts := loggers.Options{
StoreErrors: true,
DistinctLevel: logg.LevelWarn,
Stdout: io.Discard,
Stderr: io.Discard,
StdOut: io.Discard,
StdErr: io.Discard,
}
l := loggers.New(opts)
for i := 0; i < 3; i++ {
for range 3 {
l.Errorln("error 1")
l.Errorln("error 2")
l.Errorln("error 1")

View file

@ -21,7 +21,15 @@ import (
"github.com/bep/logg"
)
func InitGlobalLogger(level logg.Level, panicOnWarnings bool) {
// SetGlobalLogger sets the global logger.
// This is used in a few places in Hugo, e.g. deprecated functions.
func SetGlobalLogger(logger Logger) {
logMu.Lock()
defer logMu.Unlock()
log = logger
}
func initGlobalLogger(level logg.Level, panicOnWarnings bool) {
logMu.Lock()
defer logMu.Unlock()
var logHookLast func(e *logg.Entry) error
@ -50,5 +58,5 @@ func Log() Logger {
var log Logger
func init() {
InitGlobalLogger(logg.LevelWarn, false)
initGlobalLogger(logg.LevelWarn, false)
}

View file

@ -13,11 +13,14 @@
package maps
import "sync"
import (
"sync"
)
// Cache is a simple thread safe cache backed by a map.
type Cache[K comparable, T any] struct {
m map[K]T
m map[K]T
hasBeenInitialized bool
sync.RWMutex
}
@ -27,36 +30,138 @@ func NewCache[K comparable, T any]() *Cache[K, T] {
}
// Delete deletes the given key from the cache.
// If c is nil, this method is a no-op.
func (c *Cache[K, T]) Get(key K) (T, bool) {
if c == nil {
var zero T
return zero, false
}
c.RLock()
v, found := c.m[key]
v, found := c.get(key)
c.RUnlock()
return v, found
}
func (c *Cache[K, T]) get(key K) (T, bool) {
v, found := c.m[key]
return v, found
}
// GetOrCreate gets the value for the given key if it exists, or creates it if not.
func (c *Cache[K, T]) GetOrCreate(key K, create func() T) T {
func (c *Cache[K, T]) GetOrCreate(key K, create func() (T, error)) (T, error) {
c.RLock()
v, found := c.m[key]
c.RUnlock()
if found {
return v
return v, nil
}
c.Lock()
defer c.Unlock()
v, found = c.m[key]
if found {
return v
return v, nil
}
v, err := create()
if err != nil {
return v, err
}
v = create()
c.m[key] = v
return v
return v, nil
}
// Contains returns whether the given key exists in the cache.
func (c *Cache[K, T]) Contains(key K) bool {
c.RLock()
_, found := c.m[key]
c.RUnlock()
return found
}
// InitAndGet initializes the cache if not already done and returns the value for the given key.
// The init state will be reset on Reset or Drain.
func (c *Cache[K, T]) InitAndGet(key K, init func(get func(key K) (T, bool), set func(key K, value T)) error) (T, error) {
var v T
c.RLock()
if !c.hasBeenInitialized {
c.RUnlock()
if err := func() error {
c.Lock()
defer c.Unlock()
// Double check in case another goroutine has initialized it in the meantime.
if !c.hasBeenInitialized {
err := init(c.get, c.set)
if err != nil {
return err
}
c.hasBeenInitialized = true
}
return nil
}(); err != nil {
return v, err
}
// Reacquire the read lock.
c.RLock()
}
v = c.m[key]
c.RUnlock()
return v, nil
}
// Set sets the given key to the given value.
func (c *Cache[K, T]) Set(key K, value T) {
c.Lock()
c.set(key, value)
c.Unlock()
}
// SetIfAbsent sets the given key to the given value if the key does not already exist in the cache.
func (c *Cache[K, T]) SetIfAbsent(key K, value T) {
c.RLock()
if _, found := c.get(key); !found {
c.RUnlock()
c.Set(key, value)
} else {
c.RUnlock()
}
}
func (c *Cache[K, T]) set(key K, value T) {
c.m[key] = value
}
// ForEeach calls the given function for each key/value pair in the cache.
// If the function returns false, the iteration stops.
func (c *Cache[K, T]) ForEeach(f func(K, T) bool) {
c.RLock()
defer c.RUnlock()
for k, v := range c.m {
if !f(k, v) {
return
}
}
}
func (c *Cache[K, T]) Drain() map[K]T {
c.Lock()
m := c.m
c.m = make(map[K]T)
c.hasBeenInitialized = false
c.Unlock()
return m
}
func (c *Cache[K, T]) Len() int {
c.RLock()
defer c.RUnlock()
return len(c.m)
}
func (c *Cache[K, T]) Reset() {
c.Lock()
clear(c.m)
c.hasBeenInitialized = false
c.Unlock()
}

View file

@ -112,17 +112,17 @@ func ToSliceStringMap(in any) ([]map[string]any, error) {
}
// LookupEqualFold finds key in m with case insensitive equality checks.
func LookupEqualFold[T any | string](m map[string]T, key string) (T, bool) {
func LookupEqualFold[T any | string](m map[string]T, key string) (T, string, bool) {
if v, found := m[key]; found {
return v, true
return v, key, true
}
for k, v := range m {
if strings.EqualFold(k, key) {
return v, true
return v, k, true
}
}
var s T
return s, false
return s, "", false
}
// MergeShallow merges src into dst, but only if the key does not already exist in dst.

View file

@ -73,10 +73,14 @@ func TestPrepareParams(t *testing.T) {
for i, test := range tests {
t.Run(fmt.Sprint(i), func(t *testing.T) {
// PrepareParams modifies input.
prepareClone := PrepareParamsClone(test.input)
PrepareParams(test.input)
if !reflect.DeepEqual(test.expected, test.input) {
t.Errorf("[%d] Expected\n%#v, got\n%#v\n", i, test.expected, test.input)
}
if !reflect.DeepEqual(test.expected, prepareClone) {
t.Errorf("[%d] Expected\n%#v, got\n%#v\n", i, test.expected, prepareClone)
}
})
}
}
@ -180,16 +184,18 @@ func TestLookupEqualFold(t *testing.T) {
"B": "bv",
}
v, found := LookupEqualFold(m1, "b")
v, k, found := LookupEqualFold(m1, "b")
c.Assert(found, qt.IsTrue)
c.Assert(v, qt.Equals, "bv")
c.Assert(k, qt.Equals, "B")
m2 := map[string]string{
"a": "av",
"B": "bv",
}
v, found = LookupEqualFold(m2, "b")
v, k, found = LookupEqualFold(m2, "b")
c.Assert(found, qt.IsTrue)
c.Assert(k, qt.Equals, "B")
c.Assert(v, qt.Equals, "bv")
}

144
common/maps/ordered.go Normal file
View file

@ -0,0 +1,144 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package maps
import (
"slices"
"github.com/gohugoio/hugo/common/hashing"
)
// Ordered is a map that can be iterated in the order of insertion.
// Note that insertion order is not affected if a key is re-inserted into the map.
// In a nil map, all operations are no-ops.
// This is not thread safe.
type Ordered[K comparable, T any] struct {
// The keys in the order they were added.
keys []K
// The values.
values map[K]T
}
// NewOrdered creates a new Ordered map.
func NewOrdered[K comparable, T any]() *Ordered[K, T] {
return &Ordered[K, T]{values: make(map[K]T)}
}
// Set sets the value for the given key.
// Note that insertion order is not affected if a key is re-inserted into the map.
func (m *Ordered[K, T]) Set(key K, value T) {
if m == nil {
return
}
// Check if key already exists.
if _, found := m.values[key]; !found {
m.keys = append(m.keys, key)
}
m.values[key] = value
}
// Get gets the value for the given key.
func (m *Ordered[K, T]) Get(key K) (T, bool) {
if m == nil {
var v T
return v, false
}
value, found := m.values[key]
return value, found
}
// Has returns whether the given key exists in the map.
func (m *Ordered[K, T]) Has(key K) bool {
if m == nil {
return false
}
_, found := m.values[key]
return found
}
// Delete deletes the value for the given key.
func (m *Ordered[K, T]) Delete(key K) {
if m == nil {
return
}
delete(m.values, key)
for i, k := range m.keys {
if k == key {
m.keys = slices.Delete(m.keys, i, i+1)
break
}
}
}
// Clone creates a shallow copy of the map.
func (m *Ordered[K, T]) Clone() *Ordered[K, T] {
if m == nil {
return nil
}
clone := NewOrdered[K, T]()
for _, k := range m.keys {
clone.Set(k, m.values[k])
}
return clone
}
// Keys returns the keys in the order they were added.
func (m *Ordered[K, T]) Keys() []K {
if m == nil {
return nil
}
return m.keys
}
// Values returns the values in the order they were added.
func (m *Ordered[K, T]) Values() []T {
if m == nil {
return nil
}
var values []T
for _, k := range m.keys {
values = append(values, m.values[k])
}
return values
}
// Len returns the number of items in the map.
func (m *Ordered[K, T]) Len() int {
if m == nil {
return 0
}
return len(m.keys)
}
// Range calls f sequentially for each key and value present in the map.
// If f returns false, range stops the iteration.
// TODO(bep) replace with iter.Seq2 when we bump go Go 1.24.
func (m *Ordered[K, T]) Range(f func(key K, value T) bool) {
if m == nil {
return
}
for _, k := range m.keys {
if !f(k, m.values[k]) {
return
}
}
}
// Hash calculates a hash from the values.
func (m *Ordered[K, T]) Hash() (uint64, error) {
if m == nil {
return 0, nil
}
return hashing.Hash(m.values)
}

View file

@ -0,0 +1,99 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package maps
import (
"testing"
qt "github.com/frankban/quicktest"
)
func TestOrdered(t *testing.T) {
c := qt.New(t)
m := NewOrdered[string, int]()
m.Set("a", 1)
m.Set("b", 2)
m.Set("c", 3)
c.Assert(m.Keys(), qt.DeepEquals, []string{"a", "b", "c"})
c.Assert(m.Values(), qt.DeepEquals, []int{1, 2, 3})
v, found := m.Get("b")
c.Assert(found, qt.Equals, true)
c.Assert(v, qt.Equals, 2)
m.Set("b", 22)
c.Assert(m.Keys(), qt.DeepEquals, []string{"a", "b", "c"})
c.Assert(m.Values(), qt.DeepEquals, []int{1, 22, 3})
m.Delete("b")
c.Assert(m.Keys(), qt.DeepEquals, []string{"a", "c"})
c.Assert(m.Values(), qt.DeepEquals, []int{1, 3})
}
func TestOrderedHash(t *testing.T) {
c := qt.New(t)
m := NewOrdered[string, int]()
m.Set("a", 1)
m.Set("b", 2)
m.Set("c", 3)
h1, err := m.Hash()
c.Assert(err, qt.IsNil)
m.Set("d", 4)
h2, err := m.Hash()
c.Assert(err, qt.IsNil)
c.Assert(h1, qt.Not(qt.Equals), h2)
m = NewOrdered[string, int]()
m.Set("b", 2)
m.Set("a", 1)
m.Set("c", 3)
h3, err := m.Hash()
c.Assert(err, qt.IsNil)
// Order does not matter.
c.Assert(h1, qt.Equals, h3)
}
func TestOrderedNil(t *testing.T) {
c := qt.New(t)
var m *Ordered[string, int]
m.Set("a", 1)
c.Assert(m.Keys(), qt.IsNil)
c.Assert(m.Values(), qt.IsNil)
v, found := m.Get("a")
c.Assert(found, qt.Equals, false)
c.Assert(v, qt.Equals, 0)
m.Delete("a")
var b bool
m.Range(func(k string, v int) bool {
b = true
return true
})
c.Assert(b, qt.Equals, false)
c.Assert(m.Len(), qt.Equals, 0)
c.Assert(m.Clone(), qt.IsNil)
h, err := m.Hash()
c.Assert(err, qt.IsNil)
c.Assert(h, qt.Equals, uint64(0))
}

View file

@ -303,7 +303,7 @@ func toMergeStrategy(v any) ParamsMergeStrategy {
}
// PrepareParams
// * makes all the keys in the given map lower cased and will do so
// * makes all the keys in the given map lower cased and will do so recursively.
// * This will modify the map given.
// * Any nested map[interface{}]interface{}, map[string]interface{},map[string]string will be converted to Params.
// * Any _merge value will be converted to proper type and value.
@ -343,3 +343,42 @@ func PrepareParams(m Params) {
}
}
}
// PrepareParamsClone is like PrepareParams, but it does not modify the input.
func PrepareParamsClone(m Params) Params {
m2 := make(Params)
for k, v := range m {
var retyped bool
lKey := strings.ToLower(k)
if lKey == MergeStrategyKey {
v = toMergeStrategy(v)
retyped = true
} else {
switch vv := v.(type) {
case map[any]any:
var p Params = cast.ToStringMap(v)
v = PrepareParamsClone(p)
retyped = true
case map[string]any:
var p Params = v.(map[string]any)
v = PrepareParamsClone(p)
retyped = true
case map[string]string:
p := make(Params)
for k, v := range vv {
p[k] = v
}
v = p
PrepareParams(p)
retyped = true
}
}
if retyped || k != lKey {
m2[lKey] = v
} else {
m2[k] = v
}
}
return m2
}

View file

@ -22,31 +22,18 @@ import (
"github.com/gohugoio/hugo/common/math"
)
// Scratch is a writable context used for stateful operations in Page/Node rendering.
type StoreProvider interface {
// Store returns a Scratch that can be used to store temporary state.
// Store is not reset on server rebuilds.
Store() *Scratch
}
// Scratch is a writable context used for stateful build operations
type Scratch struct {
values map[string]any
mu sync.RWMutex
}
// Scratcher provides a scratching service.
type Scratcher interface {
// Scratch returns a "scratch pad" that can be used to store state.
Scratch() *Scratch
}
type scratcher struct {
s *Scratch
}
func (s scratcher) Scratch() *Scratch {
return s.s
}
// NewScratcher creates a new Scratcher.
func NewScratcher() Scratcher {
return scratcher{s: NewScratch()}
}
// Add will, for single values, add (using the + operator) the addend to the existing addend (if found).
// Supports numeric values and strings.
//

View file

@ -140,7 +140,7 @@ func TestScratchInParallel(t *testing.T) {
for i := 1; i <= 10; i++ {
wg.Add(1)
go func(j int) {
for k := 0; k < 10; k++ {
for k := range 10 {
newVal := int64(k + j)
_, err := scratch.Add(key, newVal)
@ -185,7 +185,7 @@ func TestScratchSetInMap(t *testing.T) {
scratch.SetInMap("key", "zyx", "Zyx")
scratch.SetInMap("key", "abc", "Abc (updated)")
scratch.SetInMap("key", "def", "Def")
c.Assert(scratch.GetSortedMapValues("key"), qt.DeepEquals, []any{0: "Abc (updated)", 1: "Def", 2: "Lux", 3: "Zyx"})
c.Assert(scratch.GetSortedMapValues("key"), qt.DeepEquals, any([]any{"Abc (updated)", "Def", "Lux", "Zyx"}))
}
func TestScratchDeleteInMap(t *testing.T) {
@ -199,7 +199,7 @@ func TestScratchDeleteInMap(t *testing.T) {
scratch.DeleteInMap("key", "abc")
scratch.SetInMap("key", "def", "Def")
scratch.DeleteInMap("key", "lmn") // Do nothing
c.Assert(scratch.GetSortedMapValues("key"), qt.DeepEquals, []any{0: "Def", 1: "Lux", 2: "Zyx"})
c.Assert(scratch.GetSortedMapValues("key"), qt.DeepEquals, any([]any{"Def", "Lux", "Zyx"}))
}
func TestScratchGetSortedMapValues(t *testing.T) {

View file

@ -26,29 +26,32 @@ func DoArithmetic(a, b any, op rune) (any, error) {
var ai, bi int64
var af, bf float64
var au, bu uint64
var isInt, isFloat, isUint bool
switch av.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
ai = av.Int()
switch bv.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
isInt = true
bi = bv.Int()
case reflect.Float32, reflect.Float64:
isFloat = true
af = float64(ai) // may overflow
ai = 0
bf = bv.Float()
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
bu = bv.Uint()
if ai >= 0 {
isUint = true
au = uint64(ai)
ai = 0
} else {
isInt = true
bi = int64(bu) // may overflow
bu = 0
}
default:
return nil, errors.New("can't apply the operator to the values")
}
case reflect.Float32, reflect.Float64:
isFloat = true
af = av.Float()
switch bv.Kind() {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
@ -66,17 +69,18 @@ func DoArithmetic(a, b any, op rune) (any, error) {
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
bi = bv.Int()
if bi >= 0 {
isUint = true
bu = uint64(bi)
bi = 0
} else {
isInt = true
ai = int64(au) // may overflow
au = 0
}
case reflect.Float32, reflect.Float64:
isFloat = true
af = float64(au) // may overflow
au = 0
bf = bv.Float()
case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
isUint = true
bu = bv.Uint()
default:
return nil, errors.New("can't apply the operator to the values")
@ -94,38 +98,32 @@ func DoArithmetic(a, b any, op rune) (any, error) {
switch op {
case '+':
if ai != 0 || bi != 0 {
if isInt {
return ai + bi, nil
} else if af != 0 || bf != 0 {
} else if isFloat {
return af + bf, nil
} else if au != 0 || bu != 0 {
return au + bu, nil
}
return 0, nil
return au + bu, nil
case '-':
if ai != 0 || bi != 0 {
if isInt {
return ai - bi, nil
} else if af != 0 || bf != 0 {
} else if isFloat {
return af - bf, nil
} else if au != 0 || bu != 0 {
return au - bu, nil
}
return 0, nil
return au - bu, nil
case '*':
if ai != 0 || bi != 0 {
if isInt {
return ai * bi, nil
} else if af != 0 || bf != 0 {
} else if isFloat {
return af * bf, nil
} else if au != 0 || bu != 0 {
return au * bu, nil
}
return 0, nil
return au * bu, nil
case '/':
if bi != 0 {
if isInt && bi != 0 {
return ai / bi, nil
} else if bf != 0 {
} else if isFloat && bf != 0 {
return af / bf, nil
} else if bu != 0 {
} else if isUint && bu != 0 {
return au / bu, nil
}
return nil, errors.New("can't divide the value by 0")

View file

@ -30,10 +30,12 @@ func TestDoArithmetic(t *testing.T) {
expect any
}{
{3, 2, '+', int64(5)},
{0, 0, '+', int64(0)},
{3, 2, '-', int64(1)},
{3, 2, '*', int64(6)},
{3, 2, '/', int64(1)},
{3.0, 2, '+', float64(5)},
{0.0, 0, '+', float64(0.0)},
{3.0, 2, '-', float64(1)},
{3.0, 2, '*', float64(6)},
{3.0, 2, '/', float64(1.5)},
@ -42,18 +44,22 @@ func TestDoArithmetic(t *testing.T) {
{3, 2.0, '*', float64(6)},
{3, 2.0, '/', float64(1.5)},
{3.0, 2.0, '+', float64(5)},
{0.0, 0.0, '+', float64(0.0)},
{3.0, 2.0, '-', float64(1)},
{3.0, 2.0, '*', float64(6)},
{3.0, 2.0, '/', float64(1.5)},
{uint(3), uint(2), '+', uint64(5)},
{uint(0), uint(0), '+', uint64(0)},
{uint(3), uint(2), '-', uint64(1)},
{uint(3), uint(2), '*', uint64(6)},
{uint(3), uint(2), '/', uint64(1)},
{uint(3), 2, '+', uint64(5)},
{uint(0), 0, '+', uint64(0)},
{uint(3), 2, '-', uint64(1)},
{uint(3), 2, '*', uint64(6)},
{uint(3), 2, '/', uint64(1)},
{3, uint(2), '+', uint64(5)},
{0, uint(0), '+', uint64(0)},
{3, uint(2), '-', uint64(1)},
{3, uint(2), '*', uint64(6)},
{3, uint(2), '/', uint64(1)},
@ -66,16 +72,15 @@ func TestDoArithmetic(t *testing.T) {
{-3, uint(2), '*', int64(-6)},
{-3, uint(2), '/', int64(-1)},
{uint(3), 2.0, '+', float64(5)},
{uint(0), 0.0, '+', float64(0)},
{uint(3), 2.0, '-', float64(1)},
{uint(3), 2.0, '*', float64(6)},
{uint(3), 2.0, '/', float64(1.5)},
{3.0, uint(2), '+', float64(5)},
{0.0, uint(0), '+', float64(0)},
{3.0, uint(2), '-', float64(1)},
{3.0, uint(2), '*', float64(6)},
{3.0, uint(2), '/', float64(1.5)},
{0, 0, '+', 0},
{0, 0, '-', 0},
{0, 0, '*', 0},
{"foo", "bar", '+', "foobar"},
{3, 0, '/', false},
{3.0, 0, '/', false},

View file

@ -42,7 +42,7 @@ func TestPara(t *testing.T) {
c.Run("Order", func(c *qt.C) {
n := 500
ints := make([]int, n)
for i := 0; i < n; i++ {
for i := range n {
ints[i] = i
}
@ -51,7 +51,7 @@ func TestPara(t *testing.T) {
var result []int
var mu sync.Mutex
for i := 0; i < n; i++ {
for i := range n {
i := i
r.Run(func() error {
mu.Lock()
@ -78,7 +78,7 @@ func TestPara(t *testing.T) {
var counter int64
for i := 0; i < n; i++ {
for range n {
r.Run(func() error {
atomic.AddInt64(&counter, 1)
time.Sleep(1 * time.Millisecond)

View file

@ -237,12 +237,17 @@ func prettifyPath(in string, b filepathPathBridge) string {
return b.Join(b.Dir(in), name, "index"+ext)
}
// CommonDir returns the common directory of the given paths.
func CommonDir(path1, path2 string) string {
// CommonDirPath returns the common directory of the given paths.
func CommonDirPath(path1, path2 string) string {
if path1 == "" || path2 == "" {
return ""
}
hadLeadingSlash := strings.HasPrefix(path1, "/") || strings.HasPrefix(path2, "/")
path1 = TrimLeading(path1)
path2 = TrimLeading(path2)
p1 := strings.Split(path1, "/")
p2 := strings.Split(path2, "/")
@ -256,7 +261,13 @@ func CommonDir(path1, path2 string) string {
}
}
return strings.Join(common, "/")
s := strings.Join(common, "/")
if hadLeadingSlash && s != "" {
s = "/" + s
}
return s
}
// Sanitize sanitizes string to be used in Hugo's file paths and URLs, allowing only
@ -384,12 +395,27 @@ func PathEscape(pth string) string {
// ToSlashTrimLeading is just a filepath.ToSlash with an added / prefix trimmer.
func ToSlashTrimLeading(s string) string {
return strings.TrimPrefix(filepath.ToSlash(s), "/")
return TrimLeading(filepath.ToSlash(s))
}
// TrimLeading trims the leading slash from the given string.
func TrimLeading(s string) string {
return strings.TrimPrefix(s, "/")
}
// ToSlashTrimTrailing is just a filepath.ToSlash with an added / suffix trimmer.
func ToSlashTrimTrailing(s string) string {
return strings.TrimSuffix(filepath.ToSlash(s), "/")
return TrimTrailing(filepath.ToSlash(s))
}
// TrimTrailing trims the trailing slash from the given string.
func TrimTrailing(s string) string {
return strings.TrimSuffix(s, "/")
}
// ToSlashTrim trims any leading and trailing slashes from the given string and converts it to a forward slash separated path.
func ToSlashTrim(s string) string {
return strings.Trim(filepath.ToSlash(s), "/")
}
// ToSlashPreserveLeading converts the path given to a forward slash separated path
@ -397,3 +423,8 @@ func ToSlashTrimTrailing(s string) string {
func ToSlashPreserveLeading(s string) string {
return "/" + strings.Trim(filepath.ToSlash(s), "/")
}
// IsSameFilePath checks if s1 and s2 are the same file path.
func IsSameFilePath(s1, s2 string) bool {
return path.Clean(ToSlashTrim(s1)) == path.Clean(ToSlashTrim(s2))
}

View file

@ -262,3 +262,52 @@ func TestFieldsSlash(t *testing.T) {
c.Assert(FieldsSlash("/"), qt.DeepEquals, []string{})
c.Assert(FieldsSlash(""), qt.DeepEquals, []string{})
}
func TestCommonDirPath(t *testing.T) {
c := qt.New(t)
for _, this := range []struct {
a, b, expected string
}{
{"/a/b/c", "/a/b/d", "/a/b"},
{"/a/b/c", "a/b/d", "/a/b"},
{"a/b/c", "/a/b/d", "/a/b"},
{"a/b/c", "a/b/d", "a/b"},
{"/a/b/c", "/a/b/c", "/a/b/c"},
{"/a/b/c", "/a/b/c/d", "/a/b/c"},
{"/a/b/c", "/a/b", "/a/b"},
{"/a/b/c", "/a", "/a"},
{"/a/b/c", "/d/e/f", ""},
} {
c.Assert(CommonDirPath(this.a, this.b), qt.Equals, this.expected, qt.Commentf("a: %s b: %s", this.a, this.b))
}
}
func TestIsSameFilePath(t *testing.T) {
c := qt.New(t)
for _, this := range []struct {
a, b string
expected bool
}{
{"/a/b/c", "/a/b/c", true},
{"/a/b/c", "/a/b/c/", true},
{"/a/b/c", "/a/b/d", false},
{"/a/b/c", "/a/b", false},
{"/a/b/c", "/a/b/c/d", false},
{"/a/b/c", "/a/b/cd", false},
{"/a/b/c", "/a/b/cc", false},
{"/a/b/c", "/a/b/c/", true},
{"/a/b/c", "/a/b/c//", true},
{"/a/b/c", "/a/b/c/.", true},
{"/a/b/c", "/a/b/c/./", true},
{"/a/b/c", "/a/b/c/./.", true},
{"/a/b/c", "/a/b/c/././", true},
{"/a/b/c", "/a/b/c/././.", true},
{"/a/b/c", "/a/b/c/./././", true},
{"/a/b/c", "/a/b/c/./././.", true},
{"/a/b/c", "/a/b/c/././././", true},
} {
c.Assert(IsSameFilePath(filepath.FromSlash(this.a), filepath.FromSlash(this.b)), qt.Equals, this.expected, qt.Commentf("a: %s b: %s", this.a, this.b))
}
}

View file

@ -23,9 +23,12 @@ import (
"github.com/gohugoio/hugo/common/types"
"github.com/gohugoio/hugo/hugofs/files"
"github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/resources/kinds"
)
var defaultPathParser PathParser
const (
identifierBaseof = "baseof"
)
// PathParser parses a path into a Path.
type PathParser struct {
@ -34,11 +37,13 @@ type PathParser struct {
// Reports whether the given language is disabled.
IsLangDisabled func(string) bool
}
// Parse parses component c with path s into Path using the default path parser.
func Parse(c, s string) *Path {
return defaultPathParser.Parse(c, s)
// IsOutputFormat reports whether the given name is a valid output format.
// The second argument is optional.
IsOutputFormat func(name, ext string) bool
// Reports whether the given ext is a content file.
IsContentExt func(string) bool
}
// NormalizePathString returns a normalized path string using the very basic Hugo rules.
@ -87,13 +92,10 @@ func (pp *PathParser) Parse(c, s string) *Path {
}
func (pp *PathParser) newPath(component string) *Path {
return &Path{
component: component,
posContainerLow: -1,
posContainerHigh: -1,
posSectionHigh: -1,
posIdentifierLanguage: -1,
}
p := &Path{}
p.reset()
p.component = component
return p
}
func (pp *PathParser) parse(component, s string) (*Path, error) {
@ -108,7 +110,6 @@ func (pp *PathParser) parse(component, s string) (*Path, error) {
var err error
// Preserve the original case for titles etc.
p.unnormalized, err = pp.doParse(component, s, pp.newPath(component))
if err != nil {
return nil, err
}
@ -119,10 +120,101 @@ func (pp *PathParser) parse(component, s string) (*Path, error) {
return p, nil
}
func (pp *PathParser) doParse(component, s string, p *Path) (*Path, error) {
hasLang := pp.LanguageIndex != nil
hasLang = hasLang && (component == files.ComponentFolderContent || component == files.ComponentFolderLayouts)
func (pp *PathParser) parseIdentifier(component, s string, p *Path, i, lastDot, numDots int, isLast bool) {
if p.posContainerHigh != -1 {
return
}
mayHaveLang := numDots > 1 && p.posIdentifierLanguage == -1 && pp.LanguageIndex != nil
mayHaveLang = mayHaveLang && (component == files.ComponentFolderContent || component == files.ComponentFolderLayouts)
mayHaveOutputFormat := component == files.ComponentFolderLayouts
mayHaveKind := p.posIdentifierKind == -1 && mayHaveOutputFormat
var mayHaveLayout bool
if p.pathType == TypeShortcode {
mayHaveLayout = !isLast && component == files.ComponentFolderLayouts
} else {
mayHaveLayout = component == files.ComponentFolderLayouts
}
var found bool
var high int
if len(p.identifiersKnown) > 0 {
high = lastDot
} else {
high = len(p.s)
}
id := types.LowHigh[string]{Low: i + 1, High: high}
sid := p.s[id.Low:id.High]
if len(p.identifiersKnown) == 0 {
// The first is always the extension.
p.identifiersKnown = append(p.identifiersKnown, id)
found = true
// May also be the output format.
if mayHaveOutputFormat && pp.IsOutputFormat(sid, "") {
p.posIdentifierOutputFormat = 0
}
} else {
var langFound bool
if mayHaveLang {
var disabled bool
_, langFound = pp.LanguageIndex[sid]
if !langFound {
disabled = pp.IsLangDisabled != nil && pp.IsLangDisabled(sid)
if disabled {
p.disabled = true
langFound = true
}
}
found = langFound
if langFound {
p.identifiersKnown = append(p.identifiersKnown, id)
p.posIdentifierLanguage = len(p.identifiersKnown) - 1
}
}
if !found && mayHaveOutputFormat {
// At this point we may already have resolved an output format,
// but we need to keep looking for a more specific one, e.g. amp before html.
// Use both name and extension to prevent
// false positives on the form css.html.
if pp.IsOutputFormat(sid, p.Ext()) {
found = true
p.identifiersKnown = append(p.identifiersKnown, id)
p.posIdentifierOutputFormat = len(p.identifiersKnown) - 1
}
}
if !found && mayHaveKind {
if kinds.GetKindMain(sid) != "" {
found = true
p.identifiersKnown = append(p.identifiersKnown, id)
p.posIdentifierKind = len(p.identifiersKnown) - 1
}
}
if !found && sid == identifierBaseof {
found = true
p.identifiersKnown = append(p.identifiersKnown, id)
p.posIdentifierBaseof = len(p.identifiersKnown) - 1
}
if !found && mayHaveLayout {
p.identifiersKnown = append(p.identifiersKnown, id)
p.posIdentifierLayout = len(p.identifiersKnown) - 1
found = true
}
if !found {
p.identifiersUnknown = append(p.identifiersUnknown, id)
}
}
}
func (pp *PathParser) doParse(component, s string, p *Path) (*Path, error) {
if runtime.GOOS == "windows" {
s = path.Clean(filepath.ToSlash(s))
if s == "." {
@ -145,46 +237,26 @@ func (pp *PathParser) doParse(component, s string, p *Path) (*Path, error) {
p.s = s
slashCount := 0
lastDot := 0
lastSlashIdx := strings.LastIndex(s, "/")
numDots := strings.Count(s[lastSlashIdx+1:], ".")
if strings.Contains(s, "/_shortcodes/") {
p.pathType = TypeShortcode
}
for i := len(s) - 1; i >= 0; i-- {
c := s[i]
switch c {
case '.':
if p.posContainerHigh == -1 {
var high int
if len(p.identifiers) > 0 {
high = p.identifiers[len(p.identifiers)-1].Low - 1
} else {
high = len(p.s)
}
id := types.LowHigh{Low: i + 1, High: high}
if len(p.identifiers) == 0 {
p.identifiers = append(p.identifiers, id)
} else if len(p.identifiers) == 1 {
// Check for a valid language.
s := p.s[id.Low:id.High]
if hasLang {
var disabled bool
_, langFound := pp.LanguageIndex[s]
if !langFound {
disabled = pp.IsLangDisabled != nil && pp.IsLangDisabled(s)
if disabled {
p.disabled = true
langFound = true
}
}
if langFound {
p.posIdentifierLanguage = 1
p.identifiers = append(p.identifiers, id)
}
}
}
}
pp.parseIdentifier(component, s, p, i, lastDot, numDots, false)
lastDot = i
case '/':
slashCount++
if p.posContainerHigh == -1 {
if lastDot > 0 {
pp.parseIdentifier(component, s, p, i, lastDot, numDots, true)
}
p.posContainerHigh = i + 1
} else if p.posContainerLow == -1 {
p.posContainerLow = i + 1
@ -195,23 +267,52 @@ func (pp *PathParser) doParse(component, s string, p *Path) (*Path, error) {
}
}
isContentComponent := p.component == files.ComponentFolderContent || p.component == files.ComponentFolderArchetypes
isContent := isContentComponent && files.IsContentExt(p.Ext())
if len(p.identifiersKnown) > 0 {
isContentComponent := p.component == files.ComponentFolderContent || p.component == files.ComponentFolderArchetypes
isContent := isContentComponent && pp.IsContentExt(p.Ext())
id := p.identifiersKnown[len(p.identifiersKnown)-1]
if isContent {
id := p.identifiers[len(p.identifiers)-1]
b := p.s[p.posContainerHigh : id.Low-1]
switch b {
case "index":
p.bundleType = PathTypeLeaf
case "_index":
p.bundleType = PathTypeBranch
default:
p.bundleType = PathTypeContentSingle
if id.Low > p.posContainerHigh {
b := p.s[p.posContainerHigh : id.Low-1]
if isContent {
switch b {
case "index":
p.pathType = TypeLeaf
case "_index":
p.pathType = TypeBranch
default:
p.pathType = TypeContentSingle
}
if slashCount == 2 && p.IsLeafBundle() {
p.posSectionHigh = 0
}
} else if b == files.NameContentData && files.IsContentDataExt(p.Ext()) {
p.pathType = TypeContentData
}
}
}
if slashCount == 2 && p.IsLeafBundle() {
p.posSectionHigh = 0
if p.pathType < TypeMarkup && component == files.ComponentFolderLayouts {
if p.posIdentifierBaseof != -1 {
p.pathType = TypeBaseof
} else {
pth := p.Path()
if strings.Contains(pth, "/_shortcodes/") {
p.pathType = TypeShortcode
} else if strings.Contains(pth, "/_markup/") {
p.pathType = TypeMarkup
} else if strings.HasPrefix(pth, "/_partials/") {
p.pathType = TypePartial
}
}
}
if p.pathType == TypeShortcode && p.posIdentifierLayout != -1 {
id := p.identifiersKnown[p.posIdentifierLayout]
if id.Low == p.posContainerHigh {
// First identifier is shortcode name.
p.posIdentifierLayout = -1
}
}
@ -220,32 +321,44 @@ func (pp *PathParser) doParse(component, s string, p *Path) (*Path, error) {
func ModifyPathBundleTypeResource(p *Path) {
if p.IsContent() {
p.bundleType = PathTypeContentResource
p.pathType = TypeContentResource
} else {
p.bundleType = PathTypeFile
p.pathType = TypeFile
}
}
type PathType int
//go:generate stringer -type Type
type Type int
const (
// A generic resource, e.g. a JSON file.
PathTypeFile PathType = iota
TypeFile Type = iota
// All below are content files.
// A resource of a content type with front matter.
PathTypeContentResource
TypeContentResource
// E.g. /blog/my-post.md
PathTypeContentSingle
TypeContentSingle
// All below are bundled content files.
// Leaf bundles, e.g. /blog/my-post/index.md
PathTypeLeaf
TypeLeaf
// Branch bundles, e.g. /blog/_index.md
PathTypeBranch
TypeBranch
// Content data file, _content.gotmpl.
TypeContentData
// Layout types.
TypeMarkup
TypeShortcode
TypePartial
TypeBaseof
)
type Path struct {
@ -256,13 +369,18 @@ type Path struct {
posContainerHigh int
posSectionHigh int
component string
bundleType PathType
component string
pathType Type
identifiers []types.LowHigh
identifiersKnown []types.LowHigh[string]
identifiersUnknown []types.LowHigh[string]
posIdentifierLanguage int
disabled bool
posIdentifierLanguage int
posIdentifierOutputFormat int
posIdentifierKind int
posIdentifierLayout int
posIdentifierBaseof int
disabled bool
trimLeadingSlash bool
@ -292,9 +410,13 @@ func (p *Path) reset() {
p.posContainerHigh = -1
p.posSectionHigh = -1
p.component = ""
p.bundleType = 0
p.identifiers = p.identifiers[:0]
p.pathType = 0
p.identifiersKnown = p.identifiersKnown[:0]
p.posIdentifierLanguage = -1
p.posIdentifierOutputFormat = -1
p.posIdentifierKind = -1
p.posIdentifierLayout = -1
p.posIdentifierBaseof = -1
p.disabled = false
p.trimLeadingSlash = false
p.unnormalized = nil
@ -315,6 +437,9 @@ func (p *Path) norm(s string) string {
// IdentifierBase satisfies identity.Identity.
func (p *Path) IdentifierBase() string {
if p.Component() == files.ComponentFolderLayouts {
return p.Path()
}
return p.Base()
}
@ -331,6 +456,13 @@ func (p *Path) Container() string {
return p.norm(p.s[p.posContainerLow : p.posContainerHigh-1])
}
func (p *Path) String() string {
if p == nil {
return "<nil>"
}
return p.Path()
}
// ContainerDir returns the container directory for this path.
// For content bundles this will be the parent directory.
func (p *Path) ContainerDir() string {
@ -351,13 +483,13 @@ func (p *Path) Section() string {
// IsContent returns true if the path is a content file (e.g. mypost.md).
// Note that this will also return true for content files in a bundle.
func (p *Path) IsContent() bool {
return p.BundleType() >= PathTypeContentResource
return p.Type() >= TypeContentResource && p.Type() <= TypeContentData
}
// isContentPage returns true if the path is a content file (e.g. mypost.md),
// but nof if inside a leaf bundle.
func (p *Path) isContentPage() bool {
return p.BundleType() >= PathTypeContentSingle
return p.Type() >= TypeContentSingle && p.Type() <= TypeContentData
}
// Name returns the last element of path.
@ -371,7 +503,7 @@ func (p *Path) Name() string {
// Name returns the last element of path without any extension.
func (p *Path) NameNoExt() string {
if i := p.identifierIndex(0); i != -1 {
return p.s[p.posContainerHigh : p.identifiers[i].Low-1]
return p.s[p.posContainerHigh : p.identifiersKnown[i].Low-1]
}
return p.s[p.posContainerHigh:]
}
@ -383,7 +515,7 @@ func (p *Path) NameNoLang() string {
return p.Name()
}
return p.s[p.posContainerHigh:p.identifiers[i].Low-1] + p.s[p.identifiers[i].High:]
return p.s[p.posContainerHigh:p.identifiersKnown[i].Low-1] + p.s[p.identifiersKnown[i].High:]
}
// BaseNameNoIdentifier returns the logical base name for a resource without any identifier (e.g. no extension).
@ -397,10 +529,26 @@ func (p *Path) BaseNameNoIdentifier() string {
// NameNoIdentifier returns the last element of path without any identifier (e.g. no extension).
func (p *Path) NameNoIdentifier() string {
if len(p.identifiers) > 0 {
return p.s[p.posContainerHigh : p.identifiers[len(p.identifiers)-1].Low-1]
lowHigh := p.nameLowHigh()
return p.s[lowHigh.Low:lowHigh.High]
}
func (p *Path) nameLowHigh() types.LowHigh[string] {
if len(p.identifiersKnown) > 0 {
lastID := p.identifiersKnown[len(p.identifiersKnown)-1]
if p.posContainerHigh == lastID.Low {
// The last identifier is the name.
return lastID
}
return types.LowHigh[string]{
Low: p.posContainerHigh,
High: p.identifiersKnown[len(p.identifiersKnown)-1].Low - 1,
}
}
return types.LowHigh[string]{
Low: p.posContainerHigh,
High: len(p.s),
}
return p.s[p.posContainerHigh:]
}
// Dir returns all but the last element of path, typically the path's directory.
@ -420,6 +568,11 @@ func (p *Path) Path() (d string) {
return p.norm(p.s)
}
// PathNoLeadingSlash returns the full path without the leading slash.
func (p *Path) PathNoLeadingSlash() string {
return p.Path()[1:]
}
// Unnormalized returns the Path with the original case preserved.
func (p *Path) Unnormalized() *Path {
return p.unnormalized
@ -435,6 +588,28 @@ func (p *Path) PathNoIdentifier() string {
return p.base(false, false)
}
// PathBeforeLangAndOutputFormatAndExt returns the path up to the first identifier that is not a language or output format.
func (p *Path) PathBeforeLangAndOutputFormatAndExt() string {
if len(p.identifiersKnown) == 0 {
return p.norm(p.s)
}
i := p.identifierIndex(0)
if j := p.posIdentifierOutputFormat; i == -1 || (j != -1 && j < i) {
i = j
}
if j := p.posIdentifierLanguage; i == -1 || (j != -1 && j < i) {
i = j
}
if i == -1 {
return p.norm(p.s)
}
id := p.identifiersKnown[i]
return p.norm(p.s[:id.Low-1])
}
// PathRel returns the path relative to the given owner.
func (p *Path) PathRel(owner *Path) string {
ob := owner.Base()
@ -461,26 +636,42 @@ func (p *Path) Base() string {
return p.base(!p.isContentPage(), p.IsBundle())
}
// Used in template lookups.
// For pages with Type set, we treat that as the section.
func (p *Path) BaseReTyped(typ string) (d string) {
base := p.Base()
if typ == "" || p.Section() == typ {
return base
}
d = "/" + typ
if p.posSectionHigh != -1 {
d += base[p.posSectionHigh:]
}
d = p.norm(d)
return
}
// BaseNoLeadingSlash returns the base path without the leading slash.
func (p *Path) BaseNoLeadingSlash() string {
return p.Base()[1:]
}
func (p *Path) base(preserveExt, isBundle bool) string {
if len(p.identifiers) == 0 {
if len(p.identifiersKnown) == 0 {
return p.norm(p.s)
}
if preserveExt && len(p.identifiers) == 1 {
if preserveExt && len(p.identifiersKnown) == 1 {
// Preserve extension.
return p.norm(p.s)
}
id := p.identifiers[len(p.identifiers)-1]
high := id.Low - 1
var high int
if isBundle {
high = p.posContainerHigh - 1
} else {
high = p.nameLowHigh().High
}
if high == 0 {
@ -492,7 +683,7 @@ func (p *Path) base(preserveExt, isBundle bool) string {
}
// For txt files etc. we want to preserve the extension.
id = p.identifiers[0]
id := p.identifiersKnown[0]
return p.norm(p.s[:high] + p.s[id.Low-1:id.High])
}
@ -501,8 +692,20 @@ func (p *Path) Ext() string {
return p.identifierAsString(0)
}
func (p *Path) OutputFormat() string {
return p.identifierAsString(p.posIdentifierOutputFormat)
}
func (p *Path) Kind() string {
return p.identifierAsString(p.posIdentifierKind)
}
func (p *Path) Layout() string {
return p.identifierAsString(p.posIdentifierLayout)
}
func (p *Path) Lang() string {
return p.identifierAsString(1)
return p.identifierAsString(p.posIdentifierLanguage)
}
func (p *Path) Identifier(i int) string {
@ -514,35 +717,43 @@ func (p *Path) Disabled() bool {
}
func (p *Path) Identifiers() []string {
ids := make([]string, len(p.identifiers))
for i, id := range p.identifiers {
ids := make([]string, len(p.identifiersKnown))
for i, id := range p.identifiersKnown {
ids[i] = p.s[id.Low:id.High]
}
return ids
}
func (p *Path) IsHTML() bool {
return files.IsHTML(p.Ext())
func (p *Path) IdentifiersUnknown() []string {
ids := make([]string, len(p.identifiersUnknown))
for i, id := range p.identifiersUnknown {
ids[i] = p.s[id.Low:id.High]
}
return ids
}
func (p *Path) BundleType() PathType {
return p.bundleType
func (p *Path) Type() Type {
return p.pathType
}
func (p *Path) IsBundle() bool {
return p.bundleType >= PathTypeLeaf
return p.pathType >= TypeLeaf && p.pathType <= TypeContentData
}
func (p *Path) IsBranchBundle() bool {
return p.bundleType == PathTypeBranch
return p.pathType == TypeBranch
}
func (p *Path) IsLeafBundle() bool {
return p.bundleType == PathTypeLeaf
return p.pathType == TypeLeaf
}
func (p Path) ForBundleType(t PathType) *Path {
p.bundleType = t
func (p *Path) IsContentData() bool {
return p.pathType == TypeContentData
}
func (p Path) ForType(t Type) *Path {
p.pathType = t
return &p
}
@ -552,12 +763,12 @@ func (p *Path) identifierAsString(i int) string {
return ""
}
id := p.identifiers[i]
id := p.identifiersKnown[i]
return p.s[id.Low:id.High]
}
func (p *Path) identifierIndex(i int) int {
if i < 0 || i >= len(p.identifiers) {
if i < 0 || i >= len(p.identifiersKnown) {
return -1
}
return i

View file

@ -18,6 +18,7 @@ import (
"testing"
"github.com/gohugoio/hugo/hugofs/files"
"github.com/gohugoio/hugo/resources/kinds"
qt "github.com/frankban/quicktest"
)
@ -26,6 +27,17 @@ var testParser = &PathParser{
LanguageIndex: map[string]int{
"no": 0,
"en": 1,
"fr": 2,
},
IsContentExt: func(ext string) bool {
return ext == "md"
},
IsOutputFormat: func(name, ext string) bool {
switch name {
case "html", "amp", "csv", "rss":
return true
}
return false
},
}
@ -102,17 +114,19 @@ func TestParse(t *testing.T) {
"Basic Markdown file",
"/a/b/c.md",
func(c *qt.C, p *Path) {
c.Assert(p.Ext(), qt.Equals, "md")
c.Assert(p.Type(), qt.Equals, TypeContentSingle)
c.Assert(p.IsContent(), qt.IsTrue)
c.Assert(p.IsLeafBundle(), qt.IsFalse)
c.Assert(p.Name(), qt.Equals, "c.md")
c.Assert(p.Base(), qt.Equals, "/a/b/c")
c.Assert(p.BaseReTyped("foo"), qt.Equals, "/foo/b/c")
c.Assert(p.Section(), qt.Equals, "a")
c.Assert(p.BaseNameNoIdentifier(), qt.Equals, "c")
c.Assert(p.Path(), qt.Equals, "/a/b/c.md")
c.Assert(p.Dir(), qt.Equals, "/a/b")
c.Assert(p.Container(), qt.Equals, "b")
c.Assert(p.ContainerDir(), qt.Equals, "/a/b")
c.Assert(p.Ext(), qt.Equals, "md")
},
},
{
@ -127,7 +141,7 @@ func TestParse(t *testing.T) {
// Reclassify it as a content resource.
ModifyPathBundleTypeResource(p)
c.Assert(p.BundleType(), qt.Equals, PathTypeContentResource)
c.Assert(p.Type(), qt.Equals, TypeContentResource)
c.Assert(p.IsContent(), qt.IsTrue)
c.Assert(p.Name(), qt.Equals, "b.md")
c.Assert(p.Base(), qt.Equals, "/a/b.md")
@ -160,8 +174,10 @@ func TestParse(t *testing.T) {
c.Assert(p.NameNoIdentifier(), qt.Equals, "b.a.b")
c.Assert(p.NameNoLang(), qt.Equals, "b.a.b.txt")
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"txt", "no"})
c.Assert(p.IdentifiersUnknown(), qt.DeepEquals, []string{"b", "a", "b"})
c.Assert(p.Base(), qt.Equals, "/a/b.a.b.txt")
c.Assert(p.BaseNoLeadingSlash(), qt.Equals, "a/b.a.b.txt")
c.Assert(p.Path(), qt.Equals, "/a/b.a.b.no.txt")
c.Assert(p.PathNoLang(), qt.Equals, "/a/b.a.b.txt")
c.Assert(p.Ext(), qt.Equals, "txt")
c.Assert(p.PathNoIdentifier(), qt.Equals, "/a/b.a.b")
@ -171,7 +187,11 @@ func TestParse(t *testing.T) {
"Home branch cundle",
"/_index.md",
func(c *qt.C, p *Path) {
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"md"})
c.Assert(p.IsBranchBundle(), qt.IsTrue)
c.Assert(p.IsBundle(), qt.IsTrue)
c.Assert(p.Base(), qt.Equals, "/")
c.Assert(p.BaseReTyped("foo"), qt.Equals, "/foo")
c.Assert(p.Path(), qt.Equals, "/_index.md")
c.Assert(p.Container(), qt.Equals, "")
c.Assert(p.ContainerDir(), qt.Equals, "/")
@ -182,12 +202,14 @@ func TestParse(t *testing.T) {
"/a/index.md",
func(c *qt.C, p *Path) {
c.Assert(p.Base(), qt.Equals, "/a")
c.Assert(p.BaseReTyped("foo"), qt.Equals, "/foo/a")
c.Assert(p.BaseNameNoIdentifier(), qt.Equals, "a")
c.Assert(p.Container(), qt.Equals, "a")
c.Assert(p.Container(), qt.Equals, "a")
c.Assert(p.ContainerDir(), qt.Equals, "")
c.Assert(p.Dir(), qt.Equals, "/a")
c.Assert(p.Ext(), qt.Equals, "md")
c.Assert(p.IdentifiersUnknown(), qt.DeepEquals, []string{"index"})
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"md"})
c.Assert(p.IsBranchBundle(), qt.IsFalse)
c.Assert(p.IsBundle(), qt.IsTrue)
@ -205,6 +227,7 @@ func TestParse(t *testing.T) {
func(c *qt.C, p *Path) {
c.Assert(p.Base(), qt.Equals, "/a/b")
c.Assert(p.BaseNameNoIdentifier(), qt.Equals, "b")
c.Assert(p.BaseReTyped("foo"), qt.Equals, "/foo/b")
c.Assert(p.Container(), qt.Equals, "b")
c.Assert(p.ContainerDir(), qt.Equals, "/a")
c.Assert(p.Dir(), qt.Equals, "/a/b")
@ -217,6 +240,7 @@ func TestParse(t *testing.T) {
c.Assert(p.NameNoExt(), qt.Equals, "index.no")
c.Assert(p.NameNoIdentifier(), qt.Equals, "index")
c.Assert(p.NameNoLang(), qt.Equals, "index.md")
c.Assert(p.Path(), qt.Equals, "/a/b/index.no.md")
c.Assert(p.PathNoLang(), qt.Equals, "/a/b/index.md")
c.Assert(p.Section(), qt.Equals, "a")
},
@ -333,14 +357,244 @@ func TestParse(t *testing.T) {
c.Assert(p.Path(), qt.Equals, "/a/b/c.txt")
},
},
{
"Content data file gotmpl",
"/a/b/_content.gotmpl",
func(c *qt.C, p *Path) {
c.Assert(p.Path(), qt.Equals, "/a/b/_content.gotmpl")
c.Assert(p.Ext(), qt.Equals, "gotmpl")
c.Assert(p.IsContentData(), qt.IsTrue)
},
},
{
"Content data file yaml",
"/a/b/_content.yaml",
func(c *qt.C, p *Path) {
c.Assert(p.IsContentData(), qt.IsFalse)
},
},
}
for _, test := range tests {
c.Run(test.name, func(c *qt.C) {
if test.name != "Home branch cundle" {
// return
}
test.assert(c, testParser.Parse(files.ComponentFolderContent, test.path))
})
}
}
func TestParseLayouts(t *testing.T) {
c := qt.New(t)
tests := []struct {
name string
path string
assert func(c *qt.C, p *Path)
}{
{
"Basic",
"/list.html",
func(c *qt.C, p *Path) {
c.Assert(p.Base(), qt.Equals, "/list.html")
c.Assert(p.OutputFormat(), qt.Equals, "html")
},
},
{
"Lang",
"/list.no.html",
func(c *qt.C, p *Path) {
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"html", "no", "list"})
c.Assert(p.IdentifiersUnknown(), qt.DeepEquals, []string{})
c.Assert(p.Base(), qt.Equals, "/list.html")
c.Assert(p.Lang(), qt.Equals, "no")
},
},
{
"Kind",
"/section.no.html",
func(c *qt.C, p *Path) {
c.Assert(p.Kind(), qt.Equals, kinds.KindSection)
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"html", "no", "section"})
c.Assert(p.IdentifiersUnknown(), qt.DeepEquals, []string{})
c.Assert(p.Base(), qt.Equals, "/section.html")
c.Assert(p.Lang(), qt.Equals, "no")
},
},
{
"Layout",
"/list.section.no.html",
func(c *qt.C, p *Path) {
c.Assert(p.Layout(), qt.Equals, "list")
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"html", "no", "section", "list"})
c.Assert(p.IdentifiersUnknown(), qt.DeepEquals, []string{})
c.Assert(p.Base(), qt.Equals, "/list.html")
c.Assert(p.Lang(), qt.Equals, "no")
},
},
{
"Layout multiple",
"/mylayout.list.section.no.html",
func(c *qt.C, p *Path) {
c.Assert(p.Layout(), qt.Equals, "mylayout")
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"html", "no", "section", "list", "mylayout"})
c.Assert(p.IdentifiersUnknown(), qt.DeepEquals, []string{})
c.Assert(p.Base(), qt.Equals, "/mylayout.html")
c.Assert(p.Lang(), qt.Equals, "no")
},
},
{
"Layout shortcode",
"/_shortcodes/myshort.list.no.html",
func(c *qt.C, p *Path) {
c.Assert(p.Layout(), qt.Equals, "list")
},
},
{
"Layout baseof",
"/baseof.list.no.html",
func(c *qt.C, p *Path) {
c.Assert(p.Layout(), qt.Equals, "list")
},
},
{
"Lang and output format",
"/list.no.amp.not.html",
func(c *qt.C, p *Path) {
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"html", "not", "amp", "no", "list"})
c.Assert(p.OutputFormat(), qt.Equals, "amp")
c.Assert(p.Ext(), qt.Equals, "html")
c.Assert(p.Lang(), qt.Equals, "no")
c.Assert(p.Base(), qt.Equals, "/list.html")
},
},
{
"Term",
"/term.html",
func(c *qt.C, p *Path) {
c.Assert(p.Base(), qt.Equals, "/term.html")
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"html", "term"})
c.Assert(p.PathNoIdentifier(), qt.Equals, "/term")
c.Assert(p.PathBeforeLangAndOutputFormatAndExt(), qt.Equals, "/term")
c.Assert(p.Lang(), qt.Equals, "")
c.Assert(p.Kind(), qt.Equals, "term")
c.Assert(p.OutputFormat(), qt.Equals, "html")
},
},
{
"Shortcode with layout",
"/_shortcodes/myshortcode.list.html",
func(c *qt.C, p *Path) {
c.Assert(p.Base(), qt.Equals, "/_shortcodes/myshortcode.html")
c.Assert(p.Type(), qt.Equals, TypeShortcode)
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"html", "list"})
c.Assert(p.Layout(), qt.Equals, "list")
c.Assert(p.PathNoIdentifier(), qt.Equals, "/_shortcodes/myshortcode")
c.Assert(p.PathBeforeLangAndOutputFormatAndExt(), qt.Equals, "/_shortcodes/myshortcode.list")
c.Assert(p.Lang(), qt.Equals, "")
c.Assert(p.Kind(), qt.Equals, "")
c.Assert(p.OutputFormat(), qt.Equals, "html")
},
},
{
"Sub dir",
"/pages/home.html",
func(c *qt.C, p *Path) {
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"html", "home"})
c.Assert(p.Lang(), qt.Equals, "")
c.Assert(p.Kind(), qt.Equals, "home")
c.Assert(p.OutputFormat(), qt.Equals, "html")
c.Assert(p.Dir(), qt.Equals, "/pages")
},
},
{
"Baseof",
"/pages/baseof.list.section.fr.amp.html",
func(c *qt.C, p *Path) {
c.Assert(p.Identifiers(), qt.DeepEquals, []string{"html", "amp", "fr", "section", "list", "baseof"})
c.Assert(p.IdentifiersUnknown(), qt.DeepEquals, []string{})
c.Assert(p.Kind(), qt.Equals, kinds.KindSection)
c.Assert(p.Lang(), qt.Equals, "fr")
c.Assert(p.OutputFormat(), qt.Equals, "amp")
c.Assert(p.Dir(), qt.Equals, "/pages")
c.Assert(p.NameNoIdentifier(), qt.Equals, "baseof")
c.Assert(p.Type(), qt.Equals, TypeBaseof)
c.Assert(p.IdentifierBase(), qt.Equals, "/pages/baseof.list.section.fr.amp.html")
},
},
{
"Markup",
"/_markup/render-link.html",
func(c *qt.C, p *Path) {
c.Assert(p.Type(), qt.Equals, TypeMarkup)
},
},
{
"Markup nested",
"/foo/_markup/render-link.html",
func(c *qt.C, p *Path) {
c.Assert(p.Type(), qt.Equals, TypeMarkup)
},
},
{
"Shortcode",
"/_shortcodes/myshortcode.html",
func(c *qt.C, p *Path) {
c.Assert(p.Type(), qt.Equals, TypeShortcode)
},
},
{
"Shortcode nested",
"/foo/_shortcodes/myshortcode.html",
func(c *qt.C, p *Path) {
c.Assert(p.Type(), qt.Equals, TypeShortcode)
},
},
{
"Shortcode nested sub",
"/foo/_shortcodes/foo/myshortcode.html",
func(c *qt.C, p *Path) {
c.Assert(p.Type(), qt.Equals, TypeShortcode)
},
},
{
"Partials",
"/_partials/foo.bar",
func(c *qt.C, p *Path) {
c.Assert(p.Type(), qt.Equals, TypePartial)
},
},
{
"Shortcode lang in root",
"/_shortcodes/no.html",
func(c *qt.C, p *Path) {
c.Assert(p.Type(), qt.Equals, TypeShortcode)
c.Assert(p.Lang(), qt.Equals, "")
c.Assert(p.NameNoIdentifier(), qt.Equals, "no")
},
},
{
"Shortcode lang layout",
"/_shortcodes/myshortcode.no.html",
func(c *qt.C, p *Path) {
c.Assert(p.Type(), qt.Equals, TypeShortcode)
c.Assert(p.Lang(), qt.Equals, "no")
c.Assert(p.Layout(), qt.Equals, "")
c.Assert(p.NameNoIdentifier(), qt.Equals, "myshortcode")
},
},
}
for _, test := range tests {
c.Run(test.name, func(c *qt.C) {
if test.name != "Shortcode lang layout" {
// return
}
test.assert(c, testParser.Parse(files.ComponentFolderLayouts, test.path))
})
}
}
func TestHasExt(t *testing.T) {
c := qt.New(t)

View file

@ -78,3 +78,26 @@ disablePathToLower = true
b.AssertFileContent("public/en/mysection/mybundle/index.html", "en|Single")
b.AssertFileContent("public/fr/MySection/MyBundle/index.html", "fr|Single")
}
func TestIssue13596(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ['home','rss','section','sitemap','taxonomy','term']
-- content/p1/index.md --
---
title: p1
---
-- content/p1/a.1.txt --
-- content/p1/a.2.txt --
-- layouts/all.html --
{{ range .Resources.Match "*" }}{{ .Name }}|{{ end }}
`
b := hugolib.Test(t, files)
b.AssertFileContent("public/p1/index.html", "a.1.txt|a.2.txt|")
b.AssertFileExists("public/p1/a.1.txt", true)
b.AssertFileExists("public/p1/a.2.txt", true) // fails
}

View file

@ -1,27 +0,0 @@
// Code generated by "stringer -type=PathType"; DO NOT EDIT.
package paths
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[PathTypeFile-0]
_ = x[PathTypeContentResource-1]
_ = x[PathTypeContentSingle-2]
_ = x[PathTypeLeaf-3]
_ = x[PathTypeBranch-4]
}
const _PathType_name = "PathTypeFilePathTypeContentResourcePathTypeContentSinglePathTypeLeafPathTypeBranch"
var _PathType_index = [...]uint8{0, 12, 35, 56, 68, 82}
func (i PathType) String() string {
if i < 0 || i >= PathType(len(_PathType_index)-1) {
return "PathType(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _PathType_name[_PathType_index[i]:_PathType_index[i+1]]
}

View file

@ -0,0 +1,32 @@
// Code generated by "stringer -type Type"; DO NOT EDIT.
package paths
import "strconv"
func _() {
// An "invalid array index" compiler error signifies that the constant values have changed.
// Re-run the stringer command to generate them again.
var x [1]struct{}
_ = x[TypeFile-0]
_ = x[TypeContentResource-1]
_ = x[TypeContentSingle-2]
_ = x[TypeLeaf-3]
_ = x[TypeBranch-4]
_ = x[TypeContentData-5]
_ = x[TypeMarkup-6]
_ = x[TypeShortcode-7]
_ = x[TypePartial-8]
_ = x[TypeBaseof-9]
}
const _Type_name = "TypeFileTypeContentResourceTypeContentSingleTypeLeafTypeBranchTypeContentDataTypeMarkupTypeShortcodeTypePartialTypeBaseof"
var _Type_index = [...]uint8{0, 8, 27, 44, 52, 62, 77, 87, 100, 111, 121}
func (i Type) String() string {
if i < 0 || i >= Type(len(_Type_index)-1) {
return "Type(" + strconv.FormatInt(int64(i), 10) + ")"
}
return _Type_name[_Type_index[i]:_Type_index[i+1]]
}

View file

@ -1,4 +1,4 @@
// Copyright 2021 The Hugo Authors. All rights reserved.
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ import (
"net/url"
"path"
"path/filepath"
"runtime"
"strings"
)
@ -159,31 +160,6 @@ func Uglify(in string) string {
return path.Clean(in)
}
// UrlToFilename converts the URL s to a filename.
// If ParseRequestURI fails, the input is just converted to OS specific slashes and returned.
func UrlToFilename(s string) (string, bool) {
u, err := url.ParseRequestURI(s)
if err != nil {
return filepath.FromSlash(s), false
}
p := u.Path
if p == "" {
p, _ = url.QueryUnescape(u.Opaque)
return filepath.FromSlash(p), true
}
p = filepath.FromSlash(p)
if u.Host != "" {
// C:\data\file.txt
p = strings.ToUpper(u.Host) + ":" + p
}
return p, true
}
// URLEscape escapes unicode letters.
func URLEscape(uri string) string {
// escape unicode letters
@ -193,3 +169,105 @@ func URLEscape(uri string) string {
}
return u.String()
}
// TrimExt trims the extension from a path..
func TrimExt(in string) string {
return strings.TrimSuffix(in, path.Ext(in))
}
// From https://github.com/golang/go/blob/e0c76d95abfc1621259864adb3d101cf6f1f90fc/src/cmd/go/internal/web/url.go#L45
func UrlFromFilename(filename string) (*url.URL, error) {
if !filepath.IsAbs(filename) {
return nil, fmt.Errorf("filepath must be absolute")
}
// If filename has a Windows volume name, convert the volume to a host and prefix
// per https://blogs.msdn.microsoft.com/ie/2006/12/06/file-uris-in-windows/.
if vol := filepath.VolumeName(filename); vol != "" {
if strings.HasPrefix(vol, `\\`) {
filename = filepath.ToSlash(filename[2:])
i := strings.IndexByte(filename, '/')
if i < 0 {
// A degenerate case.
// \\host.example.com (without a share name)
// becomes
// file://host.example.com/
return &url.URL{
Scheme: "file",
Host: filename,
Path: "/",
}, nil
}
// \\host.example.com\Share\path\to\file
// becomes
// file://host.example.com/Share/path/to/file
return &url.URL{
Scheme: "file",
Host: filename[:i],
Path: filepath.ToSlash(filename[i:]),
}, nil
}
// C:\path\to\file
// becomes
// file:///C:/path/to/file
return &url.URL{
Scheme: "file",
Path: "/" + filepath.ToSlash(filename),
}, nil
}
// /path/to/file
// becomes
// file:///path/to/file
return &url.URL{
Scheme: "file",
Path: filepath.ToSlash(filename),
}, nil
}
// UrlStringToFilename converts the URL s to a filename.
// If ParseRequestURI fails, the input is just converted to OS specific slashes and returned.
func UrlStringToFilename(s string) (string, bool) {
u, err := url.ParseRequestURI(s)
if err != nil {
return filepath.FromSlash(s), false
}
p := u.Path
if p == "" {
p, _ = url.QueryUnescape(u.Opaque)
return filepath.FromSlash(p), false
}
if runtime.GOOS != "windows" {
return p, true
}
if len(p) == 0 || p[0] != '/' {
return filepath.FromSlash(p), false
}
p = filepath.FromSlash(p)
if len(u.Host) == 1 {
// file://c/Users/...
return strings.ToUpper(u.Host) + ":" + p, true
}
if u.Host != "" && u.Host != "localhost" {
if filepath.VolumeName(u.Host) != "" {
return "", false
}
return `\\` + u.Host + p, true
}
if vol := filepath.VolumeName(p[1:]); vol == "" || strings.HasPrefix(vol, `\\`) {
return "", false
}
return p[1:], true
}

View file

@ -24,6 +24,9 @@ func (p P[T]) And(ps ...P[T]) P[T] {
return false
}
}
if p == nil {
return true
}
return p(v)
}
}
@ -36,6 +39,9 @@ func (p P[T]) Or(ps ...P[T]) P[T] {
return true
}
}
if p == nil {
return false
}
return p(v)
}
}

View file

@ -51,7 +51,7 @@ func Run[T any](ctx context.Context, cfg Config[T]) Group[T] {
// Buffered for performance.
ch := make(chan T, cfg.NumWorkers)
for i := 0; i < cfg.NumWorkers; i++ {
for range cfg.NumWorkers {
g.Go(func() error {
for {
select {

150
common/tasks/tasks.go Normal file
View file

@ -0,0 +1,150 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package tasks
import (
"sync"
"time"
)
// RunEvery runs a function at intervals defined by the function itself.
// Functions can be added and removed while running.
type RunEvery struct {
// Any error returned from the function will be passed to this function.
HandleError func(string, error)
// If set, the function will be run immediately.
RunImmediately bool
// The named functions to run.
funcs map[string]*Func
mu sync.Mutex
started bool
closed bool
quit chan struct{}
}
type Func struct {
// The shortest interval between each run.
IntervalLow time.Duration
// The longest interval between each run.
IntervalHigh time.Duration
// The function to run.
F func(interval time.Duration) (time.Duration, error)
interval time.Duration
last time.Time
}
func (r *RunEvery) Start() error {
if r.started {
return nil
}
r.started = true
r.quit = make(chan struct{})
go func() {
if r.RunImmediately {
r.run()
}
ticker := time.NewTicker(500 * time.Millisecond)
defer ticker.Stop()
for {
select {
case <-r.quit:
return
case <-ticker.C:
r.run()
}
}
}()
return nil
}
// Close stops the RunEvery from running.
func (r *RunEvery) Close() error {
if r.closed {
return nil
}
r.closed = true
if r.quit != nil {
close(r.quit)
}
return nil
}
// Add adds a function to the RunEvery.
func (r *RunEvery) Add(name string, f Func) {
r.mu.Lock()
defer r.mu.Unlock()
if r.funcs == nil {
r.funcs = make(map[string]*Func)
}
if f.IntervalLow == 0 {
f.IntervalLow = 500 * time.Millisecond
}
if f.IntervalHigh <= f.IntervalLow {
f.IntervalHigh = 20 * time.Second
}
start := max(f.IntervalHigh/3, f.IntervalLow)
f.interval = start
f.last = time.Now()
r.funcs[name] = &f
}
// Remove removes a function from the RunEvery.
func (r *RunEvery) Remove(name string) {
r.mu.Lock()
defer r.mu.Unlock()
delete(r.funcs, name)
}
// Has returns whether the RunEvery has a function with the given name.
func (r *RunEvery) Has(name string) bool {
r.mu.Lock()
defer r.mu.Unlock()
_, found := r.funcs[name]
return found
}
func (r *RunEvery) run() {
r.mu.Lock()
defer r.mu.Unlock()
for name, f := range r.funcs {
if time.Now().Before(f.last.Add(f.interval)) {
continue
}
f.last = time.Now()
interval, err := f.F(f.interval)
if err != nil && r.HandleError != nil {
r.HandleError(name, err)
}
if interval < f.IntervalLow {
interval = f.IntervalLow
}
if interval > f.IntervalHigh {
interval = f.IntervalHigh
}
f.interval = interval
}
}

View file

@ -17,7 +17,6 @@ package terminal
import (
"fmt"
"os"
"runtime"
"strings"
isatty "github.com/mattn/go-isatty"
@ -41,10 +40,6 @@ func PrintANSIColors(f *os.File) bool {
// IsTerminal return true if the file descriptor is terminal and the TERM
// environment variable isn't a dumb one.
func IsTerminal(f *os.File) bool {
if runtime.GOOS == "windows" {
return false
}
fd := f.Fd()
return os.Getenv("TERM") != "dumb" && (isatty.IsTerminal(fd) || isatty.IsCygwinTerminal(fd))
}

54
common/types/closer.go Normal file
View file

@ -0,0 +1,54 @@
// Copyright 2024 The Hugo Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package types
import "sync"
type Closer interface {
Close() error
}
// CloserFunc is a convenience type to create a Closer from a function.
type CloserFunc func() error
func (f CloserFunc) Close() error {
return f()
}
type CloseAdder interface {
Add(Closer)
}
type Closers struct {
mu sync.Mutex
cs []Closer
}
func (cs *Closers) Add(c Closer) {
cs.mu.Lock()
defer cs.mu.Unlock()
cs.cs = append(cs.cs, c)
}
func (cs *Closers) Close() error {
cs.mu.Lock()
defer cs.mu.Unlock()
for _, c := range cs.cs {
c.Close()
}
cs.cs = cs.cs[:0]
return nil
}

View file

@ -69,7 +69,7 @@ func ToStringSlicePreserveStringE(v any) ([]string, error) {
switch vv.Kind() {
case reflect.Slice, reflect.Array:
result = make([]string, vv.Len())
for i := 0; i < vv.Len(); i++ {
for i := range vv.Len() {
s, err := cast.ToStringE(vv.Index(i).Interface())
if err != nil {
return nil, err

Some files were not shown because too many files have changed in this diff Show more