Commit graph

909 commits

Author SHA1 Message Date
Andreas Deininger 793e38f5ce
commands: Fix help message for hugo new theme
Closes #11161.
2023-06-28 09:30:27 +02:00
Bjørn Erik Pedersen fa0e16f4c7 Fix false path warnings with resources.PostProcess
Fixes #7735
2023-06-27 21:55:35 +02:00
Joe Mooring 019299b0b0 commands: Enable format flag with hugo new site
Fixes #11155
2023-06-24 20:26:54 +02:00
Bjørn Erik Pedersen 5b4bfc2db7 Fix broken nodeploy setup
Fixes #11149
2023-06-23 12:40:43 +02:00
Bjørn Erik Pedersen b1016d2e26
commands: Make hugo env respect --logLevel
Fixes #11145
2023-06-21 23:18:38 +02:00
Brian Knight 49336bfc58
commands: Update Jekyll post-import output
Update CLI output after a successful Jekyll import to
suggest a maintained theme and include clearer steps
to running a server locally.

Fixes #10715

Co-authored-by: Joe Mooring <joe@mooring.com>
2023-06-21 20:38:54 +02:00
hugoreleaser 9df2ec7988 releaser: Bump versions for release of 0.114.0
[ci skip]
2023-06-19 17:01:43 +00:00
Oleksandr Redko 9009c8cdca all: Fix typos in function names and comments 2023-06-19 09:26:29 +02:00
Bjørn Erik Pedersen 12dc9a6e4a deploy: Fix deploy defaults for non-zero flag values (e.g. maxDeletes, invalidateCDN)
This was broken in the config rewrite in Hugo 0.112.0.

The workaround is to be explicit about setting these flag values (even if just using the defaults), e.g.:

```
hugo deploy --invalidateCDN --maxDeletes 256
```

Fixes #11127
2023-06-18 19:38:34 +02:00
Bjørn Erik Pedersen 7c9fada778 Replace the old log setup, with structured logging etc.
Fixes #11124
2023-06-18 13:03:04 +02:00
Bjørn Erik Pedersen ef147f4e87 commands: Remove flags log, verboseLog, add flag logLevel, deprecate flags verbose and debug
Fixes #9648
Fixes #11071
2023-06-13 17:49:38 +02:00
Erica Mays 258884f44f cache: Set default cache path based on $USER
Change the default cache directory to `$TMPDIR/hugo_cache_$USER`, so
that multi-user systems do not have caches that interfere with each
other.  The other cache-choosing logic (e.g. Netlify exceptions,
configuration options) are not affected.

Fixes #7391
2023-06-12 21:33:35 +02:00
Oleksandr Redko b8526f32fa commands,config: Fix typo in log and error messages 2023-06-12 16:45:20 +02:00
hugoreleaser 085c1b3d61 releaser: Bump versions for release of 0.113.0
[ci skip]
2023-06-05 15:04:51 +00:00
Bjørn Erik Pedersen 5446900dee
commands: Update CLI docs vs server and production
Fixes #11067
2023-06-05 11:53:14 +02:00
Bjørn Erik Pedersen cf38c73f53
commands: Add TLS/HTTPS support to hugo server
* commands: Add TLS/HTTPS support to hugo server

The "auto cert" handling in this PR is backed by mkcert (see link below).

To get this up and running on a new PC, you can:

```
hugo server trust
hugo server --tlsAuto
```

When `--tlsAuto` (or `--tlsCertFile` and `--tlsKeyFile`) is set and no `--baseURL` is provided as a flag, the server is
started with TLS and `https` as the protocol.

Note that you only need to run `hugo server trust` once per PC.

If you already have the key and the cert file (e.g. by using mkcert directly), you can do:

```
hugo server --tlsCertFile mycert.pem --tlsKeyFile mykey.pem
```

See https://github.com/FiloSottile/mkcert

Fixes #11064
2023-06-05 09:53:53 +02:00
hugoreleaser 536bf71abe releaser: Prepare repository for 0.113.0-DEV
[ci skip]
2023-06-02 07:19:22 +00:00
hugoreleaser ea3c95a7b0 releaser: Bump versions for release of 0.112.7
[ci skip]
2023-06-02 07:07:11 +00:00
Oleksandr Redko 4c46f9400b all: Replace deprecated ioutil with io and os 2023-06-01 17:52:21 +02:00
hugoreleaser 8c7a4e995b releaser: Prepare repository for 0.113.0-DEV
[ci skip]
2023-06-01 09:15:08 +00:00
hugoreleaser 2ca0fcc448 releaser: Bump versions for release of 0.112.6
[ci skip]
2023-06-01 09:03:29 +00:00
Bjørn Erik Pedersen 0ef2952846 commands: Add --lang to hugo config
Fixes #11057
2023-06-01 10:49:21 +02:00
hugoreleaser d47225ce9e releaser: Bump versions for release of 0.112.5
[ci skip]
2023-05-29 06:43:02 +00:00
hugoreleaser cd59216de4 releaser: Prepare repository for 0.113.0-DEV
[ci skip]
2023-05-28 13:15:07 +00:00
hugoreleaser e285153d7f releaser: Bump versions for release of 0.112.4
[ci skip]
2023-05-28 13:04:00 +00:00
Bjørn Erik Pedersen 51d0a0ab01
commands: Add the common build flags to the config commands
Which allows to see the config with `--theme` applied.

Updates #11018
2023-05-28 13:06:26 +02:00
Bjørn Erik Pedersen 43f1282e73 commands: Reinstate some of the removed build flags (e.g. --theme) to new and mod
Fixes #11018
2023-05-28 12:55:44 +02:00
Bjørn Erik Pedersen 273d9f69a6 commands: Fail the build when no config file or config dir
Fixes #11019
2023-05-27 16:56:54 +02:00
Bjørn Erik Pedersen 8f293a1855 Fix --renderStaticToDisk regression
Fixes #11026
2023-05-27 16:56:54 +02:00
Bjørn Erik Pedersen 901cd970db commands: Re-introduce the -f shorthand for hugo new site
Fixes #11015
2023-05-27 16:56:54 +02:00
Bjørn Erik Pedersen f86b5f70a6 commands: Move the --format flag to only the commands that support it
Fixes #11022
2023-05-27 16:56:54 +02:00
hugoreleaser 3297b395d8 releaser: Prepare repository for 0.113.0-DEV
[ci skip]
2023-05-24 14:54:43 +00:00
hugoreleaser ba6f74e404 releaser: Bump versions for release of 0.112.3
[ci skip]
2023-05-24 14:42:50 +00:00
Bjørn Erik Pedersen 231374a1fa Fix regression when loading config -e is empty or HUGO_ENV or HUGO_ENVIRONMENT is set
Fixes #11013
2023-05-24 16:39:31 +02:00
hugoreleaser 5adc837904 releaser: Prepare repository for 0.113.0-DEV
[ci skip]
2023-05-24 10:57:20 +00:00
hugoreleaser f89108f2b1 releaser: Bump versions for release of 0.112.2
[ci skip]
2023-05-24 10:45:31 +00:00
Bjørn Erik Pedersen 9a235d0afc Fix regression with site.IsServer when not running a server
Fixes #11006
2023-05-24 12:42:56 +02:00
hugoreleaser 99407c39ba releaser: Prepare repository for 0.113.0-DEV
[ci skip]
2023-05-23 17:38:44 +00:00
hugoreleaser 7c90c19d28 releaser: Bump versions for release of 0.112.1
[ci skip]
2023-05-23 17:26:16 +00:00
hugoreleaser 0a95d6704a releaser: Bump versions for release of 0.112.0
[ci skip]
2023-05-23 08:14:20 +00:00
Bjørn Erik Pedersen 85b13c105a Add --format to hugo config
Now default to TOML.
2023-05-22 20:26:02 +02:00
Bjørn Erik Pedersen 943ff7f7ce commands: Add missing gen docshelper command
Updates #10953
2023-05-22 18:54:34 +02:00
Bjørn Erik Pedersen 2c3d4dfb74 Add cache busting config to support Tailwind 3
Fixes #10974
2023-05-22 14:14:35 +02:00
Bjørn Erik Pedersen 6ca8a40f25 commands: Make all list commands list what 'all' did before
Also, always include the CSV header.

Updates #10953
2023-05-22 12:27:19 +02:00
Bjørn Erik Pedersen e6dc8053bf
commands: Fix build logic when listing expired/future draft content
Fixes #10972
2023-05-21 10:16:25 +02:00
Bjørn Erik Pedersen 7c7baa6183 Add hugo.WorkingDir
Fixes #10969
2023-05-20 17:45:56 +02:00
Bjørn Erik Pedersen 0a51dfac9e commands: Fix data race
By wrapping all use of the shared config in a lock.

Updates #10953
2023-05-19 16:34:22 +02:00
Bjørn Erik Pedersen d6197a41fa Re-add --printUnusedTemplates and --printPathWarnings
And now with tests.

Updates #10953
2023-05-19 11:37:05 +02:00
Benjamin Elder 008170c8a9
Make GOMAXPROCS to be CPU limit aware
Fixes #10950
2023-05-18 19:32:49 +02:00
Bjørn Erik Pedersen 3f00f47535 commands: Load config before creating the filesystem
To allow publishDir to be set in config file.
2023-05-18 15:38:25 +02:00
Bjørn Erik Pedersen 834b3d7e41
Fix some recently introduced error handling issues
Updates #10953
2023-05-18 12:47:23 +02:00
Bjørn Erik Pedersen 8a69ccbb00 commands: Improve the common build flag handling
Updates #10947
2023-05-17 22:13:29 +02:00
Bjørn Erik Pedersen 5251f015bf Re-establish all the server flags
Updates #10947
2023-05-17 22:13:29 +02:00
Bjørn Erik Pedersen 241b21b0fd Create a struct with all of Hugo's config options
Primary motivation is documentation, but it will also hopefully simplify the code.

Also,

* Lower case the default output format names; this is in line with the custom ones (map keys) and how
it's treated all the places. This avoids doing `stringds.EqualFold` everywhere.

Closes #10896
Closes #10620
2023-05-16 18:01:29 +02:00
Bjørn Erik Pedersen 0fbab7cbc5
commands: Fix data race in test
Note that this is a test fix only.
2023-03-14 12:18:42 +01:00
Oleksandr Redko 0f01bd4637 server: Replace golang.org/x/net/context with context 2023-03-08 10:19:25 +01:00
davidejones bebb2b8d0a switch transfers to workers 2023-03-07 15:38:26 +01:00
davidejones e6f029bdee customize parallel transfer count 2023-03-07 15:38:26 +01:00
Oleksandr Redko 36ce3a4a9d Correct typos in Go comments 2023-03-02 16:32:32 +01:00
Oleksandr Redko d453c12742 Replace deprecated ioutil with io and os
https://pkg.go.dev/io/ioutil is deprecated since Go 1.16.
2023-03-01 16:28:43 +01:00
Bjørn Erik Pedersen ce524d0b5e Add a page template func
Fixes #9339
2023-02-25 19:53:18 +01:00
Bjørn Erik Pedersen 1477d0ba90 commands: Fix server url rewrites (http status 200)
Broken by me in Hugo 0.103.0 it seems. A little bit mysterious as it has worked for me after that, but started to fail just
recently.

Closes #10668
2023-01-31 12:42:31 +01:00
Bjørn Erik Pedersen f38a2fbd2e Make hugo.toml the new config.toml
Both will of course work, but hugo.toml will win if both are set.

We should have done this a long time ago, of course, but the reason I'm picking this up now is that my VS Code setup by default picks up some
JSON config schema from some random other software which also names its config files config.toml.

Fixes #8979
2023-01-16 15:34:16 +01:00
Bjørn Erik Pedersen e402d91ee1 Misc doc, code refactoring to improve documentation 2023-01-04 18:01:26 +01:00
Bjørn Erik Pedersen 59af05cabc Add HUGO_PUBLISHDIR to the Node environment
So you can do  `process.env.HUGO_PUBLISHDIR` in your `postcss.config.js` to figure out where Hugo publishes
its files.

Note that the value will always be an absolute file path and will point to a directory on disk even when running `hugo server` in memory mode.

If you write to this folder from PostCSS when running the server, you could run the server with one of these flags:

```
hugo server --renderToDisk
hugo server --renderStaticToDisk
```

Fixes #10554
2022-12-22 12:43:50 +01:00
Bjørn Erik Pedersen d20d2651ea
Allow "fast render mode" even if --disableLiveReload is set
Fixes #10561
2022-12-21 11:02:21 +01:00
Bjørn Erik Pedersen 6db527483d Add any configured Go Workspace file to the config watcher
Fixes #10556
2022-12-19 20:17:33 +01:00
Bjørn Erik Pedersen ad2059878a Also consider wrapped errors when checking for file IsNotExist errors
Fixes #10534
2022-12-14 13:51:06 +01:00
Bjørn Erik Pedersen f97544a830 Make the hugo env non verbose output slightly more verbose
This is how it may look like with a extended build:

```
hugo v0.107.0-6445b1e9ff963b07c55d9d69cb9abef8ef21fc5d+extended darwin/arm64 BuildDate=2022-12-06T11:21:50Z
GOOS="darwin"
GOARCH="arm64"
GOVERSION="go1.19.3"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.2.4"
github.com/sass/dart-sass-embedded/protocol="1.1.0"
github.com/sass/dart-sass-embedded/compiler="1.56.1"
github.com/sass/dart-sass-embedded/implementation="1.56.1"
```
2022-12-06 13:37:08 +01:00
Joe Mooring 85e2ac1a44 commands: Create assets directory with new site
Closes #10460
2022-11-21 09:42:40 +01:00
Bjørn Erik Pedersen 20ef6dcf95
Skip flakey server tests on GitHub Action on Windows 2022-10-26 09:29:55 +02:00
Anthony Fok 0addb302ac server: Fix flaky TestServerPathEncodingIssues tests
Set getNumHomes: 1 to enable 567 ms or 2 s of wait for the server
to be ready in TestServerPathEncodingIssues/Unicode_paths and
TestServerPathEncodingIssues/Windows_multilingual_404.

Fixes #10332
2022-10-04 14:48:29 +02:00
Bjørn Erik Pedersen 4611b6920b Fix htimes /: operation not permitted error on config changes
Regression introduced in v0.104.1.
2022-09-29 12:27:25 +02:00
Bjørn Erik Pedersen 29ccb36069 Fix /static performance regression from Hugo 0.103.0
In `v0.103.0` we added support for `resources.PostProcess` for all file types, not just HTML. We had benchmarks that said we were fine in that department, but those did not consider the static file syncing.

This fixes that by:

* Making sure that the /static syncer always gets its own file system without any checks for the post process token.
* For dynamic files (e.g. rendered HTML files) we add an additional check to make sure that we skip binary files (e.g. images)

Fixes #10328
2022-09-26 19:02:25 +02:00
Bjørn Erik Pedersen f3560aa0e1 server: Fix 404 redirects on Windows
Fixes #10314
2022-09-23 13:07:56 +02:00
Bjørn Erik Pedersen 08f0984f91
commands: Skip flaky test on CI 2022-09-22 11:24:42 +02:00
Bjørn Erik Pedersen 6be6752c8a server: Fix redirects when file path contains bytes > 0x80
Fixes #10287
2022-09-18 15:16:11 +02:00
Bjørn Erik Pedersen 74daca6b30 Support PostProcess for all file types
Not just HTML.

Fixes #10269
2022-09-14 19:09:20 +02:00
Bjørn Erik Pedersen a5cda5ca4d server: Add 404 support 2022-09-14 14:25:33 +02:00
satotake ab5ce59894 Fix usage description 2022-09-08 15:35:11 +02:00
satotake 7d40da876c Add --force to hugo new
Closes #9243
2022-09-08 15:35:11 +02:00
Bjørn Erik Pedersen 45e1084ff2
Add linux/arm64 extended to release setup
Fixes #8257
2022-08-28 18:23:01 +02:00
Bjørn Erik Pedersen 35fa192838 deps: Udpate to github.com/alecthomas/chroma/v2
Fixes #9932
Fixes #9931
2022-06-14 14:08:40 +02:00
Bjørn Erik Pedersen cbc35c48d2 Respect NO_COLOR
Fixes #10004
2022-06-13 18:07:37 +02:00
Paul van Brouwershaven c7d5f9f067
resources: Register MediaTypes before build
Fixes #9971
2022-06-03 21:37:50 +02:00
Bjørn Erik Pedersen 653ab2cc1f
commands: Fix case where languages cannot be configured
There are some commands that needs to complete without a complete configuration.
2022-05-27 13:34:20 +02:00
Bjørn Erik Pedersen 8ca7052528
server: Skip watching dirs in ignoreFiles
Fixes #9838
2022-05-25 18:31:00 +02:00
satotake 6f7fbe03b1 basefs: add noBuildLock flag
If the flag is enabled, `.hugo_build.lock` will not be created.
This ensures safe running on read-only filesystem etc.
Close #9780
2022-05-24 13:57:23 +02:00
satotake 2fc2e9c871 import: Fix importing jekyll site
Just use `afero.OsFs` without building site.
Close #9817
2022-05-21 23:44:40 +02:00
Bjørn Erik Pedersen 2f9eac480f server: Fix multihost crash
As introduced in v0.99.0.

Fixes #9901
2022-05-18 11:10:04 +02:00
Bjørn Erik Pedersen 657d1a2d95
server: Refresh the error template
We cannot cache it forever, as that will not allow the end user to edit and preview it.
2022-05-16 09:24:30 +02:00
Bjørn Erik Pedersen 87a22eb6d6 server: Fix SIGINT handling after loading bad configuration
Also fix the config error messages.

Fixes #9664
2022-05-15 22:58:05 +02:00
Bjørn Erik Pedersen fc9f315d86 Improve SASS errors
Fixes #9897
2022-05-15 20:25:25 +02:00
Bjørn Erik Pedersen 5c96bda70a
errors: Misc improvements
* Redo the server error template
* Always add the content file context if relevant
* Remove some now superflous error string matching
* Move the server error template to _server/error.html
* Add file context (with position) to codeblock render blocks
* Improve JS build errors

Fixes #9892
Fixes #9891
Fixes #9893
2022-05-14 13:40:56 +02:00
Bjørn Erik Pedersen 4a96df96d9
server: Always rebuild the files involved in an error
Fixes #9884
2022-05-14 13:40:56 +02:00
Bjørn Erik Pedersen 51f08b0b6a Revise the use of htime.Since/htime.Now
We cannot (also, it doesn't add any value)  use that when the `clock` is set,

* To measure time (before that global is set)
* To compare file timestamps re cache eviction

Fixes #9868
2022-05-09 14:18:40 +02:00
Bjørn Erik Pedersen 35c88a7f90 Use configured timeZone for the clock
And some other related adjustments.

Updates #8787
2022-05-08 16:56:26 +02:00
satotake e77ca3c105 Add clock cli flag
Close #8787
2022-05-08 16:56:26 +02:00
Bjørn Erik Pedersen f2946da9e8 Improve error messages, esp. when the server is running
* Add file context to minifier errors when publishing
* Misc fixes (see issues)
* Allow custom server error template in layouts/server/error.html

To get to this, this commit also cleans up and simplifies the code surrounding errors and files. This also removes the usage of `github.com/pkg/errors`, mostly because of https://github.com/pkg/errors/issues/223 -- but also because most of this is now built-in to Go.

Fixes #9852
Fixes #9857
Fixes #9863
2022-05-06 19:43:22 +02:00
Bjørn Erik Pedersen 9b352f04a3 Fix syncing of /static regression
As introduced in Hugo `v0.76.1`.

And add a proper test for it.

Fixes  #9794
Closes #9788
2022-04-18 19:17:27 +02:00