brevno-suite/hugo
3 years agoreleaser: Bump versions for release of 0.92.2 v0.92.2
hugoreleaser [Fri, 11 Feb 2022 14:17:39 +0000 (14:17 +0000)]
releaser: Bump versions for release of 0.92.2

[ci skip]

3 years agoreleaser: Add release notes for 0.92.2
hugoreleaser [Fri, 11 Feb 2022 14:17:38 +0000 (14:17 +0000)]
releaser: Add release notes for 0.92.2
[ci skip]

3 years agoAdd HUGO_ENV to the os/exec environment
Joe Mooring [Fri, 11 Feb 2022 00:00:54 +0000 (16:00 -0800)]
Add HUGO_ENV to the os/exec environment

Closes #9490

3 years agoSimplify some integration tests
Bjørn Erik Pedersen [Thu, 10 Feb 2022 18:49:20 +0000 (19:49 +0100)]
Simplify some integration tests

3 years agoFix validation of Page Kind in cascade target map
Joe Mooring [Sun, 30 Jan 2022 02:34:27 +0000 (18:34 -0800)]
Fix validation of Page Kind in cascade target map

Fixes #8888

3 years agoAdd another cascade benchmark
Bjørn Erik Pedersen [Thu, 10 Feb 2022 19:37:10 +0000 (20:37 +0100)]
Add another cascade benchmark

3 years agocommands: Fix server deadlock on config error
Bjørn Erik Pedersen [Thu, 10 Feb 2022 16:12:02 +0000 (17:12 +0100)]
commands: Fix server deadlock on config error

Fixes #9486

3 years agoExclude event attributes when rendering markdown
Joe Mooring [Fri, 4 Feb 2022 00:03:25 +0000 (16:03 -0800)]
Exclude event attributes when rendering markdown

Closes #9463

3 years agoRemove the "check" command
Joe Mooring [Tue, 1 Feb 2022 23:04:03 +0000 (15:04 -0800)]
Remove the "check" command

Closes #9454

3 years agoUpdate the application/javascript media type
Joe Mooring [Thu, 10 Feb 2022 06:51:37 +0000 (22:51 -0800)]
Update the application/javascript media type

Add jsm and mjs extensions.
Closes #9483

3 years agotpl/templates: Fix templates.Exist issue with base templates
Bjørn Erik Pedersen [Wed, 9 Feb 2022 14:51:44 +0000 (15:51 +0100)]
tpl/templates: Fix templates.Exist issue with base templates

Fixes #9477

3 years agoAdd a migration test helper
Bjørn Erik Pedersen [Wed, 9 Feb 2022 15:37:21 +0000 (16:37 +0100)]
Add a migration test helper

3 years agobabel: Port integration tests to their own package
Bjørn Erik Pedersen [Wed, 9 Feb 2022 13:15:20 +0000 (14:15 +0100)]
babel: Port integration tests to their own package

3 years agojs: Port integration tests to its own package
Bjørn Erik Pedersen [Wed, 9 Feb 2022 13:14:06 +0000 (14:14 +0100)]
js: Port integration tests to its own package

3 years agopostcss: Move integration test to its own package
Bjørn Erik Pedersen [Wed, 9 Feb 2022 13:12:17 +0000 (14:12 +0100)]
postcss: Move integration test to its own package

3 years agominifier: Port integration tests to its package
Bjørn Erik Pedersen [Wed, 9 Feb 2022 13:10:09 +0000 (14:10 +0100)]
minifier: Port integration tests to its package

3 years agotemplates: Port integration test to its package
Bjørn Erik Pedersen [Wed, 9 Feb 2022 13:08:01 +0000 (14:08 +0100)]
templates: Port integration test to its package

3 years agotocss: Port integration tests to their package
Bjørn Erik Pedersen [Wed, 9 Feb 2022 13:04:57 +0000 (14:04 +0100)]
tocss: Port integration tests to their package

3 years agoopenapi3: Port integration test into correct package
Bjørn Erik Pedersen [Wed, 9 Feb 2022 12:45:38 +0000 (13:45 +0100)]
openapi3: Port integration test into correct package

3 years agoAdd a new integration test framework
Bjørn Erik Pedersen [Wed, 9 Feb 2022 12:41:04 +0000 (13:41 +0100)]
Add a new integration test framework

I have had this living in a separate branch for now, but we need this in the main branch sooner rather than later.

One big advantage of this is that integration tests can live in any package, not just hugolib.

3 years agoValidate comparison operator argument count
Joe Mooring [Fri, 4 Feb 2022 11:01:54 +0000 (03:01 -0800)]
Validate comparison operator argument count

Fixes #9462

3 years agoRemove hugo gen autocomplete
Joe Mooring [Sun, 30 Jan 2022 23:33:15 +0000 (15:33 -0800)]
Remove hugo gen autocomplete

Closes #8862

3 years agodeps: Update github.com/pelletier/go-toml/v2 to v2.0.0-beta.6
Bjørn Erik Pedersen [Sat, 29 Jan 2022 12:55:23 +0000 (13:55 +0100)]
deps: Update github.com/pelletier/go-toml/v2 to v2.0.0-beta.6

Closes #9439
Closes #9417

3 years agoFix erroneous warning with .Page.RenderString on a page without a backing file
Bjørn Erik Pedersen [Fri, 28 Jan 2022 08:45:11 +0000 (09:45 +0100)]
Fix erroneous warning with .Page.RenderString on a page without a backing file

Fixes #9433

3 years agoFix typo in panicOnWarning message
Joe Mooring [Thu, 27 Jan 2022 16:13:32 +0000 (08:13 -0800)]
Fix typo in panicOnWarning message

3 years agoreleaser: Prepare repository for 0.93.0-DEV vanilla/release-0.92.1
hugoreleaser [Thu, 27 Jan 2022 12:22:31 +0000 (12:22 +0000)]
releaser: Prepare repository for 0.93.0-DEV

[ci skip]

3 years agoreleaser: Bump versions for release of 0.92.1 v0.92.1
hugoreleaser [Thu, 27 Jan 2022 11:44:40 +0000 (11:44 +0000)]
releaser: Bump versions for release of 0.92.1

[ci skip]

3 years agoreleaser: Add release notes for 0.92.1
hugoreleaser [Thu, 27 Jan 2022 11:44:40 +0000 (11:44 +0000)]
releaser: Add release notes for 0.92.1
[ci skip]

3 years agoMake the RenderString content provider fix more general
Bjørn Erik Pedersen [Thu, 27 Jan 2022 08:46:51 +0000 (09:46 +0100)]
Make the RenderString content provider fix more general

Updates #9383

3 years agoFix .RenderString issue in .Translations
Paul Gottschling [Fri, 14 Jan 2022 21:08:11 +0000 (16:08 -0500)]
Fix .RenderString issue in .Translations

Fixes #9383

3 years agogeneral: Fix issue causing log threads to hang indefinitely when print() panics
Ephex2 [Wed, 26 Jan 2022 22:44:20 +0000 (17:44 -0500)]
general: Fix issue causing log threads to hang indefinitely when print() panics

The function printIfNotPrinted() defined for DistinctLogger unlocked the mutex within
the logger only after the print() function ran. If print panics, the mutex would stay
locked and future attempts to read or write from the logger mutex would cause the goroutine
to hang indefinitely.

Deferred the unlocking of the mutex to prevent this. Also, put l.m[key] before the print()
call since this will prevent another bug where the same warning potentially gets logged
multiple times if the print() call panics.

Fixes #9380

3 years agoFix duplicate mount sources
Bjørn Erik Pedersen [Wed, 26 Jan 2022 16:48:50 +0000 (17:48 +0100)]
Fix duplicate mount sources

Fixes #9426

3 years agotpl/collections: Fix apply with namespaced template funcs
Bjørn Erik Pedersen [Sun, 16 Jan 2022 21:01:13 +0000 (22:01 +0100)]
tpl/collections: Fix apply with namespaced template funcs

We changed the signature to `func(...interface{}) (interface{}, error)` some time ago, but sadly we had no test for this for `apply`. Now we do.

Fixes #9393

3 years agocommon: Remove unused code
Bjørn Erik Pedersen [Sun, 16 Jan 2022 14:46:19 +0000 (15:46 +0100)]
common: Remove unused code

3 years agocommon/paths: Remove unused code
Bjørn Erik Pedersen [Sun, 16 Jan 2022 12:50:32 +0000 (13:50 +0100)]
common/paths: Remove unused code

3 years agohelpers: Remove unused code
Bjørn Erik Pedersen [Sat, 15 Jan 2022 20:04:37 +0000 (21:04 +0100)]
helpers: Remove unused code

3 years agoDo not render hl_style as an HTML attribute
Joe Mooring [Sat, 15 Jan 2022 03:29:39 +0000 (19:29 -0800)]
Do not render hl_style as an HTML attribute

Fixes #9390

3 years agobuild(deps): bump github.com/spf13/viper from 1.8.1 to 1.10.1
dependabot[bot] [Tue, 11 Jan 2022 19:33:26 +0000 (19:33 +0000)]
build(deps): bump github.com/spf13/viper from 1.8.1 to 1.10.1

Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.8.1 to 1.10.1.
- [Release notes](https://github.com/spf13/viper/releases)
- [Commits](https://github.com/spf13/viper/compare/v1.8.1...v1.10.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoFixing typos (#9387)
Andreas Deininger [Sat, 15 Jan 2022 00:07:17 +0000 (01:07 +0100)]
Fixing typos (#9387)

3 years agoFix typo in warning message
Andreas Deininger [Thu, 13 Jan 2022 11:21:13 +0000 (12:21 +0100)]
Fix typo in warning message

3 years agogithub: Clean up the issue templates a little
Bjørn Erik Pedersen [Thu, 13 Jan 2022 08:43:34 +0000 (09:43 +0100)]
github: Clean up the issue templates a little

3 years agogithub: Add lock-threads step
Bjørn Erik Pedersen [Wed, 12 Jan 2022 18:55:53 +0000 (19:55 +0100)]
github: Add lock-threads step

3 years agoreleaser: Prepare repository for 0.93.0-DEV vanilla/release-0.92.0
hugoreleaser [Wed, 12 Jan 2022 08:58:07 +0000 (08:58 +0000)]
releaser: Prepare repository for 0.93.0-DEV

[ci skip]

3 years agoreleaser: Bump versions for release of 0.92.0 v0.92.0
hugoreleaser [Wed, 12 Jan 2022 08:23:17 +0000 (08:23 +0000)]
releaser: Bump versions for release of 0.92.0

[ci skip]

3 years agoreleaser: Add release notes for 0.92.0
hugoreleaser [Wed, 12 Jan 2022 08:23:17 +0000 (08:23 +0000)]
releaser: Add release notes for 0.92.0
[ci skip]

3 years agodocs: Regenerate docshelper
Bjørn Erik Pedersen [Wed, 12 Jan 2022 07:17:03 +0000 (08:17 +0100)]
docs: Regenerate docshelper

3 years agoMerge commit 'a8e9fc699a6ff7d578f97a7c553ce844efad8fdb'
Bjørn Erik Pedersen [Wed, 12 Jan 2022 07:16:35 +0000 (08:16 +0100)]
Merge commit 'a8e9fc699a6ff7d578f97a7c553ce844efad8fdb'

3 years agoSquashed 'docs/' changes from 4eb10c1a9..b8b20e9a2
Bjørn Erik Pedersen [Wed, 12 Jan 2022 07:15:10 +0000 (08:15 +0100)]
Squashed 'docs/' changes from 4eb10c1a9..b8b20e9a2

b8b20e9a2 Update index.md
f33994fe6 Remove files.Extension (duplicate of files.Ext)
948d6d69d layouts: Use .File.Path
d3050b78c Document .Page.BundleType (#1620)
8a033918f Image filters: ensure Grayscale is a level-2 heading
98537018f Document .Publish method for global resources
963ddc994 docs: add a link to the mailmap documentation
915f858dc Fix release notes version
58093dafe Update index.md
8008ba1e1 Release 0.91.2
d1788dae8 Merge branch 'tempv0.91.2'
af2970180 Revert "config/security: Add HOME to default exec env var whitelist"
2648d3088 netlify: Hugo 0.91.1
d0801599c Merge branch 'tempv0.91.1'
b343bfd7a config/security: Add HOME to default exec env var whitelist
03fbb403f Update data-templates.md
2f608055f Correct GetRemote docs and examples
4e942166a Update 2021-12-17-no-more-releasenotes.md
dbf9514fd Update security.toml
2c38aa356 Update index.md
562ad8e96 Add timeZone
4bc482152 Update introduction.md
1eb66c758 news: Add a note about the placement of release notes
b2a293abb Remove the default archetype template
f9837793c netlify: Hugo 0.91.0
467256ad5 docs: Regen docs helper
68554cf77 Add some basic security policies with sensible defaults

git-subtree-dir: docs
git-subtree-split: b8b20e9a257dca8e53ca9e5f314cf54b18702a37

3 years agoOnly create LazyContentProvider for the non-rendering Site
Bjørn Erik Pedersen [Tue, 11 Jan 2022 16:32:58 +0000 (17:32 +0100)]
Only create LazyContentProvider for the non-rendering Site

Which saves a fair amound of allocations:

```
gobench --package ./hugolib --bench "SiteNew/Regular_D" --base master
```

Before:

```
name                                  old time/op    new time/op    delta
SiteNew/Regular_Deep_content_tree-10    40.7ms ± 3%    41.2ms ± 1%    ~     (p=0.343 n=4+4)

name                                  old alloc/op   new alloc/op   delta
SiteNew/Regular_Deep_content_tree-10    27.7MB ± 0%    28.8MB ± 0%  +3.76%  (p=0.029 n=4+4)

name                                  old allocs/op  new allocs/op  delta
SiteNew/Regular_Deep_content_tree-10      304k ± 0%      329k ± 0%  +8.07%  (p=0.029 n=4+4)
```

After:

```
name                                  old time/op    new time/op    delta
SiteNew/Regular_Deep_content_tree-10    34.2ms ± 1%    34.7ms ± 1%    ~     (p=0.114 n=4+4)

name                                  old alloc/op   new alloc/op   delta
SiteNew/Regular_Deep_content_tree-10    27.7MB ± 0%    28.1MB ± 0%  +1.38%  (p=0.029 n=4+4)

name                                  old allocs/op  new allocs/op  delta
SiteNew/Regular_Deep_content_tree-10      304k ± 0%      314k ± 0%  +3.03%  (p=0.029 n=4+4)
```

Updates #8919

3 years agoFix missing page data for alternative formats
Paul Gottschling [Thu, 9 Sep 2021 13:30:41 +0000 (09:30 -0400)]
Fix missing page data for alternative formats

When a template calls the .Translations function and a
Hugo environment is using multiple output formats,
a template that calls methods like .Summary and .Len on
each translation will unexpectedly show empty return
values for these methods.

This is because each pageOutput's ContentProvider is
assigned to a page.NopPage in newPageOutput. When
*HugoSites.render assigns pageContentOutputs to
pageOutputs in *pageState.shiftToOutputFormat, it
reuses pageContentOutputs from other pageOutputs,
leaving some pageContentOutputs as NopPages. While this
approach conserves resources, sometimes it means that
a template will unexpectedly call a method on a
pageContentOutput that is actually a NopPage.

In the case of ContentProvider methods called on
translations for alternative output formats, the methods
were called on NopPages.

This change introduces LazyContentProvider, which
performs late initialization when one of its methods is
called. This way, we can reuse content in "normal" cases
but ensure that ContentProvider methods work as expected
when a pageOutput is not assigned a pageContentOutput
during the initial pre-render phase.

Fixes #8919

3 years agodocs: Add dependency table to maintainance page
Bjørn Erik Pedersen [Tue, 11 Jan 2022 20:57:37 +0000 (21:57 +0100)]
docs: Add dependency table to maintainance page

See #8949

3 years agodeps: Upgrade github.com/evanw/esbuild v0.14.8 => v0.14.11
Bjørn Erik Pedersen [Tue, 11 Jan 2022 18:16:28 +0000 (19:16 +0100)]
deps: Upgrade github.com/evanw/esbuild v0.14.8 => v0.14.11

3 years agoAdd hugo.Deps
Bjørn Erik Pedersen [Tue, 11 Jan 2022 14:07:04 +0000 (15:07 +0100)]
Add hugo.Deps

Fixes #8949

3 years agohugolib: Fix livereload problem with files including NFC characters in MacOs
roointan [Sat, 8 Jan 2022 10:35:30 +0000 (14:05 +0330)]
hugolib: Fix livereload problem with files including NFC characters in MacOs

Fixes #8429

3 years agodocs. Regen CLI docs
Bjørn Erik Pedersen [Fri, 7 Jan 2022 11:37:07 +0000 (12:37 +0100)]
docs. Regen CLI docs

Closes #9363

3 years agocommands: Fix CLI help text for hugo new
Bjørn Erik Pedersen [Fri, 7 Jan 2022 11:36:12 +0000 (12:36 +0100)]
commands: Fix CLI help text for hugo new

Updates #9363

3 years agoUpdate to Go 1.17.6
Bjørn Erik Pedersen [Fri, 7 Jan 2022 10:07:42 +0000 (11:07 +0100)]
Update to Go 1.17.6

Fixes #9361

3 years agocreate: Correctly pass newContentEditor flags
Joe Mooring [Fri, 7 Jan 2022 05:19:13 +0000 (21:19 -0800)]
create: Correctly pass newContentEditor flags

Fixes #9356

3 years agoAdd --panicOnWarning flag
Bjørn Erik Pedersen [Thu, 6 Jan 2022 09:22:19 +0000 (10:22 +0100)]
Add --panicOnWarning flag

Fixes #9357
Fixes #9359

3 years agogithub: Increase stale days
Bjørn Erik Pedersen [Wed, 5 Jan 2022 14:48:00 +0000 (15:48 +0100)]
github: Increase stale days

3 years agodocs: Regenerate CLI docs
Bjørn Erik Pedersen [Tue, 4 Jan 2022 16:12:09 +0000 (17:12 +0100)]
docs: Regenerate CLI docs

3 years agodocs: Regenerate docshelper
Bjørn Erik Pedersen [Tue, 4 Jan 2022 16:11:17 +0000 (17:11 +0100)]
docs: Regenerate docshelper

3 years agoRemove mmark
Bjørn Erik Pedersen [Tue, 4 Jan 2022 12:26:23 +0000 (13:26 +0100)]
Remove mmark

Closes #9350

3 years agoMisc depreation updates
Bjørn Erik Pedersen [Tue, 4 Jan 2022 12:07:10 +0000 (13:07 +0100)]
Misc depreation updates

* Deprecate .Page.Path when backed by a file
* site.Permalinks
* --ignoreVendor (use --ignoreVendorPaths)

Closes #9348
Closes #9349

3 years agoMake the deprecated Page/File methods (from Hugo 0.55) ERROR
Bjørn Erik Pedersen [Tue, 4 Jan 2022 10:22:57 +0000 (11:22 +0100)]
Make the deprecated Page/File methods (from Hugo 0.55) ERROR

Closes #9346

3 years agogithub: Add add stale GitHub action
Bjørn Erik Pedersen [Tue, 4 Jan 2022 16:08:10 +0000 (17:08 +0100)]
github: Add add stale GitHub action

3 years agoFix surprise OutputFormat.Rel overwriting
Paul Gottschling [Mon, 3 Jan 2022 16:17:51 +0000 (11:17 -0500)]
Fix surprise OutputFormat.Rel overwriting

In page.NewOutputFormat, we take an output.Format f and use it to
create a page.OutputFormat. If the format is canonical, we assign
the final OutputFormat's Rel to "canonical" rather than using
f.Rel. However, this leads to unexpected behavior for custom
output formats, where a user can define a "rel" for a format
via the config file.

For example, the standard for "humans.txt" files requires using
rel="author" in HTML "link" elements. Meanwhile, humans.txt is
usually the only format used for its content. As a result, for
Hugo configurations that define a humans.txt custom output format,
Hugo will render "link" elements to content in this format with
rel="canonical," rather than "author" as required by the standard.

This commit changes page.NewOutputFormat to check whether a given
format is user defined and, if so, skips assigning Rel to
"canonical," even if isCanonical is true.

Fixes #8030

3 years agohugolib: Make an RST test optional
Bjørn Erik Pedersen [Sat, 1 Jan 2022 11:20:07 +0000 (12:20 +0100)]
hugolib: Make an RST test optional

If no RST installed.

3 years agodeps: Upgrade github.com/niklasfasching/go-org v1.5.0 => v1.6.0
Joe Mooring [Sun, 26 Dec 2021 22:45:50 +0000 (14:45 -0800)]
deps: Upgrade github.com/niklasfasching/go-org v1.5.0 => v1.6.0

Fixes #8921

3 years agoUpdate stale.yml
Bjørn Erik Pedersen [Thu, 30 Dec 2021 19:13:08 +0000 (20:13 +0100)]
Update stale.yml

3 years agoreleaser: Prepare repository for 0.92.0-DEV vanilla/release-0.91.2
hugoreleaser [Thu, 23 Dec 2021 16:10:18 +0000 (16:10 +0000)]
releaser: Prepare repository for 0.92.0-DEV

[ci skip]

3 years agoreleaser: Bump versions for release of 0.91.2 v0.91.2
hugoreleaser [Thu, 23 Dec 2021 15:33:33 +0000 (15:33 +0000)]
releaser: Bump versions for release of 0.91.2

[ci skip]

3 years agoreleaser: Add release notes for 0.91.2
hugoreleaser [Thu, 23 Dec 2021 15:33:33 +0000 (15:33 +0000)]
releaser: Add release notes for 0.91.2
[ci skip]

3 years agoRevert "config/security: Add HOME to default exec env var whitelist"
Bjørn Erik Pedersen [Thu, 23 Dec 2021 11:46:04 +0000 (12:46 +0100)]
Revert "config/security: Add HOME to default exec env var whitelist"

There have been one report in the wild suggesting that this needs to be tested better before doing:

https://discourse.gohugo.io/t/hugo-mod-failing-in-v0-91-1-but-works-in-v0-91-0/36180/5

This reverts commit fca266ebbb81af3d4479873a7a79759033c7ce25.

3 years agoMake sure we always create the /public folder
Bjørn Erik Pedersen [Thu, 23 Dec 2021 07:57:28 +0000 (08:57 +0100)]
Make sure we always create the /public folder

* Before this commit, when you had static files in the root of /content and no /public folder, that folder would not be created unless the /static syncer had already run.
* So, with a common pattern doing `rm -rf public && hugo` would the fail now and then because /static and /content are processed in parallel (unless you have cleanDestinationDir=true)
* This was even worse before commit 0b918e131fe523188b820d1e3fa0b08251abde69 – a frozen build.

Closes #8166

3 years agoFix "stuck on build" in error situations in content processing
Bjørn Erik Pedersen [Wed, 22 Dec 2021 18:00:32 +0000 (19:00 +0100)]
Fix "stuck on build" in error situations in content processing

Updates #8166

3 years agodeps: Run "go mod tidy"
Bjørn Erik Pedersen [Thu, 23 Dec 2021 08:12:58 +0000 (09:12 +0100)]
deps: Run "go mod tidy"

3 years agodeps: Upgrade github.com/evanw/esbuild v0.14.7 => v0.14.8
Bjørn Erik Pedersen [Thu, 23 Dec 2021 08:12:23 +0000 (09:12 +0100)]
deps: Upgrade github.com/evanw/esbuild v0.14.7 => v0.14.8

3 years agoreleaser: Prepare repository for 0.92.0-DEV vanilla/release-0.91.1
hugoreleaser [Wed, 22 Dec 2021 16:07:34 +0000 (16:07 +0000)]
releaser: Prepare repository for 0.92.0-DEV

[ci skip]

3 years agoreleaser: Bump versions for release of 0.91.1 v0.91.1
hugoreleaser [Wed, 22 Dec 2021 15:31:05 +0000 (15:31 +0000)]
releaser: Bump versions for release of 0.91.1

[ci skip]

3 years agoreleaser: Add release notes for 0.91.1
hugoreleaser [Wed, 22 Dec 2021 15:31:05 +0000 (15:31 +0000)]
releaser: Add release notes for 0.91.1
[ci skip]

3 years agomedia: Also consider extension in FromContent
Bjørn Erik Pedersen [Tue, 21 Dec 2021 09:35:33 +0000 (10:35 +0100)]
media: Also consider extension in FromContent

As used in `resources.GetRemote`.

This will now reject image files with text and text files with images.

3 years agomedia: Add missing BMP and GIF to the default MediaTypes list
Bjørn Erik Pedersen [Tue, 21 Dec 2021 08:54:14 +0000 (09:54 +0100)]
media: Add missing BMP and GIF to the default MediaTypes list

3 years agomedia: Add PDF MIME type
Bjørn Erik Pedersen [Tue, 21 Dec 2021 08:39:05 +0000 (09:39 +0100)]
media: Add PDF MIME type

3 years agodeps: Update github.com/evanw/esbuild v0.14.5 => v0.14.7
Bjørn Erik Pedersen [Wed, 22 Dec 2021 09:40:49 +0000 (10:40 +0100)]
deps: Update github.com/evanw/esbuild v0.14.5 => v0.14.7

3 years agoconfig/security: Add HOME to default exec env var whitelist
Bjørn Erik Pedersen [Wed, 22 Dec 2021 09:55:44 +0000 (10:55 +0100)]
config/security: Add HOME to default exec env var whitelist

See #9309

3 years agomodules: Set GOCACHE env var
Bjørn Erik Pedersen [Wed, 22 Dec 2021 09:53:03 +0000 (10:53 +0100)]
modules: Set GOCACHE env var

This was introduced in Go 1.15. We do set the GOPATH, which should be enough, but #9309 indicate that's not the case on every platform (GitHub Actions).

Closes #9309

3 years agoreleaser: Prepare repository for 0.92.0-DEV vanilla/release-0.91.0
hugoreleaser [Fri, 17 Dec 2021 10:31:22 +0000 (10:31 +0000)]
releaser: Prepare repository for 0.92.0-DEV

[ci skip]

3 years agoreleaser: Bump versions for release of 0.91.0 v0.91.0
hugoreleaser [Fri, 17 Dec 2021 09:50:19 +0000 (09:50 +0000)]
releaser: Bump versions for release of 0.91.0

[ci skip]

3 years agoreleaser: Add release notes for 0.91.0
hugoreleaser [Fri, 17 Dec 2021 09:50:19 +0000 (09:50 +0000)]
releaser: Add release notes for 0.91.0
[ci skip]

3 years agoreleaser: Drop running tests as part of the release
Bjørn Erik Pedersen [Fri, 17 Dec 2021 09:44:10 +0000 (10:44 +0100)]
releaser: Drop running tests as part of the release

3 years agodocs: Regen docs helper
Bjørn Erik Pedersen [Fri, 17 Dec 2021 09:31:08 +0000 (10:31 +0100)]
docs: Regen docs helper

3 years agotpl/resources: Add empty method mapping for GetRemote
Bjørn Erik Pedersen [Fri, 17 Dec 2021 09:30:10 +0000 (10:30 +0100)]
tpl/resources: Add empty method mapping for GetRemote

To get auto generated documentation for it.

3 years agoAlways use content to resolve content type in resources.GetRemote
Bjørn Erik Pedersen [Thu, 16 Dec 2021 14:12:13 +0000 (15:12 +0100)]
Always use content to resolve content type in resources.GetRemote

This is a security hardening measure; don't trust the URL extension or any `Content-Type`/`Content-Disposition` header on its own, always look at the file content using Go's `http.DetectContentType`.

This commit also adds ttf and otf media type definitions to Hugo.

Fixes #9302
Fixes #9301

3 years agoAdd resources.GetRemote
Bjørn Erik Pedersen [Thu, 16 Dec 2021 10:09:21 +0000 (11:09 +0100)]
Add resources.GetRemote

In Hugo 0.89 we added remote support to `resources.Get`.

In hindsight that was not a great idea, as a poll from many Hugo users showed. See Issue #9285 for more details.

After this commit `resources.Get` only supports local resource lookups. If you want to support both, you need to use a construct similar to:

Also improve some option case handling.

```
{{ resource := "" }}
{{ if (urls.Parse $url).IsAbs }}
{{ $resource = resources.GetRemote $url }}
{{ else }}
{{ $resource = resources.Get $url }}
{{ end }}
```

Fixes #9285
Fixes #9296

3 years agoAllow for return partials with falsy arguments (#9298)
Paul Gottschling [Fri, 17 Dec 2021 07:35:21 +0000 (02:35 -0500)]
Allow for return partials with falsy arguments (#9298)

Partials with returns values are parsed, then inserted into a
partial return wrapper via wrapInPartialReturnWrapper in order
to assign the return value via *contextWrapper.Set. The
predefined wrapper template for partials inserts a partial's nodes
into a "with" template action in order to set dot to a
*contextWrapper within the partial. However, because "with" is
skipped if its argument is falsy, partials with falsy arguments
were not being evaluated.

This replaces the "with" action in the partial wrapper with a
"range" action that isn't skipped if .Arg is falsy.

Fixes #7528

3 years agodeps: Upgrade github.com/evanw/esbuild v0.14.2 => v0.14.5
Bjørn Erik Pedersen [Wed, 15 Dec 2021 17:00:51 +0000 (18:00 +0100)]
deps: Upgrade github.com/evanw/esbuild v0.14.2 => v0.14.5

3 years agodon't use path.Join, because it cleans the final path
Joachim Ansorg [Thu, 16 Dec 2021 19:30:44 +0000 (20:30 +0100)]
don't use path.Join, because it cleans the final path

3 years agoAdd some basic security policies with sensible defaults
Bjørn Erik Pedersen [Sun, 12 Dec 2021 11:11:11 +0000 (12:11 +0100)]
Add some basic security policies with sensible defaults

This ommmit contains some security hardening measures for the Hugo build runtime.

There are some rarely used features in Hugo that would be good to have disabled by default. One example would be the "external helpers".

For `asciidoctor` and some others we use Go's `os/exec` package to start a new process.

These are a predefined set of binary names, all loaded from `PATH` and with a predefined set of arguments. Still, if you don't use `asciidoctor` in your project, you might as well have it turned off.

You can configure your own in the new `security` configuration section, but the defaults are configured to create a minimal amount of site breakage. And if that do happen, you will get clear instructions in the loa about what to do.

The default configuration is listed below. Note that almost all of these options are regular expression _whitelists_ (a string or a slice); the value `none` will block all.

```toml
[security]
  enableInlineShortcodes = false
  [security.exec]
    allow = ['^dart-sass-embedded$', '^go$', '^npx$', '^postcss$']
    osEnv = ['(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM)$']

  [security.funcs]
    getenv = ['^HUGO_']

  [security.http]
    methods = ['(?i)GET|POST']
    urls = ['.*']
```

3 years agoSimplify Babel test assertions
Bjørn Erik Pedersen [Tue, 14 Dec 2021 06:26:53 +0000 (07:26 +0100)]
Simplify Babel test assertions

To make the tests pass on my grand old Windows 8 VM.