Commit Graph

999 Commits

Author SHA1 Message Date
Alexandre Vaz 88d838a971 commands: Fix github-dark chromastyles
Fixes #14831
2026-05-10 20:19:11 +02:00
Joe Mooring ff22c62a32 commands: Improve description of command flags
Closes #14817
2026-04-30 21:38:44 +02:00
Bjørn Erik Pedersen e3413d927f commands: Add missing import 2026-04-19 15:35:46 +02:00
Bjørn Erik Pedersen b01cc14703 Revert "common/hugo: Deprecate extended and extended_withdeploy editions"
This reverts commit a17bdbc5fa.

Close #14771
2026-04-19 11:15:49 +02:00
Joe Mooring 1eea9fba0b commands: Fix environment isolation for configuration settings
Closes #14763

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 09:40:23 +02:00
Joe Mooring a17bdbc5fa common/hugo: Deprecate extended and extended_withdeploy editions
Closes #14696
2026-04-13 23:18:23 +02:00
Bjørn Erik Pedersen 4f3c39890e commands: Update docs linke to Node.js docs 2026-03-23 18:13:50 +01:00
Alexandre Vaz c4fb61d9df commands: Preserve non-content files in convert output
When running `hugo convert` with `--output`, copy the content tree first so non-content bundle resources are kept in the destination, then overwrite converted content files.

Also avoid recursive self-copy when the output path points inside the content tree by skipping output directories during copy.

Fixes #4621
2026-03-23 17:49:13 +01:00
Bjørn Erik Pedersen d88a29e002 npm: Use workspaces to simplify hugo mod npm pack
Rewrite `hugo mod npm pack` to use npm workspaces. Module deps are now
written to packages/hugoautogen/package.json and the root package.json
gets a "workspaces" reference. A hugo_packagemeta.json sidecar stores a
hash of all input package files so regular commands can warn when npm
deps are out of sync.

Other changes:
- Workspace glob patterns (*, **, {a,b}) are resolved via gobwas/glob.
- Workspaces defined in package.hugo.json are supported.
- package.hugo.json is only recognised at module roots, not in workspaces.
- When package.hugo.json exists, package.json is not mounted or vendored.
- packages/hugoautogen is not mounted or vendored from dependencies.
- Add usePackageJSON import option (auto/always/never) to control whether
  a module's npm deps are included. "auto" checks for Hugo config files
  or package.hugo.json.
- The staleness check is skipped when running `hugo mod npm pack` itself.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 16:00:50 +01:00
Tay 9dd9c76027 commands: Close cpu profile file when StartCPUProfile fails 2026-03-21 21:17:12 +01:00
Joe Mooring d4f2122dea refactor: Deprecate language configuration and template methods
Configuration:

- languageCode      -> locale (either in root or per-language)
- languageName      -> label
- languageDirection -> direction

Methods:

- .Language.LanguageCode      -> .Language.Locale
- .Language.LanguageName      -> .Language.Label
- .Language.LanguageDirection -> .Language.Direction
- .Site.LanguageCode          -> .Site.Language.Locale

Example configuration:

[languages.en]
  direction = 'ltr'
  label     = 'English'
  locale    = 'en-US'
  weight    = 1

Closes #14269

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 11:45:52 +01:00
Joe Mooring 68059972e8 commands: Update link to highlighting style examples
Closes #14556
2026-02-25 12:57:25 +01:00
Bjørn Erik Pedersen dfece5b674 Add Page.GitInfo support for content from Git modules
Use blobless git clone (--filter=blob:none --no-checkout) to fetch
commit history for content from Git modules, then map it using the
existing gitmap library.  Cloned repos are cached in the modulegitinfo file cache.

Closes #14431
Fixes #5533
2026-02-23 17:43:17 +01:00
Bjørn Erik Pedersen 3c823408ee Move common/hugo/HugoInfo to resources/page
* This break the circular dependency between hugolib and resources/page, and allow HugoInfo to use the proper Page ans Site interfaces.
* It's a little misplaced, but it makes everything easier to maintain and test, so that's well worth it.
2026-02-17 19:10:47 +01:00
Bjørn Erik Pedersen 3f9d0ad2b6 commands: Fix --panicOnWarning flag having no effect with module version warnings
The --panicOnWarning flag was not wired into the root command's logger,
so warnings emitted during config loading (such as module version
incompatibility warnings) would not trigger a panic.

Bind the panicOnWarning flag to the rootCommand struct and set the
PanicOnWarningHook on the logger created in createLogger.

Fixes #14524

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 22:34:29 +01:00
Joe Mooring 7850e7ceb5 commands: Skip chmod for files without owner-write permission
Closes #14507

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 18:23:56 +01:00
Joe Mooring 19ab3f581c all: Change site to project where appropriate
Closes #14504
2026-02-12 20:52:56 +01:00
Bjørn Erik Pedersen b358a65c8b Upgrade to Go 1.26 2026-02-12 15:34:33 +01:00
Joe Mooring de0c9f3eca Reapply "release: Support alpha, beta, and RC releases"
This reverts commit e66a33d369.

Closes #14466
2026-02-10 10:40:29 +01:00
Bjørn Erik Pedersen 9045797d5f server: Fix panic when the server browser error handler tried to use a config in a state of flux
I tried and failed to create a test for this, but I have tested this manually.,

Fixes #14470
2026-02-05 20:11:48 +01:00
Bjørn Erik Pedersen e66a33d369 Revert "release: Support alpha, beta, and RC releases"
This reverts commit 663075920a.

Closes #14448
2026-01-28 16:54:57 +01:00
Bjørn Erik Pedersen 608ed09a0a Rename common/maps to common/hmaps (#14384)
Go's stdlid now has a maps package, which is very useful. We have been using imports on the form `xmaps "maps"`, but auto import tools doesn't handle this, which is annoying.

I have been thinking about this for some time, but have been holding back because of all the import changes. However, now is a good time to do this, with very little unmerged code.
2026-01-16 11:47:46 +01:00
Bjørn Erik Pedersen e2e64aeec5 Fix server rebuilds on editing content with Chinese terms
Fixes #14240
2025-12-05 15:53:48 +01:00
Bjørn Erik Pedersen 663075920a release: Support alpha, beta, and RC releases 2025-12-02 18:44:42 +01:00
Bjørn Erik Pedersen 7a43b928a6 Fix slow server startup of very big content trees
As in content trees with 10 thousand of directories and more.

A benchmark with the bottle neck code in `helpers.ExtractAndGroupRootPaths`:

```
                            │ cmp20251125.bench │ fix-extractandgrouproot-14211.bench │
                            │      sec/op       │    sec/op     vs base               │
ExtractAndGroupRootPaths-10     1282818.8µ ± 8%   493.8µ ± 38%  -99.96% (p=0.002 n=6)

                            │ cmp20251125.bench │ fix-extractandgrouproot-14211.bench │
                            │       B/op        │     B/op      vs base               │
ExtractAndGroupRootPaths-10       3343.8Ki ± 0%   146.3Ki ± 0%  -95.63% (p=0.002 n=6)

                            │ cmp20251125.bench │ fix-extractandgrouproot-14211.bench │
                            │     allocs/op     │  allocs/op    vs base               │
ExtractAndGroupRootPaths-10        20.043k ± 0%    2.979k ± 0%  -85.14% (p=0.002 n=6)
```

For test project that started this (a 60k directory conent tree), the server startup with no rendering, wen from 1.5 minutes to less than 4 seconds:

```
hugop server --renderSegments none                        main ✚ ✖ ✱ ◼
Watching for changes in /Users/bep/dev/sites/hugotestsites/60k/content/{section0,section1,section10,section100,section101,section102,section103,section104,section105,section106,...}
Watching for changes in /Users/bep/dev/sites/hugotestsites/60k/layouts/_default
Watching for config changes in /Users/bep/dev/sites/hugotestsites/60k/config.toml
Start building sites …
hugo v0.153.0-DEV-7e27c303904ed8b221d6a5a4fc9a764bb7b2935b darwin/arm64 BuildDate=2025-11-25T15:02:58Z

                  │ EN
──────────────────┼────
 Pages            │  0
 Paginator pages  │  0
 Non-page files   │  0
 Static files     │  0
 Processed images │  0
 Aliases          │  0
 Cleaned          │  0

Built in 3884 ms
Environment: "development"
Serving pages from disk
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop
```

Note that the output may be a little different and a little more verbose than before., but the information is correct and this implementation is significantly faster and simpler.

Fixes #14211
2025-11-25 22:55:25 +01:00
Ahamed_Meyan 5e6b269c41 static: Preserve .gitignore and .gitattributes in --cleanDestinationDir
Fixes #14097
2025-11-16 11:10:20 +01:00
Bjørn Erik Pedersen 22d0c17e82 docshelper: Fix some YAML serialization issues with sites matrix configuration
Fixes #14132
2025-11-11 13:49:31 +01:00
Alexandru Grigore 0efcb24c37 commands: newDocsHelper encode integers as ints in generated YAML
Previously the JSON -> map roundtrip produced float64 values which caused the YAML encoder to emit integers like 404.0 instead of 404. Use the YAML encoder option yaml.AutoInt() so numbers that are integer-valued are encoded as integers.

This change affects the
ewDocsHelper command (commands/gen.go) where the docs data is written to docs/data/docs.yaml. After this change generated YAML will contain integer values (e.g. status: 404) instead of floats (e.g. status: 404.0).

Fixes #14122
2025-11-09 23:01:16 +01:00
Bjørn Erik Pedersen 04650ce778 all: Run modernize -fix ./...
Closes #14107
2025-11-05 21:05:42 +01:00
Bjørn Erik Pedersen 264022a75a Add roles and versions as new dimensions (in addition to language)
See the main issue #13776 for details.

Fixes #519
Fixes #13680
Fixes #13663
Fixes #13776
Fixes #13855
Fixes #13648
Fixes #13996
Fixes #14001
Fixes #14031
Fixes #13818
Fixes #13196
2025-11-05 20:39:25 +01:00
Bjørn Erik Pedersen a3d9548469 Replace to gopkg.in/yaml with github.com/goccy/go-yaml (note)
This commit also adds validation to prevent the "Billion Laughs" attack (see https://github.com/goccy/go-yaml/issues/461). The limit of non-scalar aliases to the same node is set to 10,000. See benchmarks below.

```                                                            │        sec/op         │
UnmarshalBillionLaughs/Billion_Laughs_no_validation-10                 125.2µ ± ∞ ¹
UnmarshalBillionLaughs/Billion_Laughs_with_validation-10               655.8µ ± ∞ ¹
UnmarshalBillionLaughs/YAML_Front_Matter_no_validation-10              9.223µ ± ∞ ¹
UnmarshalBillionLaughs/YAML_Front_Matter_with_validation-10            9.443µ ± ∞ ¹
geomean                                                                51.71µ
¹ need >= 6 samples for confidence interval at level 0.95

                                                            │ fix-goyaml-8822.bench │
                                                            │         B/op          │
UnmarshalBillionLaughs/Billion_Laughs_no_validation-10                177.0Ki ± ∞ ¹
UnmarshalBillionLaughs/Billion_Laughs_with_validation-10              177.0Ki ± ∞ ¹
UnmarshalBillionLaughs/YAML_Front_Matter_no_validation-10             11.67Ki ± ∞ ¹
UnmarshalBillionLaughs/YAML_Front_Matter_with_validation-10           11.67Ki ± ∞ ¹
geomean                                                               45.45Ki
¹ need >= 6 samples for confidence interval at level 0.95

                                                            │ fix-goyaml-8822.bench │
                                                            │       allocs/op       │
UnmarshalBillionLaughs/Billion_Laughs_no_validation-10                 3.302k ± ∞ ¹
UnmarshalBillionLaughs/Billion_Laughs_with_validation-10               3.305k ± ∞ ¹
UnmarshalBillionLaughs/YAML_Front_Matter_no_validation-10               253.0 ± ∞ ¹
UnmarshalBillionLaughs/YAML_Front_Matter_with_validation-10             253.0 ± ∞ ¹
````

Fixes #8822
Fixes #13043
Fixes #14053
Fixes ##8427
2025-10-18 13:52:22 +02:00
Bjørn Erik Pedersen ec463c0977 Report OSC 9;4 progress when building
As supported by the Ghostty terminal and others.
2025-10-01 14:27:23 +02:00
Joe Mooring 404fd9e512 commands: Map --minify CLI flag to the correct configuration key
Closes #13988
2025-09-18 16:50:47 +02:00
Justus Perlwitz bb4e66cd7c create: Fix new content command with future dates
Fixes #12599
2025-08-27 09:33:17 +02:00
Bjørn Erik Pedersen 61ec7a20a5 commands: Deprecate --omitEmpty on chromastyles command
It's no longer needed -- empty classes are now always omitted.

See  See https://github.com/alecthomas/chroma/commit/5b2a4c5a26c503c79bc86ba3c4ae5b330028bd3d
2025-08-25 18:24:07 +02:00
Bjørn Erik Pedersen c289fcaaaa commands: Add --omitClassComments to the chromastyles command 2025-08-25 18:24:07 +02:00
Bjørn Erik Pedersen d240a705d6 commands: Avoid full browser refresh on simple CSS changes 2025-07-27 14:39:26 +02:00
Bjørn Erik Pedersen f47193669d commands: Make sure the browser gets refreshed on changes when --disableFastRender is set
Fixes #13727
2025-05-23 19:46:16 +02:00
Joe Mooring 9d1d8c8899 commands: Fix description of new theme commands
Fixes #13701
2025-05-09 20:03:21 +02:00
Joe Mooring 673a4d00eb commands/server: Display correct multihost language in console
Fixes #12564
2025-04-28 20:00:15 +02:00
Joe Mooring 24ac6a9de9 commands/new: Improve theme creation
- Update the skeleton structure to match the new template system.
- Add a --format flag to the `hugo new theme` command to control the
  format of the site configuration and default archetype files.
- Remove theme.toml. This file's presence can be confusing for new
  users, and the README in the themes repository already has an example.
- Remove the LICENSE and README files from the skeleton. These files
  are not needed for a theme to work, and they can be added later by
  the user if desired.

Closes #13489
Closes #13544
2025-04-08 16:35:46 +02:00
Bjørn Erik Pedersen 83cfdd78ca Reimplement and simplify Hugo's template system
See #13541 for details.

Fixes #13545
Fixes #13515
Closes #7964
Closes #13365
Closes #12988
Closes #4891
2025-04-06 20:59:41 +02:00
Joe Mooring a98ec3bd01 commands/gen: Set url in command pages to /docs/reference/commands/ 2025-03-14 21:11:46 +01:00
Joe Mooring 93df17661f commands: Add --omitEmpty flag to gen chromastyles
Closes #13475
2025-03-11 16:50:59 +01:00
Bjørn Erik Pedersen 521911a576 all: Run modernize -fix ./... 2025-02-26 11:44:25 +01:00
Joe Mooring ee438606dd commands: Use punctuation consistently in short description 2025-02-13 08:40:26 +01:00
Bjørn Erik Pedersen 9b5f786df8 Deprecate kind, lang, and path from front matter
These were added to the page meta object when we implemented "pages from data", but were not meant to be used in front matter.

That is not supported, so we might as well add validation.

Fixes #12484
2025-02-10 21:22:43 +01:00
Bjørn Erik Pedersen e6feb9e0be commands: Move the CHMOD event filter up
To prevent ghost rebuilds (from VSCode and possibly others).

Fixes #13373
2025-02-10 17:02:06 +01:00
Oleksandr Redko 4245a4514d all: Remove deprecated build tags 2025-02-08 10:29:42 +01:00
Joe Mooring a352e69b02 commands: Validate style argument passed to gen chromastyles
Closes #13357
2025-02-07 22:44:22 +01:00