1
0
Fork 0
mirror of https://github.com/gohugoio/hugo.git synced 2025-03-23 17:54:05 +00:00
Commit graph

7350 commits

Author SHA1 Message Date
Bjørn Erik Pedersen
aa2c724195 tpl/resources: Fix data race in ToCSS
Fixes 
2022-12-21 12:26:42 +01:00
Bjørn Erik Pedersen
effa6a4226 tocss: Add some more test cases
See 
2022-12-21 11:21:07 +01:00
Septs
5d5f0a2371 tocss: Fix unquote case with double quotes
See 
2022-12-21 11:21:07 +01:00
Bjørn Erik Pedersen
d20d2651ea
Allow "fast render mode" even if --disableLiveReload is set
Fixes 
2022-12-21 11:02:21 +01:00
Bjørn Erik Pedersen
41a080b268 tocss: Add vars option
This commit adds a new `vars` option to both the Sass transpilers (Dart Sass and Libsass).

This means that you can pass a map with key/value pairs to the transpiler:

```handlebars
{{ $vars := dict "$color1" "blue" "$color2" "green" "$font_size" "24px" }}
{{ $cssOpts := (dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" $vars ) }}
{{ $r := resources.Get "scss/main.scss" |  toCSS $cssOpts }}
```

And the the variables will be available in the `hugo:vars` namespace. Example usage for Dart Sass:

```scss
@use "hugo:vars" as v;

p {
    color: v.$color1;
    font-size: v.$font_size;
}
```

Note that Libsass does not support the `use` keyword, so you need to `import` them as global variables:

```scss
@import "hugo:vars";

p {
    color: $color1;
    font-size: $font_size;
}
```

Hugo will:

* Add a missing leading `$` for the variable names if needed.
* Wrap the values in `unquote('VALUE')` (Sass built-in) to get proper handling of identifiers vs other strings.

This means that you can pull variables directly from e.g. the site config:

```toml
[params]
[params.sassvars]
color1 = "blue"
color2 = "green"
font_size = "24px"
image = "images/hero.jpg"
```

```handlebars
{{ $vars := site.Params.sassvars}}
{{ $cssOpts := (dict "transpiler" "dartsass" "outputStyle" "compressed" "vars" $vars ) }}
{{ $r := resources.Get "scss/main.scss" |  toCSS $cssOpts }}
```

Fixes 
2022-12-20 19:36:30 +01:00
Bjørn Erik Pedersen
9a215d6950
Merge commit '41bc6f702aa54200530efbf4267e5c823df3028d' 2022-12-20 11:04:41 +01:00
Bjørn Erik Pedersen
41bc6f702a Squashed 'docs/' changes from 2201ac0e5..2c0125b52
2c0125b52 Remove .Site.Author
2cf8841b3 Update partialCached.md ()
385487191 Update data-templates.md ()
ce207e141 Remove redundant markdown and fix a few typos ()
3687c2953 Make heading id linkable, take 2
45c79bea7 Make heading id linkable
b22079344 Delete duplicates the lines 557-569 and 570-582. ()
0a90dc122 Rework the taxonomy variables page ()
7f8979c50 Update theme
26e682a3a Update multilingual.md
d40e7693f Update postcss.md
375d75c01 Update postcss npm instructions ()
63020094a Emphasize Window shell selection ()
56824be2c Update configuration.md
b7b8f16b3 Docu 'Theme components': minor fix ()
09dc81a05 Remove Docker from BSD page ()
205fea204 netlify: Hugo 0.108.0
6abe49c28 Merge commit 'da670c38ee63a7fef25e2b9f42519232055b60dc'
12b59a4c5 docs: Add basic doc for wrapStandAloneImageWithinParagraph etc.
ba07bd970 dartsass: Add sourceMapIncludeSources option

git-subtree-dir: docs
git-subtree-split: 2c0125b5290494d49334606c451446ebd9df3c21
2022-12-20 11:04:41 +01:00
Bjørn Erik Pedersen
eda1e720cd
modules: Improve "module workspace" not found error 2022-12-20 09:06:38 +01:00
Bjørn Erik Pedersen
330fa89411 modules: Adjust watch logic vs workspace use definitions 2022-12-19 20:17:33 +01:00
Bjørn Erik Pedersen
6db527483d Add any configured Go Workspace file to the config watcher
Fixes 
2022-12-19 20:17:33 +01:00
Bjørn Erik Pedersen
0d4b17d4c0 modules: Make the module.workspace=off as default (note)
Also, resolve any workspace file relative to the workingDir.

Fixes 
2022-12-19 20:17:33 +01:00
Bjørn Erik Pedersen
3afaca7584
release: Add a note section in release notes 2022-12-19 13:13:38 +01:00
Joe Mooring
2d217cba51
helpers: Allow at signs in UnicodeSanitize (note)
Closes 
2022-12-19 09:58:56 +01:00
Bjørn Erik Pedersen
17055d1fa7
parser/metadecoders: Remove superflous cast in test 2022-12-14 20:10:17 +01:00
Bjørn Erik Pedersen
2a81a49499 parser/metadecoders: Simplify nil check in Unmarshal 2022-12-14 18:03:47 +01:00
AcClassic
e30d711c29 parser/metadecoders: Add empty /data JSON file as empty map
When fetching JSON files from the /data folder that are empty they will
be added as empty map[string]any. This makes sure that no empty JSON
file causes the site to crash because of a failed unmarshal. This
happens because empty is not a valid JSON string. It is therefore
important to check the lenght of the data before passing it to the JSON
unmarshal function.

Fixes 
2022-12-14 18:03:47 +01:00
Bjørn Erik Pedersen
ad2059878a Also consider wrapped errors when checking for file IsNotExist errors
Fixes 
2022-12-14 13:51:06 +01:00
Bjørn Erik Pedersen
87e898a17a tpl/openapi3: Wrap *kopenapi3.T
To make it easier to document.
2022-12-14 12:29:40 +01:00
Bjørn Erik Pedersen
b54de1bd9b resources/js: Fix some import discrepancies between Hugo and ESBuild
This fixes the cases where

```js
import 'imp2/index.js';
import 'imp3/foo.js';
```

And these files lives in `assets` as:

```
imp2/index.ts
imp3/foo.ts
```

Fixes 
2022-12-13 18:58:17 +01:00
Bjørn Erik Pedersen
c9354d5463 github: Update to Dart Sass 1.56.2 2022-12-13 16:58:33 +01:00
Bjørn Erik Pedersen
d894269855 github: Use ruby/setup-ruby
Closes 
2022-12-11 19:43:46 +01:00
Joe Mooring
3fd0b78498 tpl/tplimpl: Use https in sitemap templates
Closes 
2022-12-11 18:53:30 +01:00
Francesco La Camera
e0e63f35e4
parser/metadecoders: Fix spelling 2022-12-10 19:37:47 +01:00
hugoreleaser
cc574ef120 releaser: Prepare repository for 0.109.0-DEV
[ci skip]
2022-12-06 13:50:51 +00:00
hugoreleaser
a0d64a46e3 releaser: Bump versions for release of 0.108.0
[ci skip]
2022-12-06 13:37:56 +00: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
Bjørn Erik Pedersen
d8efe085ca Add dart-sass-embedded version info to hugo env -v
```
~ ❯❯❯ hugo env -v | grep dart
github.com/bep/godartsass="v0.16.0"
github.com/sass/dart-sass-embedded/compiler="1.56.1"
github.com/sass/dart-sass-embedded/implementation="1.56.1"
github.com/sass/dart-sass-embedded/protocol="1.1.0"
```
2022-12-06 13:37:08 +01:00
Bjørn Erik Pedersen
f5b5b71c60 deps: Upgrade github.com/bep/godartsass v0.15.0 => v0.16.0 2022-12-06 13:37:08 +01:00
Razon Yang
b82b547acb
tpl/embedded: Make Open Graph's series optional 2022-12-06 10:48:34 +01:00
Bjørn Erik Pedersen
da670c38ee Squashed 'docs/' changes from 4c1309cdf..2201ac0e5
2201ac0e5 Update theme

git-subtree-dir: docs
git-subtree-split: 2201ac0e5fa47400ecd182e28af823e0f03ed05b
2022-12-06 10:42:36 +01:00
Bjørn Erik Pedersen
c9f2fa2663
Merge commit 'da670c38ee63a7fef25e2b9f42519232055b60dc' 2022-12-06 10:42:36 +01:00
Bjørn Erik Pedersen
5067775a6f
common/hugio: Fix multiWriteCloser.Close
Fixes 
2022-12-06 10:32:33 +01:00
dependabot[bot]
50549c867c build(deps): bump github.com/getkin/kin-openapi from 0.109.0 to 0.110.0
Bumps [github.com/getkin/kin-openapi](https://github.com/getkin/kin-openapi) from 0.109.0 to 0.110.0.
- [Release notes](https://github.com/getkin/kin-openapi/releases)
- [Commits](https://github.com/getkin/kin-openapi/compare/v0.109.0...v0.110.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-06 10:22:14 +01:00
Bjørn Erik Pedersen
de9c5542ca
docs: Add basic doc for wrapStandAloneImageWithinParagraph etc.
See 
2022-12-05 16:50:47 +01:00
Bjørn Erik Pedersen
e93138dfdb dartsass: Add sourceMapIncludeSources option 2022-12-05 16:36:45 +01:00
Bjørn Erik Pedersen
7d16c3c0c1 github: Update Dart Sass Embedded to 1.56.1 2022-12-05 16:36:45 +01:00
Bjørn Erik Pedersen
63126c6359 markup/goldmark: Add removeSurroundingParagraph for Markdown images
* Removes any surrounding paragraph nodes
* And transfers any attributes from the surrounding paragraph down to the image node
* Adds IsBlock and Ordinal (zero based) field to the image context passed to the image render hooks

IsBlock is set to true if `wrapStandAloneImageWithinParagraph = false` and  the image's parent node has only one child.

Closes 
Fixes 
Fixes 
Fixes 
2022-12-05 15:00:47 +01:00
dependabot[bot]
535ea8cc9b build(deps): bump github.com/evanw/esbuild from 0.15.16 to 0.15.18
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.15.16 to 0.15.18.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.15.16...v0.15.18)

---
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>
2022-12-05 10:35:54 +01:00
dependabot[bot]
8bbec426cd build(deps): bump golang.org/x/text from 0.4.0 to 0.5.0
Bumps [golang.org/x/text](https://github.com/golang/text) from 0.4.0 to 0.5.0.
- [Release notes](https://github.com/golang/text/releases)
- [Commits](https://github.com/golang/text/compare/v0.4.0...v0.5.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-05 10:34:54 +01:00
dependabot[bot]
0bfa293dcd build(deps): bump github.com/evanw/esbuild from 0.15.15 to 0.15.16
Bumps [github.com/evanw/esbuild](https://github.com/evanw/esbuild) from 0.15.15 to 0.15.16.
- [Release notes](https://github.com/evanw/esbuild/releases)
- [Changelog](https://github.com/evanw/esbuild/blob/master/CHANGELOG.md)
- [Commits](https://github.com/evanw/esbuild/compare/v0.15.15...v0.15.16)

---
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>
2022-12-04 15:04:05 +01:00
Joe Mooring
0b976d2b40 tpl/tplimpl: Allow alternate comment syntax
Allow alternate comment syntax before block definitions:

{{/* foo */}}
{{- /* foo */}}
{{- /* foo */ -}}

Fixes 
2022-12-04 09:25:51 +01:00
Anton Sattarov
a49e51fd0b
resources: Increase timeout for http.Client
Increase timeout for http.Client in resources.GetRemote  from 10 second to 1 minute

Fixes 
2022-12-03 15:47:47 +01:00
Bjørn Erik Pedersen
d373774cbe tpl/collections: Fix some index cases where the indices given is a slice and be more lenient with nil inputs
See adjusted tests for detail.

Fixes 
2022-12-03 11:54:33 +01:00
Bjørn Erik Pedersen
7d5e3ab8a8 tpl: Misco GoDoc improvements 2022-12-03 11:54:33 +01:00
septs
dc44bca963
config/security: Add CI env var to whitelist 2022-12-02 12:13:34 +01:00
Bjørn Erik Pedersen
da16527896 Squashed 'docs/' changes from 32cb8785e..4c1309cdf
4c1309cdf Fix broken link to front matter page ()
8181fff20 Add footnote to Quick Start guide for Win users ()
4fd934f61 Fix abslangurl.md ()
bf2c45617 Quick start guide: fix broken links ()
201b568df Update theme
874db199d Hide the news stripe on front page for now
aaf59e3e2 netlify: Hugo 0.107.0
79654c301 Merge branch 'tempv107'
8345e0347 docs: Regen docs helper
b5b4f15f9 Add assets directory to directory structure diagram ()
76dd3a82a Follow-up: improve function signatures () ()
656dc72ba Improving function signatures ()
b715e8407 Explain how to create multilingual content ()
8500ee417 Fix typo in Quick Start guide
ce60bb572 Add docu for undocumented functions ()
372bf5e88 Improve Quick Start tutorial
71e81ec5f Remove asciicast from site
1e56c653f Update hosting-on-cloudflare-pages.md ()
1686f60b1 Adding documentation page for function 'strings.FirstUpper' ()
d533f7c9c Fixing typos ()
2563eee45 Update multilingual.md ()
2173ed799 Update theme
5591b8875 Update urls.md ()
4a88890b5 netlify: Hugo 0.106.0
512879fdd docs: Regen CLI docs
f74b1d87d docs: Regenerate docs helper
9feacb48f Merge commit '00c4484c7092181729f6f470805bc7d72e8ad17b'

git-subtree-dir: docs
git-subtree-split: 4c1309cdfe9858434684352f9d544bf0c5c9d646
2022-12-02 09:19:23 +01:00
Bjørn Erik Pedersen
ef518485ce
Merge commit 'da16527896d3087585c5e758083ea498dcabc2c3' 2022-12-02 09:19:23 +01:00
Bjørn Erik Pedersen
83080df611 deps: Upgrade github.com/bep/godartsass v0.14.0 => v0.15.0 2022-12-02 09:08:22 +01:00
Joe Mooring
b8d5c378ba tpl: Use consistent delimiter spacing in examples 2022-11-25 09:54:35 +01:00
Bjørn Erik Pedersen
75f782a5a7
docs: Regen docs helper 2022-11-24 15:17:22 +01:00