Compare commits

...

217 Commits

Author SHA1 Message Date
Bjørn Erik Pedersen f5fefeda8f deps: Upgrade github.com/bep/lazycache v0.6.0 => v0.7.0 2024-10-27 11:39:30 +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 '39fd3b557014e339bc6c68a7ff34a7734a735ee0' 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 'dec8cd4ada29218971743333f8ac662a9c06aad8'
2dde06576 output: Fix docshelper template lookup order for AMP pages

git-subtree-dir: docs
git-subtree-split: ccb1b97cbb
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 'a6e635ca7d905d9ec3ffd708db2694f680b03aae'

git-subtree-dir: docs
git-subtree-split: a49697e536
2024-09-01 14:51:15 +02:00
Bjørn Erik Pedersen 0c453420e6 Merge commit 'dec8cd4ada29218971743333f8ac662a9c06aad8' 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 '8b9803425e63e1b1801f8d5d676e96368d706722'
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: fcc3ed651a
2024-08-09 15:17:43 +02:00
Bjørn Erik Pedersen e99eba39e7 Merge commit 'a6e635ca7d905d9ec3ffd708db2694f680b03aae' 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
613 changed files with 15228 additions and 6388 deletions
+3 -5
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.22300.20200
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.22300.20200
steps:
- *restore-cache
- &attach-workspace
+48
View File
@@ -0,0 +1,48 @@
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 }}
+2 -2
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
+8 -8
View File
@@ -16,13 +16,13 @@ jobs:
test:
strategy:
matrix:
go-version: [1.21.x, 1.22.x]
os: [ubuntu-latest, macos-latest, windows-latest]
go-version: [1.22.x, 1.23.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
+78 -24
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.23.2"
ARG ALPINE_VERSION="3.20"
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 "nodeploy" when building like so:
# docker build --build-arg HUGO_BUILD_TAGS=nodeploy .
#
# 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"]
+3
View File
@@ -102,6 +102,9 @@ Build the extended edition:
```text
CGO_ENABLED=1 go install -tags extended 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
+19 -6
View File
@@ -430,12 +430,25 @@ func (p *Partition[K, V]) doGetOrCreateWitTimeout(key K, duration time.Duration,
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 {
+55
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"
@@ -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 := 0; i < 3; i++ {
for j := 0; j < 3; j++ {
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 := 0; i < 3; i++ {
for j := 0; j < 3; j++ {
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)
+11 -1
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]
+3 -3
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]
+69 -27
View File
@@ -42,6 +42,7 @@ import (
"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"
@@ -66,6 +67,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()
@@ -88,6 +95,11 @@ 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{})
@@ -101,8 +113,8 @@ 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
@@ -144,6 +156,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 {
@@ -160,17 +184,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 {
@@ -193,11 +218,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)
@@ -220,12 +245,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 {
@@ -307,7 +333,8 @@ 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) {
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)
})
@@ -315,7 +342,12 @@ func (r *rootCommand) HugFromConfig(conf *commonConfig) (*hugolib.HugoSites, 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
@@ -418,11 +450,11 @@ func (r *rootCommand) PreRun(cd, runner *simplecobra.Commandeer) error {
r.changesFromBuild = make(chan []identity.Identity, 10)
r.commonConfigs = lazycache.New(lazycache.Options[int32, *commonConfig]{MaxEntries: 5})
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()
},
@@ -475,7 +507,7 @@ func (r *rootCommand) createLogger(running bool) (loggers.Logger, error) {
return loggers.New(optsLogger), nil
}
func (r *rootCommand) Reset() {
func (r *rootCommand) resetLogs() {
r.logger.Reset()
loggers.Log().Reset()
}
@@ -486,16 +518,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")
+33
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)
}
+4 -4
View File
@@ -58,7 +58,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
}
@@ -110,8 +110,8 @@ 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.")
@@ -209,7 +209,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
}
+2 -2
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.`
+2 -2
View File
@@ -42,8 +42,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.
+4 -4
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
},
+2 -1
View File
@@ -273,7 +273,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
+108 -65
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"
@@ -136,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()
@@ -345,7 +340,6 @@ func (c *hugoBuilder) newWatcher(pollIntervalStr string, dirList ...string) (*wa
for {
select {
case changes := <-c.r.changesFromBuild:
c.errState.setBuildErr(nil)
unlock, err := h.LockBuild()
if err != nil {
c.r.logger.Errorln("Failed to acquire a build lock: %s", err)
@@ -358,7 +352,7 @@ func (c *hugoBuilder) newWatcher(pollIntervalStr string, dirList ...string) (*wa
}
if c.s != nil && c.s.doLiveReload {
doReload := c.changeDetector == nil || len(c.changeDetector.changed()) > 0
doReload = doReload || c.showErrorInBrowser && c.errCount() > 0
doReload = doReload || c.showErrorInBrowser && c.errState.buildErr() != nil
if doReload {
livereload.ForceRefresh()
}
@@ -372,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()
}
@@ -419,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) {
@@ -619,6 +619,9 @@ func (c *hugoBuilder) fullRebuild(changeType string) {
// 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)
}
@@ -744,6 +747,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)
@@ -765,6 +782,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
@@ -833,6 +851,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")
@@ -853,19 +876,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()
}
}
@@ -889,43 +913,30 @@ func (c *hugoBuilder) handleEvents(watcher *watcher.Batcher,
}()
if c.s != nil && c.s.doLiveReload {
if len(partitionedEvents.ContentEvents) == 0 && len(partitionedEvents.AssetEvents) > 0 {
if c.errState.wasErr() {
livereload.ForceRefresh()
return
}
changed := c.changeDetector.changed()
if c.changeDetector != nil && len(changed) == 0 {
if c.errState.wasErr() {
livereload.ForceRefresh()
return
}
changed := c.changeDetector.changed()
if c.changeDetector != nil {
lrl.Logf("build changed %d files", len(changed))
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()
// See https://github.com/gohugoio/hugo/issues/12600.
// 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 {
otherChanges = append(otherChanges, ev)
}
}
if len(otherChanges) > 0 {
livereload.ForceRefresh()
// Allow some time for the live reload script to get reconnected.
time.Sleep(200 * time.Millisecond)
}
for _, ev := range cssChanges {
livereload.RefreshPath(h.PathSpec.RelURL(paths.ToSlashTrimLeading(ev), false))
}
otherChanges = append(otherChanges, ev)
}
}
@@ -941,11 +952,36 @@ 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 {
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)
}
}
}
}
@@ -1014,7 +1050,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
}
@@ -1048,42 +1084,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
}
return h.Build(hugolib.BuildCfg{NoBuildLock: true, RecentlyVisited: c.visitedURLs, ErrRecovery: c.errState.wasErr()}, events...)
err = h.Build(hugolib.BuildCfg{NoBuildLock: true, RecentlyVisited: c.visitedURLs, ErrRecovery: c.errState.wasErr()}, events...)
return
}
func (c *hugoBuilder) rebuildSitesForChanges(ids []identity.Identity) error {
c.errState.setBuildErr(nil)
h, err := c.hugo()
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 err
return
}
whatChanged := &hugolib.WhatChanged{}
whatChanged.Add(ids...)
err = h.Build(hugolib.BuildCfg{NoBuildLock: true, WhatChanged: whatChanged, RecentlyVisited: c.visitedURLs, ErrRecovery: c.errState.wasErr()})
c.errState.setBuildErr(err)
return err
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
}
+2 -2
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`."
+2 -2
View File
@@ -199,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`
+14 -9
View File
@@ -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,7 +102,11 @@ 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{
@@ -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
}
@@ -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
}
@@ -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".
+4 -4
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.
@@ -93,7 +93,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
}
@@ -136,7 +136,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
}
@@ -181,7 +181,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.
+20 -22
View File
@@ -162,16 +162,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 +183,16 @@ 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)
f.prev = make(map[string]uint64)
for k, v := range f.current {
f.prev[k] = v
}
f.current = make(map[string]string)
f.current = make(map[string]uint64)
}
func (f *fileChangeDetector) changed() []string {
@@ -508,7 +508,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.
@@ -648,9 +648,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 +658,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
@@ -830,22 +829,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))
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, RecentlyVisited: visited, PartialReRender: true, ErrRecovery: c.errState.wasErr()})
return
}
func (c *serverCommand) serve() error {
@@ -1012,10 +1014,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)
+166
View File
@@ -0,0 +1,166 @@
// 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
}
// 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)
}
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
}
hashOpts := getHashOpts()
defer putHashOpts(hashOpts)
hash, err := hashstructure.Hash(o, hashOpts)
if err != nil {
panic(err)
}
return hash
}
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)
}
+144
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 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 := 0; i < 10; i++ {
i := i
wg.Add(1)
go func() {
defer wg.Done()
for j := 0; j < 100; j++ {
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)
}
})
}
}
+1 -1
View File
@@ -137,7 +137,7 @@ var nilPointerErrRe = regexp.MustCompile(`at <(.*)>: error calling (.*?): runtim
const deferredPrefix = "__hdeferred/"
var deferredStringToRemove = regexp.MustCompile(`executing "__hdeferred/.*" `)
var deferredStringToRemove = regexp.MustCompile(`executing "__hdeferred/.*?" `)
// ImproveRenderErr improves the error message for rendering errors.
func ImproveRenderErr(inErr error) (outErr error) {
+3 -2
View File
@@ -268,7 +268,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
}
+30
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))
}
+26 -1
View File
@@ -14,6 +14,7 @@
package hugo
import (
"context"
"fmt"
"html/template"
"os"
@@ -29,6 +30,7 @@ import (
"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/hugofs/files"
@@ -69,6 +71,9 @@ type HugoInfo struct {
conf ConfigProvider
deps []*Dependency
// Context gives access to some of the context scoped variables.
Context Context
}
// Version returns the current version as a comparable version string.
@@ -127,6 +132,26 @@ func (i HugoInfo) IsMultilingual() bool {
return i.conf.IsMultilingual()
}
type contextKey string
var markupScope = hcontext.NewContextDispatcher[string](contextKey("markupScope"))
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
@@ -276,7 +301,7 @@ 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"),
)
}
+14
View File
@@ -14,6 +14,7 @@
package hugo
import (
"context"
"fmt"
"testing"
@@ -64,6 +65,19 @@ func TestDeprecationLogLevelFromVersion(t *testing.T) {
c.Assert(deprecationLogLevelFromVersion(ver.String()), 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 {
environment string
running bool
+1 -1
View File
@@ -17,7 +17,7 @@ package hugo
// This should be the only one.
var CurrentVersion = Version{
Major: 0,
Minor: 129,
Minor: 137,
PatchLevel: 0,
Suffix: "-DEV",
}
+2 -2
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
}
+1 -1
View File
@@ -110,7 +110,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)
}
+8 -5
View File
@@ -40,22 +40,25 @@ func (c *Cache[K, T]) Get(key K) (T, bool) {
}
// 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
}
// Set sets the given key to the given value.
+2 -2
View File
@@ -153,7 +153,7 @@ func (pp *PathParser) doParse(component, s string, p *Path) (*Path, error) {
} else {
high = len(p.s)
}
id := types.LowHigh{Low: i + 1, High: high}
id := types.LowHigh[string]{Low: i + 1, High: high}
if len(p.identifiers) == 0 {
p.identifiers = append(p.identifiers, id)
} else if len(p.identifiers) == 1 {
@@ -260,7 +260,7 @@ type Path struct {
component string
bundleType PathType
identifiers []types.LowHigh
identifiers []types.LowHigh[string]
posIdentifierLanguage int
disabled bool
+18 -2
View File
@@ -13,8 +13,24 @@
package hstring
type RenderedString string
import (
"html/template"
func (s RenderedString) String() string {
"github.com/gohugoio/hugo/common/types"
)
var _ types.PrintableValueProvider = HTML("")
// HTML is a string that represents rendered HTML.
// When printed in templates it will be rendered as template.HTML and considered safe so no need to pipe it into `safeHTML`.
// This type was introduced as a wasy to prevent a common case of inifinite recursion in the template rendering
// when the `linkify` option is enabled with a common (wrong) construct like `{{ .Text | .Page.RenderString }}` in a hook template.
type HTML string
func (s HTML) String() string {
return string(s)
}
func (s HTML) PrintableValue() any {
return template.HTML(s)
}
+2 -2
View File
@@ -25,6 +25,6 @@ func TestRenderedString(t *testing.T) {
c := qt.New(t)
// Validate that it will behave like a string in Hugo settings.
c.Assert(cast.ToString(RenderedString("Hugo")), qt.Equals, "Hugo")
c.Assert(template.HTML(RenderedString("Hugo")), qt.Equals, template.HTML("Hugo"))
c.Assert(cast.ToString(HTML("Hugo")), qt.Equals, "Hugo")
c.Assert(template.HTML(HTML("Hugo")), qt.Equals, template.HTML("Hugo"))
}
+34 -2
View File
@@ -107,12 +107,20 @@ func Unwrapv(v any) any {
return v
}
// LowHigh is typically used to represent a slice boundary.
type LowHigh struct {
// LowHigh represents a byte or slice boundary.
type LowHigh[S ~[]byte | string] struct {
Low int
High int
}
func (l LowHigh[S]) IsZero() bool {
return l.Low < 0 || (l.Low == 0 && l.High == 0)
}
func (l LowHigh[S]) Value(source S) S {
return source[l.Low:l.High]
}
// This is only used for debugging purposes.
var InvocationCounter atomic.Int64
@@ -120,3 +128,27 @@ var InvocationCounter atomic.Int64
func NewBool(b bool) *bool {
return &b
}
// PrintableValueProvider is implemented by types that can provide a printable value.
type PrintableValueProvider interface {
PrintableValue() any
}
var _ PrintableValueProvider = Result[any]{}
// Result is a generic result type.
type Result[T any] struct {
// The result value.
Value T
// The error value.
Err error
}
// PrintableValue returns the value or panics if there is an error.
func (r Result[T]) PrintableValue() any {
if r.Err != nil {
panic(r.Err)
}
return r.Value
}
+22
View File
@@ -27,3 +27,25 @@ func TestKeyValues(t *testing.T) {
c.Assert(kv.KeyString(), qt.Equals, "key")
c.Assert(kv.Values, qt.DeepEquals, []any{"a1", "a2"})
}
func TestLowHigh(t *testing.T) {
c := qt.New(t)
lh := LowHigh[string]{
Low: 2,
High: 10,
}
s := "abcdefghijklmnopqrstuvwxyz"
c.Assert(lh.IsZero(), qt.IsFalse)
c.Assert(lh.Value(s), qt.Equals, "cdefghij")
lhb := LowHigh[[]byte]{
Low: 2,
High: 10,
}
sb := []byte(s)
c.Assert(lhb.IsZero(), qt.IsFalse)
c.Assert(lhb.Value(sb), qt.DeepEquals, []byte("cdefghij"))
}
+6 -3
View File
@@ -182,6 +182,9 @@ type Config struct {
// Pagination configuration.
Pagination config.Pagination `mapstructure:"-"`
// Page configuration.
Page config.PageConfig `mapstructure:"-"`
// Privacy configuration.
Privacy privacy.Config `mapstructure:"-"`
@@ -378,12 +381,12 @@ func (c *Config) CompileConfig(logger loggers.Logger) error {
// Legacy paginate values.
if c.Paginate != 0 {
hugo.Deprecate("site config key paginate", "Use paginator.pagerSize instead.", "v0.128.0")
hugo.Deprecate("site config key paginate", "Use pagination.pagerSize instead.", "v0.128.0")
c.Pagination.PagerSize = c.Paginate
}
if c.PaginatePath != "" {
hugo.Deprecate("site config key paginatePath", "Use paginator.path instead.", "v0.128.0")
hugo.Deprecate("site config key paginatePath", "Use pagination.path instead.", "v0.128.0")
c.Pagination.Path = c.PaginatePath
}
@@ -806,7 +809,7 @@ func (c *Configs) Init() error {
}
if len(c.Modules) == 0 {
return errors.New("no modules loaded (ned at least the main module)")
return errors.New("no modules loaded (need at least the main module)")
}
// Apply default project mounts.
+16 -25
View File
@@ -103,31 +103,7 @@ suffixes = ["html", "xhtml"]
b.Assert(contentTypes.Markdown.Suffixes(), qt.DeepEquals, []string{"md", "mdown", "markdown"})
}
func TestPaginationConfigOld(t *testing.T) {
files := `
-- hugo.toml --
[languages.en]
weight = 1
paginatePath = "page-en"
[languages.de]
weight = 2
paginatePath = "page-de"
paginate = 20
`
b := hugolib.Test(t, files)
confEn := b.H.Sites[0].Conf.Pagination()
confDe := b.H.Sites[1].Conf.Pagination()
b.Assert(confEn.Path, qt.Equals, "page-en")
b.Assert(confEn.PagerSize, qt.Equals, 10)
b.Assert(confDe.Path, qt.Equals, "page-de")
b.Assert(confDe.PagerSize, qt.Equals, 20)
}
func TestPaginationConfigNew(t *testing.T) {
func TestPaginationConfig(t *testing.T) {
files := `
-- hugo.toml --
[languages.en]
@@ -184,3 +160,18 @@ title: "p3"
b.AssertFileExists("public/page/1/index.html", false)
b.AssertFileContent("public/page/2/index.html", "pagination-default")
}
func TestMapUglyURLs(t *testing.T) {
files := `
-- hugo.toml --
[uglyurls]
posts = true
`
b := hugolib.Test(t, files)
c := b.H.Configs.Base
b.Assert(c.C.IsUglyURLSection("posts"), qt.IsTrue)
b.Assert(c.C.IsUglyURLSection("blog"), qt.IsFalse)
}
+21
View File
@@ -327,6 +327,25 @@ var allDecoderSetups = map[string]decodeWeight{
return err
},
},
"page": {
key: "page",
decode: func(d decodeWeight, p decodeConfig) error {
p.c.Page = config.PageConfig{
NextPrevSortOrder: "desc",
NextPrevInSectionSortOrder: "desc",
}
if p.p.IsSet(d.key) {
if err := mapstructure.WeakDecode(p.p.Get(d.key), &p.c.Page); err != nil {
return err
}
}
return nil
},
getCompiler: func(c *Config) configCompiler {
return &c.Page
},
},
"pagination": {
key: "pagination",
decode: func(d decodeWeight, p decodeConfig) error {
@@ -400,6 +419,8 @@ var allDecoderSetups = map[string]decodeWeight{
p.c.UglyURLs = vv
case string:
p.c.UglyURLs = vv == "true"
case maps.Params:
p.c.UglyURLs = cast.ToStringMapBool(maps.CleanConfigStringMap(vv))
default:
p.c.UglyURLs = cast.ToStringMapBool(v)
}
+17 -13
View File
@@ -64,7 +64,7 @@ func LoadConfig(d ConfigSourceDescriptor) (*Configs, error) {
return nil, fmt.Errorf("failed to create config from result: %w", err)
}
moduleConfig, modulesClient, err := l.loadModules(configs)
moduleConfig, modulesClient, err := l.loadModules(configs, d.IgnoreModuleDoesNotExist)
if err != nil {
return nil, fmt.Errorf("failed to load modules: %w", err)
}
@@ -116,6 +116,9 @@ type ConfigSourceDescriptor struct {
// Defaults to os.Environ if not set.
Environ []string
// If set, this will be used to ignore the module does not exist error.
IgnoreModuleDoesNotExist bool
}
func (d ConfigSourceDescriptor) configFilenames() []string {
@@ -453,7 +456,7 @@ func (l *configLoader) loadConfigMain(d ConfigSourceDescriptor) (config.LoadConf
return res, l.ModulesConfig, err
}
func (l *configLoader) loadModules(configs *Configs) (modules.ModulesConfig, *modules.Client, error) {
func (l *configLoader) loadModules(configs *Configs, ignoreModuleDoesNotExist bool) (modules.ModulesConfig, *modules.Client, error) {
bcfg := configs.LoadingInfo.BaseConfig
conf := configs.Base
workingDir := bcfg.WorkingDir
@@ -487,17 +490,18 @@ func (l *configLoader) loadModules(configs *Configs) (modules.ModulesConfig, *mo
}
modulesClient := modules.NewClient(modules.ClientConfig{
Fs: l.Fs,
Logger: l.Logger,
Exec: ex,
HookBeforeFinalize: hook,
WorkingDir: workingDir,
ThemesDir: themesDir,
PublishDir: publishDir,
Environment: l.Environment,
CacheDir: conf.Caches.CacheDirModules(),
ModuleConfig: conf.Module,
IgnoreVendor: ignoreVendor,
Fs: l.Fs,
Logger: l.Logger,
Exec: ex,
HookBeforeFinalize: hook,
WorkingDir: workingDir,
ThemesDir: themesDir,
PublishDir: publishDir,
Environment: l.Environment,
CacheDir: conf.Caches.CacheDirModules(),
ModuleConfig: conf.Module,
IgnoreVendor: ignoreVendor,
IgnoreModuleDoesNotExist: ignoreModuleDoesNotExist,
})
moduleConfig, err := modulesClient.Collect()
+15
View File
@@ -422,3 +422,18 @@ type Pagination struct {
// Whether to disable generation of alias for the first pagination page.
DisableAliases bool
}
// PageConfig configures the behavior of pages.
type PageConfig struct {
// Sort order for Page.Next and Page.Prev. Default "desc" (the default page sort order in Hugo).
NextPrevSortOrder string
// Sort order for Page.NextInSection and Page.PrevInSection. Default "desc".
NextPrevInSectionSortOrder string
}
func (c *PageConfig) CompileConfig(loggers.Logger) error {
c.NextPrevInSectionSortOrder = strings.ToLower(c.NextPrevInSectionSortOrder)
c.NextPrevSortOrder = strings.ToLower(c.NextPrevSortOrder)
return nil
}
+2 -2
View File
@@ -16,13 +16,13 @@ package config
import (
"encoding/json"
"github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/common/hashing"
)
func DecodeNamespace[S, C any](configSource any, buildConfig func(any) (C, any, error)) (*ConfigNamespace[S, C], error) {
// Calculate the hash of the input (not including any defaults applied later).
// This allows us to introduce new config options without breaking the hash.
h := identity.HashString(configSource)
h := hashing.HashString(configSource)
// Build the config
c, ext, err := buildConfig(configSource)
+1 -1
View File
@@ -43,7 +43,7 @@ func TestNamespace(t *testing.T) {
c.Assert(err, qt.IsNil)
c.Assert(ns, qt.Not(qt.IsNil))
c.Assert(ns.SourceStructure, qt.DeepEquals, map[string]interface{}{"foo": "bar"})
c.Assert(ns.SourceHash, qt.Equals, "14368731254619220105")
c.Assert(ns.SourceHash, qt.Equals, "1450430416588600409")
c.Assert(ns.Config, qt.DeepEquals, &tstNsExt{Foo: "bar"})
c.Assert(ns.Signature(), qt.DeepEquals, []*tstNsExt(nil))
}
+1
View File
@@ -37,6 +37,7 @@ var DefaultConfig = Config{
Allow: MustNewWhitelist(
"^(dart-)?sass(-embedded)?$", // sass, dart-sass, dart-sass-embedded.
"^go$", // for Go Modules
"^git$", // For Git info
"^npx$", // used by all Node tools (Babel, PostCSS).
"^postcss$",
"^tailwindcss$",
+1 -1
View File
@@ -135,7 +135,7 @@ func TestToTOML(t *testing.T) {
got := DefaultConfig.ToTOML()
c.Assert(got, qt.Equals,
"[security]\n enableInlineShortcodes = false\n\n [security.exec]\n allow = ['^(dart-)?sass(-embedded)?$', '^go$', '^npx$', '^postcss$', '^tailwindcss$']\n osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|SYSTEMDRIVE)$']\n\n [security.funcs]\n getenv = ['^HUGO_', '^CI$']\n\n [security.http]\n methods = ['(?i)GET|POST']\n urls = ['.*']",
"[security]\n enableInlineShortcodes = false\n\n [security.exec]\n allow = ['^(dart-)?sass(-embedded)?$', '^go$', '^git$', '^npx$', '^postcss$', '^tailwindcss$']\n osEnv = ['(?i)^((HTTPS?|NO)_PROXY|PATH(EXT)?|APPDATA|TE?MP|TERM|GO\\w+|(XDG_CONFIG_)?HOME|USERPROFILE|SSH_AUTH_SOCK|DISPLAY|LANG|SYSTEMDRIVE)$']\n\n [security.funcs]\n getenv = ['^HUGO_', '^CI$']\n\n [security.http]\n methods = ['(?i)GET|POST']\n urls = ['.*']",
)
}
@@ -1,5 +0,0 @@
+++
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
date = {{ .Date }}
draft = true
+++
+21
View File
@@ -76,6 +76,11 @@ func CreateSite(createpath string, sourceFs afero.Fs, force bool, format string)
return err
}
err = newSiteCreateArchetype(sourceFs, createpath, format)
if err != nil {
return err
}
return copyFiles(createpath, sourceFs, siteFs)
}
@@ -109,3 +114,19 @@ func newSiteCreateConfig(fs afero.Fs, createpath string, format string) (err err
return helpers.WriteToDisk(filepath.Join(createpath, "hugo."+format), &buf, fs)
}
func newSiteCreateArchetype(fs afero.Fs, createpath string, format string) (err error) {
in := map[string]any{
"title": "{{ replace .File.ContentBaseName \"-\" \" \" | title }}",
"date": "{{ .Date }}",
"draft": true,
}
var buf bytes.Buffer
err = parser.InterfaceToFrontMatter(in, metadecoders.FormatFromString(format), &buf)
if err != nil {
return err
}
return helpers.WriteToDisk(filepath.Join(createpath, "archetypes", "default.md"), &buf, fs)
}
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="{{ or site.Language.LanguageCode }}" dir="{{ or site.Language.LanguageDirection `ltr` }}">
<html lang="{{ site.Language.LanguageCode }}" dir="{{ or site.Language.LanguageDirection `ltr` }}">
<head>
{{ partial "head.html" . }}
</head>
+15
View File
@@ -23,6 +23,7 @@ import (
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/hugofs"
"github.com/gohugoio/hugo/identity"
"github.com/gohugoio/hugo/internal/warpc"
"github.com/gohugoio/hugo/media"
"github.com/gohugoio/hugo/resources/page"
"github.com/gohugoio/hugo/resources/postpub"
@@ -93,6 +94,12 @@ type Deps struct {
// This is common/global for all sites.
BuildState *BuildState
// Holds RPC dispatchers for Katex etc.
// TODO(bep) rethink this re. a plugin setup, but this will have to do for now.
WasmDispatchers *warpc.Dispatchers
isClosed bool
*globalErrHandler
}
@@ -340,9 +347,17 @@ func (d *Deps) TextTmpl() tpl.TemplateParseFinder {
}
func (d *Deps) Close() error {
if d.isClosed {
return nil
}
d.isClosed = true
if d.MemCache != nil {
d.MemCache.Stop()
}
if d.WasmDispatchers != nil {
d.WasmDispatchers.Close()
}
return d.BuildClosers.Close()
}
+2
View File
@@ -71,6 +71,7 @@
"attrlink",
"canonify",
"codeowners",
"dynacache",
"eturl",
"getenv",
"gohugo",
@@ -89,6 +90,7 @@
"# cspell: ignore foreign language words",
"# ----------------------------------------------------------------------",
"bezpieczeństwo",
"blatt",
"buch",
"descripción",
"dokumentation",
@@ -0,0 +1,15 @@
<svg width="150" height="36" viewBox="0 0 150 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M38.9337 13.4895H41.1147C41.4378 13.4895 41.8417 13.4895 42.1648 13.4895C42.5686 13.4895 42.8917 13.4087 43.2148 13.2472C43.5379 13.0856 43.7803 12.9241 43.9418 12.6818C44.1034 12.4394 44.2649 12.0355 44.2649 11.6317C44.2649 11.2278 44.1841 10.8239 44.0226 10.5816C43.861 10.3393 43.6187 10.0969 43.3764 10.0162C43.1341 9.85461 42.811 9.77384 42.4879 9.77384C42.1648 9.69306 41.7609 9.69306 41.4378 9.69306H39.0145V13.4895H38.9337ZM35.2181 6.46204H41.7609C42.6494 6.46204 43.4572 6.54282 44.1841 6.70437C44.9919 6.86592 45.6381 7.18902 46.2035 7.51212C46.769 7.916 47.2536 8.40065 47.5767 9.12763C47.8998 9.77384 48.0614 10.6624 48.0614 11.6317C48.0614 12.8433 47.7383 13.8934 47.0921 14.7011C46.4459 15.5089 45.5573 16.0743 44.3457 16.3166L48.6268 23.5057H44.1841L40.63 16.7205H38.7722V23.5057H35.0565V6.46204H35.2181Z" fill="#425277"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M53.3926 17.6091C53.3926 18.4976 53.6349 19.2246 54.1195 19.79C54.6042 20.3554 55.3312 20.5977 56.2197 20.5977C57.1082 20.5977 57.8352 20.3554 58.3199 19.79C58.8045 19.2246 59.0468 18.4976 59.0468 17.6091C59.0468 16.7205 58.8045 15.9935 58.3199 15.4281C57.8352 14.8627 57.1082 14.6204 56.2197 14.6204C55.3312 14.6204 54.6042 14.8627 54.1195 15.4281C53.6349 16.0743 53.3926 16.7205 53.3926 17.6091ZM49.8384 17.6091C49.8384 16.6397 50 15.832 50.3231 15.105C50.6462 14.378 51.1308 13.7318 51.6963 13.1664C52.2617 12.601 52.9887 12.1971 53.7157 11.9548C54.5234 11.6317 55.3312 11.5509 56.2197 11.5509C57.1082 11.5509 57.916 11.7124 58.7237 11.9548C59.5315 12.2779 60.1777 12.6818 60.7431 13.1664C61.3086 13.7318 61.7932 14.378 62.1163 15.105C62.4394 15.832 62.601 16.7205 62.601 17.6091C62.601 18.5784 62.4394 19.3861 62.1163 20.1131C61.7932 20.8401 61.3086 21.4863 60.7431 22.0517C60.1777 22.6171 59.4507 23.021 58.7237 23.2633C57.916 23.5864 57.1082 23.6672 56.2197 23.6672C55.3312 23.6672 54.5234 23.5057 53.7157 23.2633C52.9079 22.9402 52.2617 22.5364 51.6963 22.0517C51.1308 21.4863 50.6462 20.8401 50.3231 20.1131C50 19.3861 49.8384 18.5784 49.8384 17.6091Z" fill="#425277"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M75.929 23.5057H72.4556V21.8902H72.3748C72.2133 22.1325 72.0517 22.3748 71.8902 22.5364C71.7286 22.7787 71.4863 22.9403 71.1632 23.1826C70.8401 23.3441 70.517 23.5057 70.1939 23.5865C69.79 23.6672 69.4669 23.748 68.9823 23.748C68.0937 23.748 67.3668 23.5865 66.8013 23.3441C66.2359 23.1018 65.832 22.6979 65.5089 22.2133C65.1858 21.7286 65.0243 21.1632 64.8627 20.4362C64.782 19.79 64.7012 19.063 64.7012 18.2553V11.7932H68.2553V17.5283C68.2553 17.8514 68.2553 18.1745 68.2553 18.5784C68.2553 18.9015 68.3361 19.3054 68.4976 19.5477C68.6592 19.79 68.8207 20.1131 69.063 20.2747C69.3054 20.4362 69.6285 20.5978 70.1131 20.5978C70.5978 20.5978 70.9209 20.517 71.244 20.3554C71.5671 20.1939 71.7286 19.9516 71.8902 19.7092C72.0517 19.4669 72.1325 19.1438 72.2133 18.7399C72.2941 18.4168 72.2941 18.013 72.2941 17.6091V11.7932H75.929V23.5057Z" fill="#425277"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M86.3489 14.7011H83.1987V18.5784C83.1987 18.9015 83.1987 19.2246 83.2794 19.4669C83.2794 19.7092 83.3602 19.9515 83.5218 20.1131C83.6026 20.2746 83.7641 20.4362 84.0064 20.5977C84.2488 20.6785 84.5719 20.7593 84.895 20.7593C85.0565 20.7593 85.2988 20.7593 85.6219 20.6785C85.945 20.6785 86.1874 20.517 86.3489 20.4362V23.4249C85.945 23.5864 85.5412 23.6672 85.1373 23.748C84.7334 23.8288 84.2488 23.8288 83.8449 23.8288C83.2795 23.8288 82.714 23.748 82.1486 23.6672C81.6639 23.5057 81.1793 23.3441 80.7754 23.021C80.3715 22.7787 80.1292 22.3748 79.8869 21.8902C79.6446 21.4055 79.5638 20.9208 79.5638 20.2746V14.7011H77.3021V11.7932H79.5638V8.31988H83.1179V11.7932H86.2681V14.7011H86.3489Z" fill="#425277"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M96.1228 16.3166C96.1228 15.6704 95.9612 15.1858 95.5573 14.7819C95.1535 14.378 94.588 14.1357 93.9418 14.1357C93.5379 14.1357 93.2148 14.2165 92.8917 14.2973C92.5686 14.4588 92.3263 14.6204 92.084 14.7819C91.8417 15.0242 91.6801 15.1858 91.5993 15.5089C91.5186 15.7512 91.4378 16.0743 91.357 16.3166H96.1228ZM99.1922 21.4863C98.6268 22.2133 97.8998 22.7787 97.0113 23.1826C96.1228 23.5864 95.2342 23.748 94.2649 23.748C93.3764 23.748 92.5686 23.5864 91.7609 23.3441C90.9531 23.021 90.3069 22.6171 89.7415 22.1325C89.1761 21.567 88.6914 20.9208 88.3683 20.1939C88.0452 19.4669 87.8837 18.5784 87.8837 17.6898C87.8837 16.7205 88.0452 15.9128 88.3683 15.1858C88.6914 14.4588 89.1761 13.8126 89.7415 13.2472C90.3069 12.6817 91.0339 12.2779 91.7609 12.0355C92.5686 11.7124 93.3764 11.6317 94.2649 11.6317C95.0727 11.6317 95.8804 11.7932 96.5266 12.0355C97.1728 12.3586 97.7383 12.7625 98.2229 13.2472C98.7076 13.8126 99.0307 14.4588 99.273 15.1858C99.5153 15.9128 99.6769 16.8013 99.6769 17.6898V18.8207H91.357C91.5186 19.5477 91.8417 20.0323 92.3263 20.4362C92.811 20.8401 93.3764 21.0824 94.1034 21.0824C94.6688 21.0824 95.1535 20.9208 95.5573 20.6785C95.9612 20.4362 96.2843 20.0323 96.6074 19.6284L99.1922 21.4863Z" fill="#425277"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M108.562 11.147L104.766 17.0436H108.562V11.147ZM108.562 20.1131H101.212V17.0436L108.078 6.46205H111.955V17.0436H114.136V20.1131H111.955V23.5057H108.481V20.1131H108.562Z" fill="#FFC63C"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M116.478 6.46205H122.052L126.01 17.6091L129.968 6.46205H135.541V23.5057H131.826V10.42H131.745L127.302 23.5057H124.475L120.194 10.42V23.5057H116.478V6.46205Z" fill="#425277"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M146.446 16.3166C146.446 15.6704 146.284 15.1858 145.88 14.7819C145.477 14.378 144.911 14.1357 144.265 14.1357C143.861 14.1357 143.538 14.2165 143.215 14.2973C142.892 14.4588 142.649 14.6204 142.407 14.7819C142.165 15.0242 142.003 15.1858 141.922 15.5089C141.842 15.7512 141.761 16.0743 141.68 16.3166H146.446ZM149.515 21.4863C148.95 22.2133 148.223 22.7787 147.334 23.1826C146.446 23.5864 145.557 23.748 144.588 23.748C143.7 23.748 142.892 23.5864 142.084 23.3441C141.276 23.021 140.63 22.6171 140.065 22.1325C139.499 21.567 139.015 20.9208 138.691 20.1939C138.368 19.4669 138.207 18.5784 138.207 17.6898C138.207 16.7205 138.368 15.9128 138.691 15.1858C139.015 14.4588 139.499 13.8126 140.065 13.2472C140.63 12.6817 141.357 12.2779 142.084 12.0355C142.892 11.7124 143.7 11.6317 144.588 11.6317C145.396 11.6317 146.204 11.7932 146.85 12.0355C147.496 12.3586 148.061 12.7625 148.546 13.2472C149.031 13.8126 149.354 14.4588 149.596 15.1858C149.838 15.9128 150 16.8013 150 17.6898V18.8207H141.68C141.842 19.5477 142.165 20.0323 142.649 20.4362C143.134 20.8401 143.7 21.0824 144.426 21.0824C144.992 21.0824 145.477 20.9208 145.88 20.6785C146.284 20.4362 146.607 20.0323 146.931 19.6284L149.515 21.4863Z" fill="#425277"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28.1906 1.53473C28.1906 0.646204 28.9176 0 29.7253 0C30.6139 0 31.2601 0.726979 31.2601 1.53473C31.2601 2.42326 30.5331 3.06947 29.7253 3.06947C28.9176 3.15024 28.1906 2.42326 28.1906 1.53473Z" fill="#FF6400"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M0 1.53473C0 0.726979 0.726979 0 1.53473 0C2.42326 0 3.15024 0.726979 3.15024 1.53473C3.15024 2.42326 2.42326 3.15024 1.53473 3.15024C0.726979 3.15024 0 2.42326 0 1.53473Z" fill="#FF6400"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.2941 33.6834C22.2941 32.7948 23.021 32.1486 23.8288 32.1486C24.7173 32.1486 25.3635 32.8756 25.3635 33.6834C25.3635 34.5719 24.6366 35.2181 23.8288 35.2181C23.021 35.2181 22.2941 34.5719 22.2941 33.6834Z" fill="#FF6400"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.0323 6.62363C20.2746 6.86595 20.2746 7.18906 20.0323 7.35061L17.3667 10.0162C17.1244 10.2585 17.2051 10.4201 17.5283 10.5816C19.063 11.1471 20.2746 12.3587 20.7593 13.8126C20.84 14.055 21.0824 14.1357 21.3247 13.9742L23.9903 11.3086C24.2326 11.0663 24.5557 11.0663 24.7173 11.3086L27.0598 13.6511C27.3021 13.8934 27.4636 13.8126 27.4636 13.4895V4.20036C27.4636 4.03881 27.3829 3.95804 27.2213 3.95804H17.8514C17.5282 3.95804 17.5282 4.11959 17.6898 4.36191L20.0323 6.62363ZM13.7318 10.5008C13.9741 10.4201 14.0549 10.1777 13.8934 9.93542L11.2278 7.26983C10.9854 7.0275 10.9854 6.7044 11.2278 6.54285L13.5703 4.20036C13.8126 3.95804 13.7318 3.79649 13.4087 3.79649H4.2003C4.03875 3.95804 3.8772 4.03881 3.8772 4.20036V13.4895C3.8772 13.8126 4.03875 13.8126 4.28107 13.6511L6.62356 11.3086C6.86589 11.0663 7.18899 11.0663 7.35054 11.3086L10.0161 13.9742C10.2585 14.2165 10.42 14.1357 10.5816 13.8126C11.0662 12.2779 12.2778 11.0663 13.7318 10.5008ZM15.9127 21.1632C15.5896 21.1632 15.5089 21.4055 15.5896 21.6479L17.1244 25.0404C17.2051 25.2828 17.1244 25.6059 16.882 25.7674L13.8934 27.1406C13.651 27.3021 13.651 27.4637 13.8934 27.5445L22.6171 30.6947C22.7787 30.7755 22.9402 30.6947 22.9402 30.5332L26.1712 21.8094C26.252 21.5671 26.1712 21.4055 25.8481 21.5671L22.8594 22.9403C22.6171 23.1018 22.294 22.9403 22.1324 22.6979L20.4362 19.063C20.3554 18.8207 20.1131 18.8207 19.9515 18.9823C19.4669 19.6285 18.8207 20.1939 18.0129 20.5978C17.5282 20.8401 16.882 21.0017 16.3166 21.0824C16.3166 21.0824 16.0743 21.1632 15.9127 21.1632Z" fill="#FFC63C"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.7124 15.6705C11.7124 13.4895 13.4895 11.7932 15.5896 11.7932C17.7706 11.7932 19.4668 13.5703 19.4668 15.6705C19.4668 17.8514 17.6898 19.6285 15.5896 19.6285C13.4895 19.5477 11.7124 17.8514 11.7124 15.6705Z" fill="#FF6400"/>
</svg>

After

Width:  |  Height:  |  Size: 9.3 KiB

@@ -6,12 +6,13 @@
bgcolor = "#ffffff"
[[banners]]
name = "Route4Me"
link = "https://route4me.com"
title = "Route Planning & Route Optimization Software"
utm_campaign = "hugosponsor"
bgcolor = "#334799"
link_attr = "style='color: #ffffff; font-weight: bold; text-decoration: none; text-align: center'"
name = "Route4Me"
link = "https://route4me.com/"
title = "Route Planning & Route Optimization Software"
no_query_params = true
utm_campaign = "hugosponsor"
bgcolor = "#334799"
link_attr = "style='color: #ffffff; font-weight: bold; text-decoration: none; text-align: center'"
[[banners]]
name = "Your Company?"
@@ -1,4 +1,4 @@
{{ define "main" }}
{{ $section_to_display := (.Site.Taxonomies.categories.fundamentals).Pages | lang.Merge (.Sites.First.Taxonomies.categories.fundamentals).Pages }}
{{ $section_to_display := (.Site.Taxonomies.categories.fundamentals).Pages | lang.Merge (.Sites.Default.Taxonomies.categories.fundamentals).Pages }}
{{ partial "pagelayout.html" (dict "context" . "section_to_display" $section_to_display ) }}
{{ end }}
@@ -1,5 +1,5 @@
{{ define "main" }}
{{ $paginator := .Paginate (.Pages | lang.Merge (where .Sites.First.RegularPages "Section" .Section)) }}
{{ $paginator := .Paginate (.Pages | lang.Merge (where .Sites.Default.RegularPages "Section" .Section)) }}
{{ $section_to_display := .Sections | default $paginator.Pages }}
{{ partial "pagelayout.html" (dict "context" . "section_to_display" $section_to_display ) }}
{{ end }}
@@ -12,7 +12,7 @@
{{- partial "home-page-sections/features-single.html" . -}}
{{- partial "home-page-sections/showcase.html" . -}}
{{/*- partial "home-page-sections/showcase.html" . -*/}}
<section class="w-100 ph4 ph5-ns pv4 pv6-ns mid-gray bg-white bb bt b--light-gray">
{{- partial "home-page-sections/installation.html" . -}}
@@ -23,7 +23,10 @@
class="{{ $classes_box }} o-100"
style="background-color: {{ .bgcolor }};">
{{ $query_params := .query_params | default "" }}
{{ $url := printf "%s?%s%s" .link $query_params (querify "utm_source" (.utm_source | default $utmSource ) "utm_medium" "banner" "utm_campaign" (.utm_campaign | default "hugosponsor") "utm_content" (.utm_content | default "gohugoio")) | safeURL }}
{{ $url := .link }}
{{ if not .no_query_params }}
{{ $url = printf "%s?%s%s" .link $query_params (querify "utm_source" (.utm_source | default $utmSource ) "utm_medium" "banner" "utm_campaign" (.utm_campaign | default "hugosponsor") "utm_content" (.utm_content | default "gohugoio")) | safeURL }}
{{ end }}
{{ $logo := resources.Get .logo }}
{{ $gtagID := printf "Sponsor %s %s" .name $gtag | title }}
{{ $classes := "" }}
@@ -1,5 +1,6 @@
{{ $text := `
Most of the commands for **Hugo Modules** require a newer version of Go installed (see https://golang.org/dl/) and the relevant VCS client (e.g. Git, see https://git-scm.com/downloads/ ). If you have an "older" site running on Netlify, you may have to set GO_VERSION to 1.12 in your Environment settings.
Most of the commands for **Hugo Modules** require a newer version (>= 1.18) of Go installed (see https://golang.org/dl/) and the relevant VCS client (e.g. Git, see https://git-scm.com/downloads/ ).
If you have an "older" site running on Netlify, you may have to set GO_VERSION to 1.19 or newer in your Environment settings.
For more information about Go Modules, see:
+1 -1
View File
@@ -1 +1 @@
# github.com/gohugoio/gohugoioTheme v0.0.0-20240619093131-b595d5fb8c52
# github.com/gohugoio/gohugoioTheme v0.0.0-20240815082608-66ccd383a90f
+5 -5
View File
@@ -128,11 +128,11 @@ weight = 10
identifier = 'themes'
url = 'https://themes.gohugo.io/'
[[global]]
name = 'Showcase'
weight = 20
identifier = 'showcase'
pageRef = '/showcase/'
# [[global]]
# name = 'Showcase'
# weight = 20
# identifier = 'showcase'
# pageRef = '/showcase/'
# Anything with a weight > 100 gets an external icon
+11 -8
View File
@@ -23,7 +23,7 @@ toc: true
: Render each page of your site to one or more output formats, with granular control by page kind, section, and path. While HTML is the default output format, you can add JSON, RSS, CSV, and more. For example, create a REST API to access content.
[Templates]
: Create templates usings variables, functions, and methods to transform your content, resources, and data into a published page. While HTML templates are the most common, you can create templates for any output format.
: Create templates using variables, functions, and methods to transform your content, resources, and data into a published page. While HTML templates are the most common, you can create templates for any output format.
[Themes]
: Reduce development time and cost by using one of the hundreds of themes contributed by the Hugo community. Themes are available for corporate sites, documentation projects, image portfolios, landing pages, personal and professional blogs, resumes, CVs, and more.
@@ -49,7 +49,7 @@ toc: true
: Leverage the embedded Markdown extensions to create tables, definition lists, footnotes, task lists, inserted text, mark text, subscripts, superscripts, and more.
[Markdown render hooks]
: Override the conversion of Markdown to HTML when rendering fenced code blocks, headings, images, and links. For example, render every standalone image as an HTML `figure` element.
: Override the conversion of Markdown to HTML when rendering blockquotes, fenced code blocks, headings, images, links, and tables. For example, render every standalone image as an HTML `figure` element.
[Diagrams]
: Use fenced code blocks and Markdown render hooks to include diagrams in your content.
@@ -80,17 +80,19 @@ toc: true
[URL management]
: Serve any page from any path via global configuration or on a page-by-page basis.
## Asset pipelines
[CSS bundling]
: Transpile Sass to CSS, bundle, tree shake, minify, create source maps, perform SRI hashing, and integrate with PostCSS.
[Image processing]
: Convert, resize, crop, rotate, adjust colors, apply filters, overlay text and images, and extract EXIF data.
[JavaScript bundling]
: Transpile TypeScript and JSX to JavaScript, bundle, tree shake, minify, create source maps, and perform SRI hashing.
[Image processing]
: Convert, resize, crop, rotate, adjust colors, apply filters, overlay text and images, and extract EXIF data.
[Sass processing]
: Transpile Sass to CSS, bundle, tree shake, minify, create source maps, perform SRI hashing, and integrate with PostCSS.
[Tailwind CSS processing]
: Compile Tailwind CSS utility classes into standard CSS, bundle, tree shake, optimize, minify, perform SRI hashing, and integrate with PostCSS.
## Performance
@@ -104,7 +106,7 @@ toc: true
: Minify HTML, CSS, and JavaScript to reduce file size, bandwidth consumption, and loading times.
[CCPA]: https://en.wikipedia.org/wiki/California_Consumer_Privacy_Act
[CSS bundling]: /functions/resources/tocss/
[Sass processing]: /functions/css/Sass/
[Caching]: /functions/partials/includecached/
[CommonMark]: https://spec.commonmark.org/current/
[Content adapters]: /content-management/content-adapters/
@@ -130,6 +132,7 @@ toc: true
[Segmentation]: /getting-started/configuration/#configure-segments
[Shortcodes]: /content-management/shortcodes/
[Syntax highlighting]: /content-management/syntax-highlighting/
[Tailwind CSS processing]: /functions/css/tailwindcss/
[Taxonomies]: /content-management/taxonomies/
[Templates]: templates/introduction/
[Themes]: https://themes.gohugo.io/
+1 -1
View File
@@ -15,7 +15,7 @@ aliases: [/gdpr/,/about/hugo-and-gdpr/]
General Data Protection Regulation ([GDPR](https://en.wikipedia.org/wiki/General_Data_Protection_Regulation)) is a regulation in EU law on data protection and privacy for all individuals within the European Union and the European Economic Area. It became enforceable on 25 May 2018.
**Hugo is a static site generator. By using Hugo you are already standing on very solid ground. Static HTML files on disk are much easier to reason about compared to server and database driven web sites.**
**Hugo is a static site generator. By using Hugo you are already standing on very solid ground. Static HTML files on disk are much easier to reason about compared to server and database driven websites.**
But even static websites can integrate with external services, so from version `0.41`, Hugo provides a **privacy configuration** that covers the relevant built-in templates.
+13 -12
View File
@@ -5,7 +5,7 @@ url: /commands/hugo/
---
## hugo
hugo builds your site
Build your site
### Synopsis
@@ -70,16 +70,17 @@ hugo [flags]
### SEE ALSO
* [hugo build](/commands/hugo_build/) - Build your site
* [hugo completion](/commands/hugo_completion/) - Generate the autocompletion script for the specified shell
* [hugo config](/commands/hugo_config/) - Print the site configuration
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
* [hugo deploy](/commands/hugo_deploy/) - Deploy your site to a Cloud provider.
* [hugo env](/commands/hugo_env/) - Print Hugo version and environment info
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
* [hugo import](/commands/hugo_import/) - Import your site from others.
* [hugo list](/commands/hugo_list/) - Listing out various types of content
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
* [hugo new](/commands/hugo_new/) - Create new content for your site
* [hugo server](/commands/hugo_server/) - A high performance webserver
* [hugo version](/commands/hugo_version/) - Print Hugo version and environment info
* [hugo config](/commands/hugo_config/) - Display site configuration
* [hugo convert](/commands/hugo_convert/) - Convert front matter to another format
* [hugo deploy](/commands/hugo_deploy/) - Deploy your site to a cloud provider
* [hugo env](/commands/hugo_env/) - Display version and environment info
* [hugo gen](/commands/hugo_gen/) - Generate documentation and syntax highlighting styles
* [hugo import](/commands/hugo_import/) - Import a site from another system
* [hugo list](/commands/hugo_list/) - List content
* [hugo mod](/commands/hugo_mod/) - Manage modules
* [hugo new](/commands/hugo_new/) - Create new content
* [hugo server](/commands/hugo_server/) - Start the embedded web server
* [hugo version](/commands/hugo_version/) - Display version
+74
View File
@@ -0,0 +1,74 @@
---
title: "hugo build"
slug: hugo_build
url: /commands/hugo_build/
---
## hugo build
Build your site
### Synopsis
build 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/.
```
hugo build [flags]
```
### Options
```
-b, --baseURL string hostname (and path) to the root, e.g. https://spf13.com/
-D, --buildDrafts include content marked as draft
-E, --buildExpired include expired content
-F, --buildFuture include content with publishdate in the future
--cacheDir string filesystem path to cache directory
--cleanDestinationDir remove files from destination not found in static directories
--clock string set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
--config string config file (default is hugo.yaml|json|toml)
--configDir string config dir (default "config")
-c, --contentDir string filesystem path to content directory
--debug debug output
-d, --destination string filesystem path to write files to
--disableKinds strings disable different kind of pages (home, RSS etc.)
--enableGitInfo add Git revision, date, author, and CODEOWNERS info to the pages
-e, --environment string build environment
--forceSyncStatic copy all files when static is changed.
--gc enable to run some cleanup tasks (remove unused cache files) after the build
-h, --help help for build
--ignoreCache ignores the cache directory
--ignoreVendorPaths string ignores any _vendor for module paths matching the given Glob pattern
-l, --layoutDir string filesystem path to layout directory
--logLevel string log level (debug|info|warn|error)
--minify minify any supported output format (HTML, XML etc.)
--noBuildLock don't create .hugo_build.lock file
--noChmod don't sync permission mode of files
--noTimes don't sync modification time of files
--panicOnWarning panic on first WARNING log
--poll string set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes
--printI18nWarnings print missing translations
--printMemoryUsage print memory usage to screen at intervals
--printPathWarnings print warnings on duplicate target paths etc.
--printUnusedTemplates print warnings on unused templates.
--quiet build in quiet mode
--renderSegments strings named segments to render (configured in the segments config)
-M, --renderToMemory render to memory (mostly useful when running the server)
-s, --source string filesystem path to read files relative from
--templateMetrics display metrics about template executions
--templateMetricsHints calculate some improvement hints when combined with --templateMetrics
-t, --theme strings themes to use (located in /themes/THEMENAME/)
--themesDir string filesystem path to themes directory
--trace file write trace to file (not useful in general)
-v, --verbose verbose output
-w, --watch watch filesystem for changes and recreate as needed
```
### SEE ALSO
* [hugo](/commands/hugo/) - Build your site
+1 -1
View File
@@ -39,7 +39,7 @@ See each sub-command's help for details on how to use the generated script.
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo](/commands/hugo/) - Build your site
* [hugo completion bash](/commands/hugo_completion_bash/) - Generate the autocompletion script for bash
* [hugo completion fish](/commands/hugo_completion_fish/) - Generate the autocompletion script for fish
* [hugo completion powershell](/commands/hugo_completion_powershell/) - Generate the autocompletion script for powershell
+3 -3
View File
@@ -5,11 +5,11 @@ url: /commands/hugo_config/
---
## hugo config
Print the site configuration
Display site configuration
### Synopsis
Print the site configuration, both default and custom settings.
Display site configuration, both default and custom settings.
```
hugo config [command] [flags]
@@ -48,6 +48,6 @@ hugo config [command] [flags]
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo](/commands/hugo/) - Build your site
* [hugo config mounts](/commands/hugo_config_mounts/) - Print the configured file mounts
@@ -42,5 +42,5 @@ hugo config mounts [flags] [args]
### SEE ALSO
* [hugo config](/commands/hugo_config/) - Print the site configuration
* [hugo config](/commands/hugo_config/) - Display site configuration
+3 -3
View File
@@ -5,11 +5,11 @@ url: /commands/hugo_convert/
---
## hugo convert
Convert your content to different formats
Convert front matter to another format
### Synopsis
Convert your content (e.g. front matter) to different formats.
Convert front matter to another format.
See convert's subcommands toJSON, toTOML and toYAML for more information.
@@ -41,7 +41,7 @@ See convert's subcommands toJSON, toTOML and toYAML for more information.
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo](/commands/hugo/) - Build your site
* [hugo convert toJSON](/commands/hugo_convert_tojson/) - Convert front matter to JSON
* [hugo convert toTOML](/commands/hugo_convert_totoml/) - Convert front matter to TOML
* [hugo convert toYAML](/commands/hugo_convert_toyaml/) - Convert front matter to YAML
@@ -44,5 +44,5 @@ hugo convert toJSON [flags] [args]
### SEE ALSO
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
* [hugo convert](/commands/hugo_convert/) - Convert front matter to another format
@@ -44,5 +44,5 @@ hugo convert toTOML [flags] [args]
### SEE ALSO
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
* [hugo convert](/commands/hugo_convert/) - Convert front matter to another format
@@ -44,5 +44,5 @@ hugo convert toYAML [flags] [args]
### SEE ALSO
* [hugo convert](/commands/hugo_convert/) - Convert your content to different formats
* [hugo convert](/commands/hugo_convert/) - Convert front matter to another format
+3 -3
View File
@@ -5,11 +5,11 @@ url: /commands/hugo_deploy/
---
## hugo deploy
Deploy your site to a Cloud provider.
Deploy your site to a cloud provider
### Synopsis
Deploy your site to a Cloud provider.
Deploy your site to a cloud provider
See https://gohugo.io/hosting-and-deployment/hugo-deploy/ for detailed
documentation.
@@ -52,5 +52,5 @@ hugo deploy [flags] [args]
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo](/commands/hugo/) - Build your site
+3 -3
View File
@@ -5,11 +5,11 @@ url: /commands/hugo_env/
---
## hugo env
Print Hugo version and environment info
Display version and environment info
### Synopsis
Print Hugo version and environment info. This is useful in Hugo bug reports
Display version and environment info. This is useful in Hugo bug reports
```
hugo env [flags] [args]
@@ -41,5 +41,5 @@ hugo env [flags] [args]
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo](/commands/hugo/) - Build your site
+6 -2
View File
@@ -5,7 +5,11 @@ url: /commands/hugo_gen/
---
## hugo gen
A collection of several useful generators.
Generate documentation and syntax highlighting styles
### Synopsis
Generate documentation for your project using Hugo's documentation engine, including syntax highlighting for various programming languages.
### Options
@@ -33,7 +37,7 @@ A collection of several useful generators.
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo](/commands/hugo/) - Build your site
* [hugo gen chromastyles](/commands/hugo_gen_chromastyles/) - Generate CSS stylesheet for the Chroma code highlighter
* [hugo gen doc](/commands/hugo_gen_doc/) - Generate Markdown documentation for the Hugo CLI.
* [hugo gen man](/commands/hugo_gen_man/) - Generate man pages for the Hugo CLI
@@ -47,5 +47,5 @@ hugo gen chromastyles [flags] [args]
### SEE ALSO
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
* [hugo gen](/commands/hugo_gen/) - Generate documentation and syntax highlighting styles
+1 -1
View File
@@ -47,5 +47,5 @@ hugo gen doc [flags] [args]
### SEE ALSO
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
* [hugo gen](/commands/hugo_gen/) - Generate documentation and syntax highlighting styles
+1 -1
View File
@@ -44,5 +44,5 @@ hugo gen man [flags] [args]
### SEE ALSO
* [hugo gen](/commands/hugo_gen/) - A collection of several useful generators.
* [hugo gen](/commands/hugo_gen/) - Generate documentation and syntax highlighting styles
+3 -3
View File
@@ -5,11 +5,11 @@ url: /commands/hugo_import/
---
## hugo import
Import your site from others.
Import a site from another system
### Synopsis
Import your site from other web site generators like Jekyll.
Import a site from another system.
Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_path`.
@@ -39,6 +39,6 @@ Import requires a subcommand, e.g. `hugo import jekyll jekyll_root_path target_p
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo](/commands/hugo/) - Build your site
* [hugo import jekyll](/commands/hugo_import_jekyll/) - hugo import from Jekyll
@@ -44,5 +44,5 @@ hugo import jekyll [flags] [args]
### SEE ALSO
* [hugo import](/commands/hugo_import/) - Import your site from others.
* [hugo import](/commands/hugo_import/) - Import a site from another system
+3 -3
View File
@@ -5,11 +5,11 @@ url: /commands/hugo_list/
---
## hugo list
Listing out various types of content
List content
### Synopsis
Listing out various types of content.
List content.
List requires a subcommand, e.g. hugo list drafts
@@ -39,7 +39,7 @@ List requires a subcommand, e.g. hugo list drafts
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo](/commands/hugo/) - Build your site
* [hugo list all](/commands/hugo_list_all/) - List all content
* [hugo list drafts](/commands/hugo_list_drafts/) - List draft content
* [hugo list expired](/commands/hugo_list_expired/) - List expired content
+1 -1
View File
@@ -41,5 +41,5 @@ hugo list all [flags] [args]
### SEE ALSO
* [hugo list](/commands/hugo_list/) - Listing out various types of content
* [hugo list](/commands/hugo_list/) - List content
+1 -1
View File
@@ -41,5 +41,5 @@ hugo list drafts [flags] [args]
### SEE ALSO
* [hugo list](/commands/hugo_list/) - Listing out various types of content
* [hugo list](/commands/hugo_list/) - List content
@@ -41,5 +41,5 @@ hugo list expired [flags] [args]
### SEE ALSO
* [hugo list](/commands/hugo_list/) - Listing out various types of content
* [hugo list](/commands/hugo_list/) - List content
+1 -1
View File
@@ -41,5 +41,5 @@ hugo list future [flags] [args]
### SEE ALSO
* [hugo list](/commands/hugo_list/) - Listing out various types of content
* [hugo list](/commands/hugo_list/) - List content
@@ -41,5 +41,5 @@ hugo list published [flags] [args]
### SEE ALSO
* [hugo list](/commands/hugo_list/) - Listing out various types of content
* [hugo list](/commands/hugo_list/) - List content
+2 -2
View File
@@ -5,7 +5,7 @@ url: /commands/hugo_mod/
---
## hugo mod
Various Hugo Modules helpers.
Manage modules
### Synopsis
@@ -48,7 +48,7 @@ See https://gohugo.io/hugo-modules/ for more information.
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo](/commands/hugo/) - Build your site
* [hugo mod clean](/commands/hugo_mod_clean/) - Delete the Hugo Module cache for the current project.
* [hugo mod get](/commands/hugo_mod_get/) - Resolves dependencies in your current Hugo Project.
* [hugo mod graph](/commands/hugo_mod_graph/) - Print a module dependency graph.
+1 -1
View File
@@ -48,5 +48,5 @@ hugo mod clean [flags] [args]
### SEE ALSO
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
* [hugo mod](/commands/hugo_mod/) - Manage modules
+1 -1
View File
@@ -72,5 +72,5 @@ hugo mod get [flags] [args]
### SEE ALSO
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
* [hugo mod](/commands/hugo_mod/) - Manage modules
+1 -1
View File
@@ -49,5 +49,5 @@ hugo mod graph [flags] [args]
### SEE ALSO
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
* [hugo mod](/commands/hugo_mod/) - Manage modules
+1 -1
View File
@@ -53,5 +53,5 @@ hugo mod init [flags] [args]
### SEE ALSO
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
* [hugo mod](/commands/hugo_mod/) - Manage modules
+1 -1
View File
@@ -41,6 +41,6 @@ hugo mod npm [command] [flags]
### SEE ALSO
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
* [hugo mod](/commands/hugo_mod/) - Manage modules
* [hugo mod npm pack](/commands/hugo_mod_npm_pack/) - Experimental: Prepares and writes a composite package.json file for your project.
+1 -1
View File
@@ -42,5 +42,5 @@ hugo mod tidy [flags] [args]
### SEE ALSO
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
* [hugo mod](/commands/hugo_mod/) - Manage modules
+1 -1
View File
@@ -48,5 +48,5 @@ hugo mod vendor [flags] [args]
### SEE ALSO
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
* [hugo mod](/commands/hugo_mod/) - Manage modules
+1 -1
View File
@@ -47,5 +47,5 @@ hugo mod verify [flags] [args]
### SEE ALSO
* [hugo mod](/commands/hugo_mod/) - Various Hugo Modules helpers.
* [hugo mod](/commands/hugo_mod/) - Manage modules
+3 -3
View File
@@ -5,7 +5,7 @@ url: /commands/hugo_new/
---
## hugo new
Create new content for your site
Create new content
### Synopsis
@@ -44,8 +44,8 @@ Ensure you run this within the root directory of your site.
### SEE ALSO
* [hugo](/commands/hugo/) - hugo builds your site
* [hugo new content](/commands/hugo_new_content/) - Create new content for your site
* [hugo](/commands/hugo/) - Build your site
* [hugo new content](/commands/hugo_new_content/) - Create new content
* [hugo new site](/commands/hugo_new_site/) - Create a new site (skeleton)
* [hugo new theme](/commands/hugo_new_theme/) - Create a new theme (skeleton)
+2 -2
View File
@@ -5,7 +5,7 @@ url: /commands/hugo_new_content/
---
## hugo new content
Create new content for your site
Create new content
### Synopsis
@@ -56,5 +56,5 @@ hugo new content [path] [flags]
### SEE ALSO
* [hugo new](/commands/hugo_new/) - Create new content for your site
* [hugo new](/commands/hugo_new/) - Create new content
+1 -1
View File
@@ -45,5 +45,5 @@ hugo new site [path] [flags]
### SEE ALSO
* [hugo new](/commands/hugo_new/) - Create new content for your site
* [hugo new](/commands/hugo_new/) - Create new content
+1 -1
View File
@@ -44,5 +44,5 @@ hugo new theme [name] [flags]
### SEE ALSO
* [hugo new](/commands/hugo_new/) - Create new content for your site
* [hugo new](/commands/hugo_new/) - Create new content

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