From ff0a358d3bda9e385ace152a0a97935d2a459ae7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 17 Dec 2024 13:09:10 +0100 Subject: [PATCH 01/31] Update Go tool version in hugo.work --- hugo.work | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugo.work b/hugo.work index a3c91ef28..b2ae38c07 100644 --- a/hugo.work +++ b/hugo.work @@ -1,4 +1,4 @@ -go 1.19 +go 1.22.0 use . use ../gohugoioTheme From 9884425f9827baa1518939da8bbb1749a4b1075d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 17 Dec 2024 13:09:57 +0100 Subject: [PATCH 02/31] Update theme --- .../layouts/_default/_markup/render-link.html | 7 +------ .../gohugoio/gohugoioTheme/layouts/shortcodes/include.html | 2 +- _vendor/modules.txt | 3 +-- go.mod | 2 +- go.sum | 2 ++ 5 files changed, 6 insertions(+), 10 deletions(-) diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/_markup/render-link.html b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/_markup/render-link.html index 9b6cad114..81b2fb46d 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/_markup/render-link.html +++ b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/_markup/render-link.html @@ -98,12 +98,7 @@ either of these shortcodes in conjunction with this render hook. {{- end }} {{- /* Determine content path for warning and error messages. */}} -{{- $contentPath := "" }} -{{- with .Page.File }} - {{- $contentPath = .Path }} -{{- else }} - {{- $contentPath = .Path }} -{{- end }} +{{- $contentPath := print .Page }} {{- /* Parse destination. */}} {{- $u := urls.Parse .Destination }} diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/shortcodes/include.html b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/shortcodes/include.html index 9ad6e4ecb..cb9c12587 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/shortcodes/include.html +++ b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/shortcodes/include.html @@ -10,7 +10,7 @@ You must call this shortcode using the {{% %}} notation. */}} {{- with .Get 0 }} - {{- with site.GetPage . }} + {{- with or (site.GetPage .) ($.Page.GetPage .) }} {{- .RenderShortcodes }} {{- else }} {{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }} diff --git a/_vendor/modules.txt b/_vendor/modules.txt index 5ff5b9db1..65c917c88 100644 --- a/_vendor/modules.txt +++ b/_vendor/modules.txt @@ -1,2 +1 @@ -# github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1 - +# github.com/gohugoio/gohugoioTheme v0.0.0-20241217120756-d943fd149ebe diff --git a/go.mod b/go.mod index 5e909630f..8c5e8cdcf 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs go 1.22.0 -require github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1 // indirect +require github.com/gohugoio/gohugoioTheme v0.0.0-20241217120756-d943fd149ebe // indirect diff --git a/go.sum b/go.sum index e1863b60e..40a41f94a 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,4 @@ github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1 h1:d6XNQ4QYvJGIE8vMejUFTD89AWaPDywcLivzWpEU0qE= github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20241217120756-d943fd149ebe h1:+G6k1qjxy7Cx6ZR7RXZmysp5hbFUtlvhhDP3p1VqqxA= +github.com/gohugoio/gohugoioTheme v0.0.0-20241217120756-d943fd149ebe/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= From 107289a2c0a871bfb1979a3e5de830a95832a1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 17 Dec 2024 13:14:45 +0100 Subject: [PATCH 03/31] Update theme (again) --- .../gohugoioTheme/layouts/_default/_markup/render-link.html | 2 +- _vendor/modules.txt | 2 +- go.mod | 2 +- go.sum | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/_markup/render-link.html b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/_markup/render-link.html index 81b2fb46d..3dcb77dc3 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/_markup/render-link.html +++ b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/_default/_markup/render-link.html @@ -98,7 +98,7 @@ either of these shortcodes in conjunction with this render hook. {{- end }} {{- /* Determine content path for warning and error messages. */}} -{{- $contentPath := print .Page }} +{{- $contentPath := .Page.String }} {{- /* Parse destination. */}} {{- $u := urls.Parse .Destination }} diff --git a/_vendor/modules.txt b/_vendor/modules.txt index 65c917c88..6121aaa80 100644 --- a/_vendor/modules.txt +++ b/_vendor/modules.txt @@ -1 +1 @@ -# github.com/gohugoio/gohugoioTheme v0.0.0-20241217120756-d943fd149ebe +# github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253 diff --git a/go.mod b/go.mod index 8c5e8cdcf..0f4cdd57f 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs go 1.22.0 -require github.com/gohugoio/gohugoioTheme v0.0.0-20241217120756-d943fd149ebe // indirect +require github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253 // indirect diff --git a/go.sum b/go.sum index 40a41f94a..e2386a94a 100644 --- a/go.sum +++ b/go.sum @@ -2,3 +2,5 @@ github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1 h1:d6XNQ4QY github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= github.com/gohugoio/gohugoioTheme v0.0.0-20241217120756-d943fd149ebe h1:+G6k1qjxy7Cx6ZR7RXZmysp5hbFUtlvhhDP3p1VqqxA= github.com/gohugoio/gohugoioTheme v0.0.0-20241217120756-d943fd149ebe/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253 h1:7DYEU25rQryCGyUISUpIye3oE0kz+9K9SiD6/O5rqvM= +github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= From 8c190aabc6266321936ed519cc4ec1ca31556056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 17 Dec 2024 15:58:48 +0100 Subject: [PATCH 04/31] netlify: Hugo 0.140.0 --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 995057a75..9c46b4ac0 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ command = "hugo --gc --minify" [build.environment] - HUGO_VERSION = "0.139.4" + HUGO_VERSION = "0.140.0" [context.production.environment] HUGO_ENV = "production" From 4d3195223a885992b6a1cc71dedd4b22dc216917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 4 Dec 2024 13:31:45 +0100 Subject: [PATCH 05/31] Update JS docs vs Hugo v0.140 --- content/en/functions/js/Babel.md | 3 +- content/en/functions/js/Batch.md | 323 +++++++++++++++++++++ content/en/functions/js/Build.md | 87 +----- content/en/functions/js/_common/_index.md | 13 + content/en/functions/js/_common/options.md | 99 +++++++ content/en/hugo-pipes/babel.md | 76 ----- content/en/hugo-pipes/js.md | 180 +----------- content/en/methods/page/Resources.md | 14 + 8 files changed, 456 insertions(+), 339 deletions(-) create mode 100644 content/en/functions/js/Batch.md create mode 100644 content/en/functions/js/_common/_index.md create mode 100644 content/en/functions/js/_common/options.md delete mode 100755 content/en/hugo-pipes/babel.md diff --git a/content/en/functions/js/Babel.md b/content/en/functions/js/Babel.md index 4271cd35e..9485b4d05 100644 --- a/content/en/functions/js/Babel.md +++ b/content/en/functions/js/Babel.md @@ -3,8 +3,9 @@ title: js.Babel description: Compiles the given JavaScript resource with Babel. categories: [] keywords: [] +weight: 100 action: - aliases: [babel] + aliases: [babel,/hugo-pipes/babel/] related: - functions/js/Build - functions/resources/Fingerprint diff --git a/content/en/functions/js/Batch.md b/content/en/functions/js/Batch.md new file mode 100644 index 000000000..05acfb683 --- /dev/null +++ b/content/en/functions/js/Batch.md @@ -0,0 +1,323 @@ +--- +title: js.Batch +description: Build JavaScript bundle groups with global code splitting and flexible hooks/runners setup. +weight: 50 +categories: [] +keywords: [] +action: + aliases: [] + related: + - functions/js/Build + - functions/js/Babel + - functions/resources/Fingerprint + - functions/resources/Minify + returnType: js.Batcher + signatures: ['js.Batch [ID]'] +toc: true +--- + +{{% note %}} +For a runnable example of this feature, see [this test and demo repo](https://github.com/bep/hugojsbatchdemo/). +{{% /note %}} + +The Batch `ID` is used to create the base directory for this batch. Forward slashes are allowed. `js.Batch` returns an object with an API with this structure: + +* [Group] + * [Script] + * [SetOptions] + * [Instance] + * [SetOptions] + * [Runner] + * [SetOptions] + * [Config] + * [SetOptions] + + +## Group + +The `Group` method take an `ID` (`string`) as argument. No slashes. It returns an object with these methods: + + +#### Script + +The `Script` method takes an `ID` (`string`) as argument. No slashes. It returns an [OptionsSetter] that can be used to set [script options] for this script. + +```go-html-template +{{ with js.Batch "js/mybatch" }} + {{ with .Group "mygroup" }} + {{ with .Script "myscript" }} + {{ .SetOptions (dict "resource" (resources.Get "myscript.js")) }} + {{ end }} + {{ end }} +{{ end }} +``` + +`SetOptions` takes a [script options] map. Note that if you want the script to be handled by a [runner], you need to set the `export` option to match what you want to pass on to the runner (default is `*`). + +#### Instance + +The `Instance` method takes two `string` arguments `SCRIPT_ID` and `INSTANCE_ID`. No slashes. It returns an [OptionsSetter] that can be used to set [params options] for this instance. + +```go-html-template +{{ with js.Batch "js/mybatch" }} + {{ with .Group "mygroup" }} + {{ with .Instance "myscript" "myinstance" }} + {{ .SetOptions (dict "params" (dict "param1" "value1")) }} + {{ end }} + {{ end }} +{{ end }} +``` + +`SetOptions` takes a [params options] map. The instance options will be passed to any [runner] script in the same group, as JSON. + + +#### Runner + +The `Runner` method takes an `ID` (`string`) as argument. No slashes. It returns an [OptionsSetter] that can be used to set [script options] for this runner. + +```go-html-template +{{ with js.Batch "js/mybatch" }} + {{ with .Group "mygroup" }} + {{ with .Runner "myrunner" }} + {{ .SetOptions (dict "resource" (resources.Get "myrunner.js")) }} + {{ end }} + {{ end }} +{{ end }} +``` + +`SetOptions` takes a [script options] map. + +The runner will receive a data structure with all instances for that group with a live binding of the [JavaScript import] of the defined `export`. + +The runner script's export must be a function that takes one argument, the group data structure. An example of a group data structure as JSON is: + +```json +{ + "id": "leaflet", + "scripts": [ + { + "id": "mapjsx", + "binding": JAVASCRIPT_BINDING, + "instances": [ + { + "id": "0", + "params": { + "c": "h-64", + "lat": 48.8533173846729, + "lon": 2.3497416090232535, + "r": "map.jsx", + "title": "Cathédrale Notre-Dame de Paris", + "zoom": 23 + } + }, + { + "id": "1", + "params": { + "c": "h-64", + "lat": 59.96300872062237, + "lon": 10.663529183196863, + "r": "map.jsx", + "title": "Holmenkollen", + "zoom": 3 + } + } + ] + } + ] +} +``` + +Below is an example of a runner script that uses React to render elements. Note that the export (`default`) must match the `export` option in the [script options] (`default` is the default value for runner scripts) (runnable versions of examples on this page can be found at [js.Batch Demo Repo]): + + +```js +import * as ReactDOM from 'react-dom/client'; +import * as React from 'react'; + +export default function Run(group) { + console.log('Running react-create-elements.js', group); + const scripts = group.scripts; + for (const script of scripts) { + for (const instance of script.instances) { + /* This is a convention in this project. */ + let elId = `${script.id}-${instance.id}`; + let el = document.getElementById(elId); + if (!el) { + console.warn(`Element with id ${elId} not found`); + continue; + } + const root = ReactDOM.createRoot(el); + const reactEl = React.createElement(script.binding, instance.params); + root.render(reactEl); + } + } +} +``` + + + +#### Config + +Returns an [OptionsSetter] that can be used to set [build options] for the batch. + +These are mostly the same as for [js.Build], but note that: + +* `targetPath` is set automatically (there may be multiple outputs). +* `format` must be `esm`, currently the only format supporting [code splitting]. +* `params` will be available in the `@params/config` namespace in the scripts. This way you can import both the [script] or [runner] params and the [config] params with: + +```js +import * as params from "@params"; +import * as config from "@params/config"; +``` + +Setting the `Config` for a batch can be done from any template (including shortcode templates), but will only be set once (the first will win): + +```go-html-template +{{ with js.Batch "js/mybatch" }} + {{ with .Config }} + {{ .SetOptions (dict + "target" "es2023" + "format" "esm" + "jsx" "automatic" + "loaders" (dict ".png" "dataurl") + "minify" true + "params" (dict "param1" "value1") + ) + }} + {{ end }} +{{ end }} +``` + +## Options + +### Build Options + +format +: (`string`) Currently only `esm` is supported in [ESBuild's code splitting]. + +{{% include "./_common/options.md" %}} + +### Script Options + +resource +: The resource to build. This can be a file resource or a virtual resource. + +export +: The export to bind the runner to. Set it to `*` to export the [entire namespace](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#namespace_import). Default is `default` for [runner] scripts and `*` for other [scripts](#script). + +importContext +: An additional context for resolving imports. Hugo will always check this one first before falling back to `assets` and `node_modules`. A common use of this is to resolve imports inside a page bundle. See [import context](#import-context). + +params +: A map of parameters that will be passed to the script as JSON. These gets bound to the `@params` namespace: +```js +import * as params from '@params'; +``` + +### Script Options + +### Params Options + +params +: A map of parameters that will be passed to the script as JSON. + +### Import Context + +Hugo will, by default, first try to resolve any import in [assets](/hugo-pipes/introduction/#asset-directory) and, if not found, let [ESBuild] resolve it (e.g. from `node_modules`). The `importContext` option can be used to set the first context for resolving imports. A common use of this is to resolve imports inside a [page bundle](/content-management/page-bundles/). + +```go-html-template +{{ $common := resources.Match "/js/headlessui/*.*" }} +{{ $importContext := (slice $.Page ($common.Mount "/js/headlessui" ".")) }} +``` + +You can pass any object that implements [Resource.Get](/methods/page/resources/#get). Pass a slice to set multiple contexts. + +The example above uses [`Resources.Mount`] to resolve a folder inside `assets` relative to the page bundle. + +### OptionsSetter + +An `OptionsSetter` is a special object that is returned once only. This means that you should wrap it with [with]: + +```go-html-template +{{ with .Script "myscript" }} + {{ .SetOptions (dict "resource" (resources.Get "myscript.js"))}} +{{ end }} +``` + +## Build + +The `Build` method returns an object with the following structure: + +* Groups (map) + * [`Resources`] + +Eeach [`Resource`] will be of media type `application/javascript` or `text/css`. + + In a template you would typically hande one group with a given `ID` (e.g. scripts for the current section). Because of the concurrent build, this needs to be done in a [`templates.Defer`] block: + +```go-html-template +{{ $group := .group }} +{{ with (templates.Defer (dict "key" $group "data" $group )) }} + {{ with (js.Batch "js/mybatch") }} + {{ with .Build }} + {{ with index .Groups $ }} + {{ range . }} + {{ $s := . }} + {{ if eq $s.MediaType.SubType "css" }} + + {{ else }} + + {{ end }} + {{ end }} + {{ end }} + {{ end }} +{{ end }} +``` + + +## Known Issues + +In the official documentation for [ESBuild's code splitting], there's a warning note in the header. The two issues are: + +* `esm` is currently the only implementd output format. This means that it will not work for very old browsers. See [caniuse](https://caniuse.com/?search=ESM). +* There's a known import ordering issue. + +We have not seen the ordering issue as a problem during our [extensive testing](https://github.com/bep/hugojsbatchdemo) of this new feature with different libraries. There are two main cases: + +1. Undefined execution order of imports, see [this comment](https://github.com/evanw/esbuild/issues/399#issuecomment-1458680887) +2. Only one execution order of imports, see [this comment](https://github.com/evanw/esbuild/issues/399#issuecomment-735355932) + +Many would say that both of the above are [code smells](https://en.wikipedia.org/wiki/Code_smell). The first one has a simple workaround in Hugo. Define the import order in its own script and make sure it gets passed early to ESBuild, e.g. by putting it in a script goup with a name that comes early in the alphabet. + +```js +import './lib2.js'; +import './lib1.js'; + +console.log('entrypoints-workaround.js'); + +``` + +[build options]: #build-options +[`Resource`]: https://gohugo.io/methods/resource/ +[`Resources`]: /methods/page/resources/ +[`Resources.Mount`]: /methods/page/resources/#mount +[`templates.Defer`]: /functions/templates/defer/ +[code splitting]: https://esbuild.github.io/api/#splitting +[config]: #config +[ESBuild's code splitting]: https://esbuild.github.io/api/#splitting +[ESBuild]: https://github.com/evanw/esbuild +[group]: #group +[instance]: #instance +[JavaScript import]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import +[js.Batch Demo Repo]: https://github.com/bep/hugojsbatchdemo/ +[js.Build]: https://gohugo.io/hugo-pipes/js/#options +[map]: https://gohugo.io/functions/collections/dictionary/ +[OptionsSetter]: #optionssetter +[page bundles]: https://gohugo.io/content-management/page-bundles/ +[params options]: #params-options +[runner]: #runner +[script options]: #script-options +[script]: #script +[SetOptions]: #optionssetter +[with]: https://gohugo.io/functions/go-template/with/ \ No newline at end of file diff --git a/content/en/functions/js/Build.md b/content/en/functions/js/Build.md index 2a948416e..0e5fd3c0a 100644 --- a/content/en/functions/js/Build.md +++ b/content/en/functions/js/Build.md @@ -1,6 +1,7 @@ --- title: js.Build description: Bundles, transpiles, tree shakes, and minifies JavaScript resources. +weight: 30 categories: [] keywords: [] action: @@ -45,94 +46,10 @@ targetPath : (`string`) If not set, the source path will be used as the base target path. Note that the target path's extension may change if the target MIME type is different, e.g. when the source is TypeScript. -params -: (`map` or `slice`) Params that can be imported as JSON in your JS files, e.g. - -```go-html-template -{{ $js := resources.Get "js/main.js" | js.Build (dict "params" (dict "api" "https://example.org/api")) }} -``` -And then in your JS file: - -```js -import * as params from '@params'; -``` - -Note that this is meant for small data sets, e.g. configuration settings. For larger data, please put/mount the files into `/assets` and import them directly. - -minify -: (`bool`)Let `js.Build` handle the minification. - -inject -: (`slice`) This option allows you to automatically replace a global variable with an import from another file. The path names must be relative to `assets`. See https://esbuild.github.io/api/#inject - -shims -: (`map`) This option allows swapping out a component with another. A common use case is to load dependencies like React from a CDN (with _shims_) when in production, but running with the full bundled `node_modules` dependency during development: - -```go-html-template -{{ $shims := dict "react" "js/shims/react.js" "react-dom" "js/shims/react-dom.js" }} -{{ $js = $js | js.Build dict "shims" $shims }} -``` - -The _shim_ files may look like these: - -```js -// js/shims/react.js -module.exports = window.React; -``` - -```js -// js/shims/react-dom.js -module.exports = window.ReactDOM; -``` - -With the above, these imports should work in both scenarios: - -```js -import * as React from 'react'; -import * as ReactDOM from 'react-dom/client'; -``` - -target -: (`string`) The language target. One of: `es5`, `es2015`, `es2016`, `es2017`, `es2018`, `es2019`, `es2020` or `esnext`. Default is `esnext`. - -externals -: (`slice`) External dependencies. Use this to trim dependencies you know will never be executed. See https://esbuild.github.io/api/#external - -defines -: (`map`) Allow to define a set of string replacement to be performed when building. Should be a map where each key is to be replaced by its value. - -```go-html-template -{{ $defines := dict "process.env.NODE_ENV" `"development"` }} -``` - format : (`string`) The output format. One of: `iife`, `cjs`, `esm`. Default is `iife`, a self-executing function, suitable for inclusion as a ` -``` +See [JS functions](http://localhost:1313/functions/js/). \ No newline at end of file diff --git a/content/en/methods/page/Resources.md b/content/en/methods/page/Resources.md index 54a61a2e4..0237ee352 100644 --- a/content/en/methods/page/Resources.md +++ b/content/en/methods/page/Resources.md @@ -69,6 +69,20 @@ When working with global resources instead of page resources, use the [`resource When working with global resources instead of page resources, use the [`resources.Match`] function. +###### Mount + +{{< new-in "0.140.0" >}} + +(`ResourceGetter`) Mounts the given resources from the two arguments base (`string`) to the given target path (`string`) and returns an object that implements [Get](#get). Note that leading slashes in target marks an absolute path. Relative target paths allows you to mount resources relative to another set, e.g. a [Page bundle](/content-management/page-bundles/): + +```go-html-template +{{ $common := resources.Match "/js/headlessui/*.*" }} +{{ $importContext := (slice $.Page ($common.Mount "/js/headlessui" ".")) }} +``` + +This method is currently only useful in [js.Batch](/functions/js/batch/#import-context). + + ## Pattern matching With the `GetMatch` and `Match` methods, Hugo determines a match using a case-insensitive [glob pattern]. From fbe2d442f272ff8540b561ac6c6bf225084f8024 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Thu, 12 Dec 2024 12:56:38 -0800 Subject: [PATCH 06/31] Miscellaneous updates for v0.140.0 - Add configuration option: disableDefaultLanguageRedirect - Allow collections.Querify to accept a map argument --- .../en/functions/collections/Dictionary.md | 2 +- content/en/functions/collections/Querify.md | 23 +++++++++++++++---- content/en/getting-started/configuration.md | 6 +++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/content/en/functions/collections/Dictionary.md b/content/en/functions/collections/Dictionary.md index 2ac875d28..07d1eb0f2 100644 --- a/content/en/functions/collections/Dictionary.md +++ b/content/en/functions/collections/Dictionary.md @@ -7,7 +7,7 @@ action: aliases: [dict] related: - functions/collections/Slice - returnType: mapany + returnType: map[string]any signatures: ['collections.Dictionary [VALUE...]'] aliases: [/functions/dict] --- diff --git a/content/en/functions/collections/Querify.md b/content/en/functions/collections/Querify.md index 07e27bd7e..0eb409421 100644 --- a/content/en/functions/collections/Querify.md +++ b/content/en/functions/collections/Querify.md @@ -1,6 +1,6 @@ --- title: collections.Querify -description: Returns a URL query string composed of the given key-value pairs. +description: Returns a URL query string composed of the given key-value pairs, encoded and sorted by key. categories: [] keywords: [] action: @@ -13,18 +13,18 @@ action: aliases: [/functions/querify] --- -Specify the key-value pairs as individual arguments, or as a slice. The following are equivalent: - +Specify the key-value pairs as a map, a slice, or a sequence of scalar values. For example, the following are equivalent: ```go-html-template -{{ collections.Querify "a" 1 "b" 2 }} +{{ collections.Querify (dict "a" 1 "b" 2) }} {{ collections.Querify (slice "a" 1 "b" 2) }} +{{ collections.Querify "a" 1 "b" 2 }} ``` To append a query string to a URL: ```go-html-template -{{ $qs := collections.Querify "a" 1 "b" 2 }} +{{ $qs := collections.Querify (dict "a" 1 "b" 2) }} {{ $href := printf "https://example.org?%s" $qs }} Link @@ -35,3 +35,16 @@ Hugo renders this to: ```html Link ``` + +You can also pass in a map from your site configuration or front matter. For example: + +{{< code-toggle file=content/example.md fm=true >}} +title = 'Example' +[params.query] +a = 1 +b = 2 +{{< /code-toggle >}} + +```go-html-template +{{ collections.Querify .Params.query }} +``` diff --git a/content/en/getting-started/configuration.md b/content/en/getting-started/configuration.md index 342804a72..b8922723a 100644 --- a/content/en/getting-started/configuration.md +++ b/content/en/getting-started/configuration.md @@ -278,6 +278,12 @@ To remain consistent and prevent unexpected behavior, do not mix these strategie (`bool`) Will disable generation of alias redirects. Note that even if `disableAliases` is set, the aliases themselves are preserved on the page. The motivation with this is to be able to generate 301 redirects in an `.htaccess`, a Netlify `_redirects` file or similar using a custom output format. Default is `false`. +###### disableDefaultLanguageRedirect + +{{< new-in 0.140.0 >}} + +(`bool`) Disables generation of redirect to the default language when DefaultContentLanguageInSubdir is `true`. Default is `false`. + ###### disableHugoGeneratorInject (`bool`) Hugo will, by default, inject a generator meta tag in the HTML head on the _home page only_. You can turn it off, but we would really appreciate if you don't, as this is a good way to watch Hugo's popularity on the rise. Default is `false`. From 2d151d77f7e0857e6fb9ea54574958d52b5af908 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Tue, 17 Dec 2024 09:34:53 -0800 Subject: [PATCH 07/31] Fix link --- content/en/hugo-pipes/js.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/hugo-pipes/js.md b/content/en/hugo-pipes/js.md index e56ebf697..f5b8cb4e4 100644 --- a/content/en/hugo-pipes/js.md +++ b/content/en/hugo-pipes/js.md @@ -12,4 +12,4 @@ weight: 60 --- -See [JS functions](http://localhost:1313/functions/js/). \ No newline at end of file +See [JS functions](/functions/js/). From bb30e7c08f471d2d65f7a81ebedc791b185e39ff Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Tue, 17 Dec 2024 10:30:48 -0800 Subject: [PATCH 08/31] Document PAGE.String --- content/en/methods/page/Store.md | 1 - content/en/methods/page/String.md | 45 +++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 content/en/methods/page/String.md diff --git a/content/en/methods/page/Store.md b/content/en/methods/page/Store.md index 484c27fd5..ee0c5b00d 100644 --- a/content/en/methods/page/Store.md +++ b/content/en/methods/page/Store.md @@ -1,6 +1,5 @@ --- title: Store -linktitle: PAGE.Store description: Returns a persistent "scratch pad" on the given page to store and manipulate data. categories: [] keywords: [] diff --git a/content/en/methods/page/String.md b/content/en/methods/page/String.md new file mode 100644 index 000000000..5445399bb --- /dev/null +++ b/content/en/methods/page/String.md @@ -0,0 +1,45 @@ +--- +title: String +description: Returns the absolute path to the file backing the given page. +categories: [] +keywords: [] +action: + related: [] + returnType: string + signatures: [PAGE.String] +toc: true +--- + +{{< new-in 0.137.0 >}} + +With content from the file system: + +```go-html-template +{{ .String }} → /home/user/project/content/posts/post-1.md +``` + +With content from a content adapter: + +```go-html-template +{{ .String }} → /home/user/project/content/posts/_content.gotmpl:/posts/post-1.md +``` + +With content from a module: + +```go-html-template +{{ .String }} → /home/user/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/user/hugo-module-content@v0.1.9/content/posts/post-1.md +``` + +Use this method to provide useful information when displaying error and warning messages in the console: + +{{< code file="layouts/partials/featured-image.html" lang="go-html-template" >}} +{{ with .Resources.GetMatch "*featured*" }} + {{ with .Resize "300x webp" }} + + {{ end }} +{{ else }} + {{ errorf "The featured-image partial was unable to find a featured image. See %s" .String }} +{{ end }} +{{< /code >}} + +With shortcodes and render hooks use the `Position` method instead. Note that the `Position` method is not available to heading, image, and link render hooks. From 9e1c85bbddea057fcc42a3b4d3e6ff4478b5b11e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Tue, 17 Dec 2024 20:24:12 +0100 Subject: [PATCH 09/31] Revert "Document PAGE.String" This reverts commit bb30e7c08f471d2d65f7a81ebedc791b185e39ff. We don't want to document this, at least not this way. The PAGE.String method is currently meant to be used to give contextual information about a page (path, filename). It's meant for error messages, so you can do ``` {{ warnf "foo not found in %q" .Page }} ``` But when documented as "Returns the absolute path to the file backing the given page", that is 1. Not entirely correct. 2. Makes it a formal API that people will use as a filename/path, and we can never change it (e.g. to add more contextual information) --- content/en/methods/page/Store.md | 1 + content/en/methods/page/String.md | 45 ------------------------------- 2 files changed, 1 insertion(+), 45 deletions(-) delete mode 100644 content/en/methods/page/String.md diff --git a/content/en/methods/page/Store.md b/content/en/methods/page/Store.md index ee0c5b00d..484c27fd5 100644 --- a/content/en/methods/page/Store.md +++ b/content/en/methods/page/Store.md @@ -1,5 +1,6 @@ --- title: Store +linktitle: PAGE.Store description: Returns a persistent "scratch pad" on the given page to store and manipulate data. categories: [] keywords: [] diff --git a/content/en/methods/page/String.md b/content/en/methods/page/String.md deleted file mode 100644 index 5445399bb..000000000 --- a/content/en/methods/page/String.md +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: String -description: Returns the absolute path to the file backing the given page. -categories: [] -keywords: [] -action: - related: [] - returnType: string - signatures: [PAGE.String] -toc: true ---- - -{{< new-in 0.137.0 >}} - -With content from the file system: - -```go-html-template -{{ .String }} → /home/user/project/content/posts/post-1.md -``` - -With content from a content adapter: - -```go-html-template -{{ .String }} → /home/user/project/content/posts/_content.gotmpl:/posts/post-1.md -``` - -With content from a module: - -```go-html-template -{{ .String }} → /home/user/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/user/hugo-module-content@v0.1.9/content/posts/post-1.md -``` - -Use this method to provide useful information when displaying error and warning messages in the console: - -{{< code file="layouts/partials/featured-image.html" lang="go-html-template" >}} -{{ with .Resources.GetMatch "*featured*" }} - {{ with .Resize "300x webp" }} - - {{ end }} -{{ else }} - {{ errorf "The featured-image partial was unable to find a featured image. See %s" .String }} -{{ end }} -{{< /code >}} - -With shortcodes and render hooks use the `Position` method instead. Note that the `Position` method is not available to heading, image, and link render hooks. From 2f1843d10a5986be1a6310b5c60d1ca8b306bb45 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Tue, 17 Dec 2024 12:04:41 -0800 Subject: [PATCH 10/31] Use .Page.GetPage in examples of an include shortcode --- content/en/methods/page/RenderShortcodes.md | 10 ++++++++-- content/en/render-hooks/_common/pageinner.md | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/content/en/methods/page/RenderShortcodes.md b/content/en/methods/page/RenderShortcodes.md index e95e0683e..48d8071f0 100644 --- a/content/en/methods/page/RenderShortcodes.md +++ b/content/en/methods/page/RenderShortcodes.md @@ -24,8 +24,14 @@ Use this method in shortcode templates to compose a page from multiple content f For example: {{< code file=layouts/shortcodes/include.html >}} -{{ with site.GetPage (.Get 0) }} - {{ .RenderShortcodes }} +{{ with .Get 0 }} + {{ with $.Page.GetPage . }} + {{ .RenderShortcodes }} + {{ else }} + {{ errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }} + {{ end }} +{{ else }} + {{ errorf "The %q shortcode requires a positional parameter indicating the logical path of the file to include. See %s" .Name .Position }} {{ end }} {{< /code >}} diff --git a/content/en/render-hooks/_common/pageinner.md b/content/en/render-hooks/_common/pageinner.md index 1d467aeef..3388bd949 100644 --- a/content/en/render-hooks/_common/pageinner.md +++ b/content/en/render-hooks/_common/pageinner.md @@ -9,8 +9,14 @@ _comment: Do not remove front matter. The primary use case for `PageInner` is to resolve links and [page resources] relative to an included `Page`. For example, create an "include" shortcode to compose a page from multiple content files, while preserving a global context for footnotes and the table of contents: {{< code file=layouts/shortcodes/include.html >}} -{{ with site.GetPage (.Get 0) }} - {{ .RenderShortcodes }} +{{ with .Get 0 }} + {{ with $.Page.GetPage . }} + {{ .RenderShortcodes }} + {{ else }} + {{ errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }} + {{ end }} +{{ else }} + {{ errorf "The %q shortcode requires a positional parameter indicating the logical path of the file to include. See %s" .Name .Position }} {{ end }} {{< /code >}} From bce733c63bbb562457ae9928421ed30ad8ddd130 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Wed, 18 Dec 2024 12:36:01 -0800 Subject: [PATCH 11/31] Update theme --- .../gohugoio/gohugoioTheme/layouts/shortcodes/include.html | 2 +- _vendor/modules.txt | 2 +- go.mod | 2 +- go.sum | 6 ++---- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/shortcodes/include.html b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/shortcodes/include.html index cb9c12587..9456e197e 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/layouts/shortcodes/include.html +++ b/_vendor/github.com/gohugoio/gohugoioTheme/layouts/shortcodes/include.html @@ -10,7 +10,7 @@ You must call this shortcode using the {{% %}} notation. */}} {{- with .Get 0 }} - {{- with or (site.GetPage .) ($.Page.GetPage .) }} + {{- with $.Page.GetPage . }} {{- .RenderShortcodes }} {{- else }} {{- errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }} diff --git a/_vendor/modules.txt b/_vendor/modules.txt index 6121aaa80..ff7309d06 100644 --- a/_vendor/modules.txt +++ b/_vendor/modules.txt @@ -1 +1 @@ -# github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253 +# github.com/gohugoio/gohugoioTheme v0.0.0-20241217195817-fc2ee93d77de diff --git a/go.mod b/go.mod index 0f4cdd57f..e38bc5350 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs go 1.22.0 -require github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253 // indirect +require github.com/gohugoio/gohugoioTheme v0.0.0-20241217195817-fc2ee93d77de // indirect diff --git a/go.sum b/go.sum index e2386a94a..95707fbf6 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,4 @@ -github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1 h1:d6XNQ4QYvJGIE8vMejUFTD89AWaPDywcLivzWpEU0qE= -github.com/gohugoio/gohugoioTheme v0.0.0-20241119115653-b92d27ede3e1/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= -github.com/gohugoio/gohugoioTheme v0.0.0-20241217120756-d943fd149ebe h1:+G6k1qjxy7Cx6ZR7RXZmysp5hbFUtlvhhDP3p1VqqxA= -github.com/gohugoio/gohugoioTheme v0.0.0-20241217120756-d943fd149ebe/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253 h1:7DYEU25rQryCGyUISUpIye3oE0kz+9K9SiD6/O5rqvM= github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20241217195817-fc2ee93d77de h1:RsBXZgT+6UZ1yBFiFy+Kbkyw5Yn2S7uXottd/vWGxaw= +github.com/gohugoio/gohugoioTheme v0.0.0-20241217195817-fc2ee93d77de/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= From 32cc191f665f7dd9388c2250cec8c227ff6c1bc3 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Wed, 18 Dec 2024 13:33:06 -0800 Subject: [PATCH 12/31] Clarify Name and Title menu entry methods --- content/en/methods/menu-entry/Name.md | 4 ++-- content/en/methods/menu-entry/Title.md | 10 ++-------- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/content/en/methods/menu-entry/Name.md b/content/en/methods/menu-entry/Name.md index d77c65cb5..fb5fc1b5b 100644 --- a/content/en/methods/menu-entry/Name.md +++ b/content/en/methods/menu-entry/Name.md @@ -9,9 +9,9 @@ action: signatures: [MENUENTRY.Name] --- -If you define the menu entry [automatically], the `Name` method returns the page’s [`LinkTitle`], falling back to its [`Title`]. +If you define the menu entry [automatically], the `Name` method returns the page's [`LinkTitle`], falling back to its [`Title`]. -If you define the menu entry [in front matter] or [in site configuration], the `Name` method returns the `name` property, falling back to the page’s `LinkTitle`, then to its `Title`. +If you define the menu entry [in front matter] or [in site configuration], the `Name` method returns the `name` property of the given menu entry. If the `name` is not defined, and the menu entry resolves to a page, the `Name` returns the page [`LinkTitle`], falling back to its [`Title`]. [`LinkTitle`]: /methods/page/linktitle/ [`Title`]: /methods/page/title/ diff --git a/content/en/methods/menu-entry/Title.md b/content/en/methods/menu-entry/Title.md index 4082e4e93..64bba2d44 100644 --- a/content/en/methods/menu-entry/Title.md +++ b/content/en/methods/menu-entry/Title.md @@ -9,20 +9,14 @@ action: signatures: [MENUENTRY.Title] --- -If you define the menu entry [automatically], the `Title` method returns the page’s [`LinkTitle`], falling back to its [`Title`]. +The `Title` method returns the `title` property of the given menu entry. If the `title` is not defined, and the menu entry resolves to a page, the `Title` returns the page [`Title`]. -If you define the menu entry [in front matter] or [in site configuration], the `Title` method returns the `title` property, falling back to the page’s `LinkTitle`, then to its `Title`. - -[`LinkTitle`]: /methods/page/linktitle/ [`Title`]: /methods/page/title/ -[automatically]: /content-management/menus/#define-automatically -[in front matter]: /content-management/menus/#define-in-front-matter -[in site configuration]: /content-management/menus/#define-in-site-configuration ```go-html-template {{ end }} From 97b4ef54423912bdbe9c9fb3a840c64eb0cb1a21 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Thu, 19 Dec 2024 16:46:43 -0800 Subject: [PATCH 14/31] Update related.md --- content/en/content-management/related.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/en/content-management/related.md b/content/en/content-management/related.md index aacf59d2d..44b115a64 100644 --- a/content/en/content-management/related.md +++ b/content/en/content-management/related.md @@ -21,12 +21,12 @@ To list up to 5 related pages (which share the same _date_ or _keyword_ paramete {{< code file=layouts/partials/related.html >}} {{ $related := .Site.RegularPages.Related . | first 5 }} {{ with $related }} -

See Also

- +

See Also

+ {{ end }} {{< /code >}} From 34b30bad250431dd249a2140209cbf24525a70e7 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 20 Dec 2024 08:56:38 -0800 Subject: [PATCH 15/31] Remove indentation from include shortcode examples --- content/en/methods/page/RenderShortcodes.md | 2 +- content/en/render-hooks/_common/pageinner.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/methods/page/RenderShortcodes.md b/content/en/methods/page/RenderShortcodes.md index 48d8071f0..70674a9c0 100644 --- a/content/en/methods/page/RenderShortcodes.md +++ b/content/en/methods/page/RenderShortcodes.md @@ -26,7 +26,7 @@ For example: {{< code file=layouts/shortcodes/include.html >}} {{ with .Get 0 }} {{ with $.Page.GetPage . }} - {{ .RenderShortcodes }} + {{- .RenderShortcodes }} {{ else }} {{ errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }} {{ end }} diff --git a/content/en/render-hooks/_common/pageinner.md b/content/en/render-hooks/_common/pageinner.md index 3388bd949..75f628752 100644 --- a/content/en/render-hooks/_common/pageinner.md +++ b/content/en/render-hooks/_common/pageinner.md @@ -11,7 +11,7 @@ The primary use case for `PageInner` is to resolve links and [page resources] re {{< code file=layouts/shortcodes/include.html >}} {{ with .Get 0 }} {{ with $.Page.GetPage . }} - {{ .RenderShortcodes }} + {{- .RenderShortcodes }} {{ else }} {{ errorf "The %q shortcode was unable to find %q. See %s" $.Name . $.Position }} {{ end }} From 2573fd12020d4891e19527afdf696c34217909cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 23 Dec 2024 18:08:18 +0100 Subject: [PATCH 16/31] netlify: Hugo 0.140.1 --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 9c46b4ac0..2dc6318cb 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ command = "hugo --gc --minify" [build.environment] - HUGO_VERSION = "0.140.0" + HUGO_VERSION = "0.140.1" [context.production.environment] HUGO_ENV = "production" From 73a6cd966b8a11d90d2083ce4a9d176ed7ea8e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 23 Dec 2024 18:49:30 +0100 Subject: [PATCH 17/31] Update theme --- .../gohugoio/gohugoioTheme/data/sponsors.toml | 17 ++++++++--------- _vendor/modules.txt | 2 +- go.mod | 2 +- go.sum | 2 ++ 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml b/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml index ca02ecc6f..705ca9746 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml +++ b/_vendor/github.com/gohugoio/gohugoioTheme/data/sponsors.toml @@ -5,15 +5,6 @@ utm_campaign = "hugosponsor" bgcolor = "#ffffff" -[[banners]] - 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 = "GoLand" title = "The complete IDE crafted for professional Go developers." @@ -21,3 +12,11 @@ link = "https://www.jetbrains.com/go/?utm_source=OSS&utm_medium=referral&utm_campaign=hugo" logo = "images/sponsors/goland.svg" bgcolor = "#f4f4f4" + +[[banners]] + name = "Your Company?" + link = "https://bep.is/en/hugo-sponsor-2023-01/" + utm_campaign = "hugosponsor" + show_on_hover = true + bgcolor = "#4e4f4f" + link_attr = "style='color: #ffffff; font-weight: bold; text-decoration: none; text-align: center'" diff --git a/_vendor/modules.txt b/_vendor/modules.txt index ff7309d06..8b97db22a 100644 --- a/_vendor/modules.txt +++ b/_vendor/modules.txt @@ -1 +1 @@ -# github.com/gohugoio/gohugoioTheme v0.0.0-20241217195817-fc2ee93d77de +# github.com/gohugoio/gohugoioTheme v0.0.0-20241223174847-fbbab8777a87 diff --git a/go.mod b/go.mod index e38bc5350..fa7dd43cf 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs go 1.22.0 -require github.com/gohugoio/gohugoioTheme v0.0.0-20241217195817-fc2ee93d77de // indirect +require github.com/gohugoio/gohugoioTheme v0.0.0-20241223174847-fbbab8777a87 // indirect diff --git a/go.sum b/go.sum index 95707fbf6..ea6cf6dc2 100644 --- a/go.sum +++ b/go.sum @@ -2,3 +2,5 @@ github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253 h1:7DYEU25r github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= github.com/gohugoio/gohugoioTheme v0.0.0-20241217195817-fc2ee93d77de h1:RsBXZgT+6UZ1yBFiFy+Kbkyw5Yn2S7uXottd/vWGxaw= github.com/gohugoio/gohugoioTheme v0.0.0-20241217195817-fc2ee93d77de/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20241223174847-fbbab8777a87 h1:EHSzYyQyjgTqz3n52+eMzwbqk/mAFIt/NIFMdvu7Z0k= +github.com/gohugoio/gohugoioTheme v0.0.0-20241223174847-fbbab8777a87/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= From 41ca381b0e99c134d44d7b08a02c69dc20acdfa7 Mon Sep 17 00:00:00 2001 From: Timoses Date: Tue, 24 Dec 2024 16:19:48 +0100 Subject: [PATCH 18/31] Fix documentation of Fragments --- content/en/methods/page/Fragments.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/content/en/methods/page/Fragments.md b/content/en/methods/page/Fragments.md index 7bcad1ef9..0bc6b651c 100644 --- a/content/en/methods/page/Fragments.md +++ b/content/en/methods/page/Fragments.md @@ -28,14 +28,15 @@ Use the `Fragments` method on a `Page` object to create a table of contents with ## Methods Headings -: (`map`) A nested map of all headings on the page. Each map contains the following keys: `ID`, `Level`, `Title` and `Headings`. To inspect the data structure: +: (`slice`) A slice of maps of all headings on the page, with first-level keys for each heading. Each map contains the following keys: `ID`, `Level`, `Title` and `Headings`. To inspect the data structure: ```go-html-template
{{ debug.Dump .Fragments.Headings }}
``` + HeadingsMap -: (`slice`) A slice of maps of all headings on the page, with first-level keys for each heading. Each map contains the following keys: `ID`, `Level`, `Title` and `Headings`. To inspect the data structure: +: (`map`) A nested map of all headings on the page. Each map contains the following keys: `ID`, `Level`, `Title` and `Headings`. To inspect the data structure: ```go-html-template
{{ debug.Dump .Fragments.HeadingsMap }}
From b95d2844474a894e86876765ca67e0c916abff8c Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 27 Dec 2024 09:24:56 -0800 Subject: [PATCH 19/31] Fix description of the the hugo server command Closes #2802 --- content/en/getting-started/usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/getting-started/usage.md b/content/en/getting-started/usage.md index b19920907..dbbccc6f0 100644 --- a/content/en/getting-started/usage.md +++ b/content/en/getting-started/usage.md @@ -99,7 +99,7 @@ To view your site while developing layouts or creating content, `cd` into your p hugo server ``` -The [`hugo server`] command builds your site into memory, and serves your pages using a minimal HTTP server. When you run `hugo server` it will display the URL of your local site: +The [`hugo server`] command builds your site and serves your pages using a minimal HTTP server. When you run `hugo server` it will display the URL of your local site: ```text Web Server is available at http://localhost:1313/ From e227dc422d9f80e9a60c7b2281a39ab4e482d68e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 30 Dec 2024 16:36:55 +0100 Subject: [PATCH 20/31] Hugo 0.140.2 --- netlify.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netlify.toml b/netlify.toml index 2dc6318cb..f1269e32d 100644 --- a/netlify.toml +++ b/netlify.toml @@ -3,7 +3,7 @@ command = "hugo --gc --minify" [build.environment] - HUGO_VERSION = "0.140.1" + HUGO_VERSION = "0.140.2" [context.production.environment] HUGO_ENV = "production" From ef00649db4429597d9293a660ea23ea2b2afe457 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Tue, 31 Dec 2024 06:54:43 -0800 Subject: [PATCH 21/31] Document wrapperClass highlighting option --- content/en/functions/transform/Highlight.md | 84 ++++++++++----------- content/en/getting-started/glossary.md | 4 + data/docs.yaml | 12 ++- 3 files changed, 56 insertions(+), 44 deletions(-) diff --git a/content/en/functions/transform/Highlight.md b/content/en/functions/transform/Highlight.md index 29d0efdef..8fa6719eb 100644 --- a/content/en/functions/transform/Highlight.md +++ b/content/en/functions/transform/Highlight.md @@ -25,53 +25,55 @@ LANG : The language of the code to highlight. Choose from one of the [supported languages]. Case-insensitive. OPTIONS -: A map, or comma-separated list, of zero or more [options]. Set default values in [site configuration]. +: A map or comma-separated list of zero or more options. Set default values in [site configuration]. ## Options -lineNos -: Boolean. Default is `false`.\ -Display a number at the beginning of each line. - -lineNumbersInTable -: Boolean. Default is `true`.\ -Render the highlighted code in an HTML table with two cells. The left table cell contains the line numbers. The right table cell contains the code, allowing a user to select and copy the code without line numbers. Irrelevant if `lineNos` is `false`. - anchorLineNos -: Boolean. Default is `false`.\ -Render each line number as an HTML anchor element, and set the `id` attribute of the surrounding `` to the line number. Irrelevant if `lineNos` is `false`. +: (`bool`) Whether to render each line number as an HTML anchor element, setting the `id` attribute of the surrounding `span` element to the line number. Irrelevant if `lineNos` is `false`. Default is `false`. -lineAnchors -: String. Default is `""`.\ -When rendering a line number as an HTML anchor element, prepend this value to the `id` attribute of the surrounding ``. This provides unique `id` attributes when a page contains two or more code blocks. Irrelevant if `lineNos` or `anchorLineNos` is `false`. - -lineNoStart -: Integer. Default is `1`.\ -The number to display at the beginning of the first line. Irrelevant if `lineNos` is `false`. - -hl_Lines -: String. Default is `""`.\ -A space-delimited list of lines to emphasize within the highlighted code. To emphasize lines 2, 3, 4, and 7, set this value to `2-4 7`. This option is independent of the `lineNoStart` option. - -hl_inline -: Boolean. Default is `false`.\ -Render the highlighted code without a wrapping container. - -style -: String. Default is `monokai`.\ -The CSS styles to apply to the highlighted code. See the [style gallery] for examples. Case-sensitive. - -noClasses -: Boolean. Default is `true`.\ -Use inline CSS styles instead of an external CSS file. To use an external CSS file, set this value to `false` and [generate the file with the hugo client][hugo client]. - -tabWidth -: Integer. Default is `4`.\ -Substitute this number of spaces for each tab character in your highlighted code. Irrelevant if `noClasses` is `false`. +codeFences +: (`bool`) Whether to highlight fenced code blocks. Default is `true`. guessSyntax -: Boolean. Default is `false`.\ -If the `LANG` argument is blank or an unrecognized language, auto-detect the language if possible, otherwise use a fallback language. +: (`bool`) Whether to automatically detect the language if the `LANG` argument is blank or set to a language for which there is no corresponding [lexer]. Falls back to a plain text lexer if unable to automatically detect the language. Default is `false`. + +[lexer]: /getting-started/glossary/#lexer + +{{% note %}} +The Chroma syntax highlighter includes lexers for approximately 250 languages, but only 5 of these have implemented automatic language detection. +{{% /note %}} + +hl_Lines +: (`string`) A space-delimited list of lines to emphasize within the highlighted code. To emphasize lines 2, 3, 4, and 7, set this value to `2-4 7`. This option is independent of the `lineNoStart` option. + +hl_inline +: (`bool`) Whether to render the highlighted code without a wrapping container.Default is `false`. + +lineAnchors +: (`string`) When rendering a line number as an HTML anchor element, prepend this value to the `id` attribute of the surrounding `span` element. This provides unique `id` attributes when a page contains two or more code blocks. Irrelevant if `lineNos` or `anchorLineNos` is `false`. + +lineNoStart +: (`int`) The number to display at the beginning of the first line. Irrelevant if `lineNos` is `false`. Default is `1`. + +lineNos +: (`bool`) Whether to display a number at the beginning of each line. Default is `false`. + +lineNumbersInTable +: (`bool`) Whether to render the highlighted code in an HTML table with two cells. The left table cell contains the line numbers, while the right table cell contains the code. Irrelevant if `lineNos` is `false`. Default is `true`. + +noClasses +: (`bool`) Whether to use inline CSS styles instead of an external CSS file. To use an external CSS file, set this value to `false` and generate the CSS file using the `hugo gen chromastyles` command. Default is `true`. + +style +: (`string`) The CSS styles to apply to the highlighted code. See the [style gallery] for examples. Case-sensitive. Default is `monokai`. + +tabWidth +: (`int`) Substitute this number of spaces for each tab character in your highlighted code. Irrelevant if `noClasses` is `false`. Default is `4`. + +wrapperClass +{{< new-in 0.140.2 >}} +: (`string`) The class or classes to use for the outermost element of the highlighted code. Default is `highlight`. {{% note %}} Instead of specifying both `lineNos` and `lineNumbersInTable`, you can use the following shorthand notation: @@ -100,8 +102,6 @@ lineNos=table ``` [Chroma]: https://github.com/alecthomas/chroma -[hugo client]: /commands/hugo_gen_chromastyles -[options]: #options [site configuration]: /getting-started/configuration-markup#highlight [style gallery]: https://xyproto.github.io/splash/docs/ [supported languages]: /content-management/syntax-highlighting#list-of-chroma-highlighting-languages diff --git a/content/en/getting-started/glossary.md b/content/en/getting-started/glossary.md index 0e63c790d..117f6f1aa 100644 --- a/content/en/getting-started/glossary.md +++ b/content/en/getting-started/glossary.md @@ -207,6 +207,10 @@ See [template](#template). A directory that contains an index.md file and zero or more [resources](#resource). Analogous to a physical leaf, a leaf bundle is at the end of a branch. It has no descendants. See [details](/content-management/page-bundles/). +###### lexer + +A software component that identifies keywords, identifiers, operators, numbers, and other basic building blocks of a programming language within the input text. + ###### list page Any [page kind](#page-kind) that receives a page [collection](#collection) in [context](#context). This includes the home page, [section pages](#section-page), [taxonomy pages](#taxonomy-page), and [term pages](#term-page). diff --git a/data/docs.yaml b/data/docs.yaml index 4999bfc0b..73a17ab06 100644 --- a/data/docs.yaml +++ b/data/docs.yaml @@ -1005,6 +1005,7 @@ config: targets: null workers: 10 disableAliases: false + disableDefaultLanguageRedirect: false disableHugoGeneratorInject: false disableKinds: null disableLanguages: null @@ -1148,6 +1149,7 @@ config: noHl: false style: monokai tabWidth: 4 + wrapperClass: highlight tableOfContents: endLevel: 3 ordered: false @@ -2560,8 +2562,9 @@ tpl: - querify Args: - params - Description: Querify encodes the given params in URL-encoded form ("bar=baz&foo=quux") - sorted by key. + Description: |- + Querify returns a URL query string composed of the given key-value pairs, + encoded and sorted by key. Examples: - - '{{ (querify "foo" 1 "bar" 2 "baz" "with spaces" "qux" "this&that=those") | safeHTML }}' @@ -3289,6 +3292,11 @@ tpl: - args Description: Babel processes the given Resource with Babel. Examples: [] + Batch: + Aliases: null + Args: null + Description: "" + Examples: null Build: Aliases: null Args: null From d4bdfb96bdf1c2dcf8e62e0f5f0a02147059af9a Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Thu, 2 Jan 2025 10:52:41 -0800 Subject: [PATCH 22/31] Update Filter.md --- content/en/methods/resource/Filter.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/methods/resource/Filter.md b/content/en/methods/resource/Filter.md index 9db6bbe17..2b059c993 100644 --- a/content/en/methods/resource/Filter.md +++ b/content/en/methods/resource/Filter.md @@ -6,7 +6,7 @@ keywords: [] action: related: - functions/images/Filter - returnType: resources.resourceAdapter + returnType: images.ImageResource signatures: [RESOURCE.Filter FILTER...] toc: true --- From 083fc39c6820957633df3424c7ccd20a28577514 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 2 Jan 2025 21:50:50 +0100 Subject: [PATCH 23/31] Update shortcode.md --- content/en/templates/shortcode.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/en/templates/shortcode.md b/content/en/templates/shortcode.md index 5587c7479..e7c6f1d8a 100644 --- a/content/en/templates/shortcode.md +++ b/content/en/templates/shortcode.md @@ -395,10 +395,10 @@ It is disabled by default for security reasons. The security model used by Hugo' And once enabled, you can do this in your content files: ```go-html-template - {{}}{{ now }}{{}} +{{< sum.inline 4.3 3.14 8.23 12.4 >}}Sum: {{ math.Sum .Params }}{{< /sum.inline >}} ``` -The above will print the current date and time. +The above will print the sum of the numbers given. Note that an inline shortcode's inner content is parsed and executed as a Go text template with the same context as a regular shortcode template. @@ -407,7 +407,7 @@ This means that the current page can be accessed via `.Page.Title` etc. This als The same inline shortcode can be reused later in the same content file, with different arguments if needed, using the self-closing syntax: ```go-html-template -{{}} +{{< sum.inline 3.14159265359 6.324 />}} ``` [`.Parent`]: /methods/shortcode/parent/ From f8188f1c8c0dfb56fb634d799d3c417c08a780ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 2 Jan 2025 22:04:23 +0100 Subject: [PATCH 24/31] Update shortcode.md --- content/en/templates/shortcode.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/en/templates/shortcode.md b/content/en/templates/shortcode.md index e7c6f1d8a..d1d8dee01 100644 --- a/content/en/templates/shortcode.md +++ b/content/en/templates/shortcode.md @@ -395,7 +395,7 @@ It is disabled by default for security reasons. The security model used by Hugo' And once enabled, you can do this in your content files: ```go-html-template -{{< sum.inline 4.3 3.14 8.23 12.4 >}}Sum: {{ math.Sum .Params }}{{< /sum.inline >}} +{{}}Sum: {{ math.Sum .Params }}{{}} ``` The above will print the sum of the numbers given. @@ -407,7 +407,7 @@ This means that the current page can be accessed via `.Page.Title` etc. This als The same inline shortcode can be reused later in the same content file, with different arguments if needed, using the self-closing syntax: ```go-html-template -{{< sum.inline 3.14159265359 6.324 />}} +{{}} ``` [`.Parent`]: /methods/shortcode/parent/ From f7ec2ee9c2d99504cf5eee37ffc1a2512be15b05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 2 Jan 2025 22:07:07 +0100 Subject: [PATCH 25/31] Revert "Update shortcode.md" This reverts commit f8188f1c8c0dfb56fb634d799d3c417c08a780ad. Revert "Update shortcode.md" This reverts commit 083fc39c6820957633df3424c7ccd20a28577514. --- content/en/templates/shortcode.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/en/templates/shortcode.md b/content/en/templates/shortcode.md index d1d8dee01..5587c7479 100644 --- a/content/en/templates/shortcode.md +++ b/content/en/templates/shortcode.md @@ -395,10 +395,10 @@ It is disabled by default for security reasons. The security model used by Hugo' And once enabled, you can do this in your content files: ```go-html-template -{{}}Sum: {{ math.Sum .Params }}{{}} + {{}}{{ now }}{{}} ``` -The above will print the sum of the numbers given. +The above will print the current date and time. Note that an inline shortcode's inner content is parsed and executed as a Go text template with the same context as a regular shortcode template. @@ -407,7 +407,7 @@ This means that the current page can be accessed via `.Page.Title` etc. This als The same inline shortcode can be reused later in the same content file, with different arguments if needed, using the self-closing syntax: ```go-html-template -{{}} +{{}} ``` [`.Parent`]: /methods/shortcode/parent/ From b030a7149295447ebab49f15ff9cb9539d46bd55 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Thu, 2 Jan 2025 18:17:01 -0800 Subject: [PATCH 26/31] Update configuration.md --- content/en/getting-started/configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/en/getting-started/configuration.md b/content/en/getting-started/configuration.md index b8922723a..3d75e7dd2 100644 --- a/content/en/getting-started/configuration.md +++ b/content/en/getting-started/configuration.md @@ -445,7 +445,7 @@ See [Content Management](/content-management/urls/#permalinks). ###### publishDir -(`string`) The directory to where Hugo will write the final static site (the HTML files etc.). Default is `public`. +(`string`) The directory where Hugo will write the final static site (the HTML files etc.). Default is `public`. ###### refLinksErrorLevel From 8584a05818619aab58aeaec42e1d2923d58c10ea Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Fri, 3 Jan 2025 21:44:00 +0100 Subject: [PATCH 27/31] Fix typos --- content/en/functions/js/Batch.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/en/functions/js/Batch.md b/content/en/functions/js/Batch.md index 05acfb683..85538c29b 100644 --- a/content/en/functions/js/Batch.md +++ b/content/en/functions/js/Batch.md @@ -254,7 +254,7 @@ The `Build` method returns an object with the following structure: Eeach [`Resource`] will be of media type `application/javascript` or `text/css`. - In a template you would typically hande one group with a given `ID` (e.g. scripts for the current section). Because of the concurrent build, this needs to be done in a [`templates.Defer`] block: + In a template you would typically handle one group with a given `ID` (e.g. scripts for the current section). Because of the concurrent build, this needs to be done in a [`templates.Defer`] block: ```go-html-template {{ $group := .group }} @@ -280,7 +280,7 @@ Eeach [`Resource`] will be of media type `application/javascript` or `text/css`. In the official documentation for [ESBuild's code splitting], there's a warning note in the header. The two issues are: -* `esm` is currently the only implementd output format. This means that it will not work for very old browsers. See [caniuse](https://caniuse.com/?search=ESM). +* `esm` is currently the only implemented output format. This means that it will not work for very old browsers. See [caniuse](https://caniuse.com/?search=ESM). * There's a known import ordering issue. We have not seen the ordering issue as a problem during our [extensive testing](https://github.com/bep/hugojsbatchdemo) of this new feature with different libraries. There are two main cases: @@ -288,7 +288,7 @@ We have not seen the ordering issue as a problem during our [extensive testing]( 1. Undefined execution order of imports, see [this comment](https://github.com/evanw/esbuild/issues/399#issuecomment-1458680887) 2. Only one execution order of imports, see [this comment](https://github.com/evanw/esbuild/issues/399#issuecomment-735355932) -Many would say that both of the above are [code smells](https://en.wikipedia.org/wiki/Code_smell). The first one has a simple workaround in Hugo. Define the import order in its own script and make sure it gets passed early to ESBuild, e.g. by putting it in a script goup with a name that comes early in the alphabet. +Many would say that both of the above are [code smells](https://en.wikipedia.org/wiki/Code_smell). The first one has a simple workaround in Hugo. Define the import order in its own script and make sure it gets passed early to ESBuild, e.g. by putting it in a script group with a name that comes early in the alphabet. ```js import './lib2.js'; From 751097f242a3395f3162f864226354b719eebb1d Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 4 Jan 2025 08:43:46 -0800 Subject: [PATCH 28/31] Use CI_PAGES_URL in GitLab Pages workflow --- .../en/hosting-and-deployment/hosting-on-gitlab.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/content/en/hosting-and-deployment/hosting-on-gitlab.md b/content/en/hosting-and-deployment/hosting-on-gitlab.md index d455c83e5..55ac23663 100644 --- a/content/en/hosting-and-deployment/hosting-on-gitlab.md +++ b/content/en/hosting-and-deployment/hosting-on-gitlab.md @@ -27,16 +27,15 @@ Define your [CI/CD](https://docs.gitlab.com/ee/ci/quick_start/) jobs by creating {{< code file=.gitlab-ci.yml copy=true >}} variables: - DART_SASS_VERSION: 1.80.6 - HUGO_VERSION: 0.137.1 - NODE_VERSION: 20.x + DART_SASS_VERSION: 1.81.1 GIT_DEPTH: 0 GIT_STRATEGY: clone GIT_SUBMODULE_STRATEGY: recursive + HUGO_VERSION: 0.140.2 + NODE_VERSION: 23.x TZ: America/Los_Angeles - image: - name: golang:1.22.1-bookworm + name: golang:1.23.4-bookworm pages: script: @@ -59,7 +58,7 @@ pages: # Install Node.js dependencies - "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true" # Build - - hugo --gc --minify + - hugo --gc --minify --baseURL ${CI_PAGES_URL} # Compress - find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec gzip -f -k {} \; - find public -type f -regex '.*\.\(css\|html\|js\|txt\|xml\)$' -exec brotli -f -k {} \; From eb841ce66a0f9ea5f6ce200194a6cf3f830e2b3d Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sun, 5 Jan 2025 20:46:22 -0800 Subject: [PATCH 29/31] Update theme --- .../gohugoio/gohugoioTheme/assets/css/_shame.css | 5 +++++ .../gohugoio/gohugoioTheme/assets/output/css/app.css | 5 +++++ _vendor/modules.txt | 2 +- go.mod | 2 +- go.sum | 8 ++------ 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/assets/css/_shame.css b/_vendor/github.com/gohugoio/gohugoioTheme/assets/css/_shame.css index 634adbf06..30e0c412d 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/assets/css/_shame.css +++ b/_vendor/github.com/gohugoio/gohugoioTheme/assets/css/_shame.css @@ -18,3 +18,8 @@ h6:first-of-type { h6 ~ p { margin: 0.5em 0 2em 0; } + +/* QR codes */ +img.qrcode { + width: initial; +} diff --git a/_vendor/github.com/gohugoio/gohugoioTheme/assets/output/css/app.css b/_vendor/github.com/gohugoio/gohugoioTheme/assets/output/css/app.css index b9518491c..b6343c7be 100644 --- a/_vendor/github.com/gohugoio/gohugoioTheme/assets/output/css/app.css +++ b/_vendor/github.com/gohugoio/gohugoioTheme/assets/output/css/app.css @@ -5333,6 +5333,11 @@ h6:first-of-type { h6 ~ p { margin: 0.5em 0 2em 0; } +/* QR codes */ +img.qrcode { + width: auto; + width: initial; +} .nested-blockquote blockquote { border-left: 4px solid #0594CB; padding-left: 1em; diff --git a/_vendor/modules.txt b/_vendor/modules.txt index 8b97db22a..a5092f11e 100644 --- a/_vendor/modules.txt +++ b/_vendor/modules.txt @@ -1 +1 @@ -# github.com/gohugoio/gohugoioTheme v0.0.0-20241223174847-fbbab8777a87 +# github.com/gohugoio/gohugoioTheme v0.0.0-20250106044328-feb60697e056 diff --git a/go.mod b/go.mod index fa7dd43cf..bb45d109d 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/gohugoio/hugoDocs go 1.22.0 -require github.com/gohugoio/gohugoioTheme v0.0.0-20241223174847-fbbab8777a87 // indirect +require github.com/gohugoio/gohugoioTheme v0.0.0-20250106044328-feb60697e056 // indirect diff --git a/go.sum b/go.sum index ea6cf6dc2..abc8fbaa0 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,2 @@ -github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253 h1:7DYEU25rQryCGyUISUpIye3oE0kz+9K9SiD6/O5rqvM= -github.com/gohugoio/gohugoioTheme v0.0.0-20241217121316-f5fea3aa8253/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= -github.com/gohugoio/gohugoioTheme v0.0.0-20241217195817-fc2ee93d77de h1:RsBXZgT+6UZ1yBFiFy+Kbkyw5Yn2S7uXottd/vWGxaw= -github.com/gohugoio/gohugoioTheme v0.0.0-20241217195817-fc2ee93d77de/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= -github.com/gohugoio/gohugoioTheme v0.0.0-20241223174847-fbbab8777a87 h1:EHSzYyQyjgTqz3n52+eMzwbqk/mAFIt/NIFMdvu7Z0k= -github.com/gohugoio/gohugoioTheme v0.0.0-20241223174847-fbbab8777a87/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= +github.com/gohugoio/gohugoioTheme v0.0.0-20250106044328-feb60697e056 h1:nPfHricsQXtVewK865bX2LDLhUImhIZEuajlYPM2Bho= +github.com/gohugoio/gohugoioTheme v0.0.0-20250106044328-feb60697e056/go.mod h1:GOYeAPQJ/ok8z7oz1cjfcSlsFpXrmx6VkzQ5RpnyhZM= From 15a8b1de61c12a8f6b50dd44a391e03abb149c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 6 Jan 2025 10:03:04 +0100 Subject: [PATCH 30/31] Update Batch.md --- content/en/functions/js/Batch.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/content/en/functions/js/Batch.md b/content/en/functions/js/Batch.md index 85538c29b..9960faa39 100644 --- a/content/en/functions/js/Batch.md +++ b/content/en/functions/js/Batch.md @@ -256,6 +256,12 @@ Eeach [`Resource`] will be of media type `application/javascript` or `text/css`. In a template you would typically handle one group with a given `ID` (e.g. scripts for the current section). Because of the concurrent build, this needs to be done in a [`templates.Defer`] block: +{{% note %}} +The [`templates.Defer`] acts as a synchronisation point to handle scripts added concurrently by different templates. If you have a setup with where the batch is created in one go (in one template), you don't need it. + +See [this discussion] for more. +{{% /note %}} + ```go-html-template {{ $group := .group }} {{ with (templates.Defer (dict "key" $group "data" $group )) }} @@ -320,4 +326,4 @@ console.log('entrypoints-workaround.js'); [script options]: #script-options [script]: #script [SetOptions]: #optionssetter -[with]: https://gohugo.io/functions/go-template/with/ \ No newline at end of file +[with]: https://gohugo.io/functions/go-template/with/ From f0f4bcb243776d0552396d12758bd38cda779b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 6 Jan 2025 10:13:58 +0100 Subject: [PATCH 31/31] Update Batch.md --- content/en/functions/js/Batch.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/content/en/functions/js/Batch.md b/content/en/functions/js/Batch.md index 9960faa39..4299654dc 100644 --- a/content/en/functions/js/Batch.md +++ b/content/en/functions/js/Batch.md @@ -259,7 +259,9 @@ Eeach [`Resource`] will be of media type `application/javascript` or `text/css`. {{% note %}} The [`templates.Defer`] acts as a synchronisation point to handle scripts added concurrently by different templates. If you have a setup with where the batch is created in one go (in one template), you don't need it. -See [this discussion] for more. +See [this discussion](https://discourse.gohugo.io/t/js-batch-with-simple-global-script/53002/5?u=bep) for more. + +[`templates.Defer`]: /functions/templates/defer/ {{% /note %}} ```go-html-template