From 9b6e7afd278e8405a85bbf2ba1c8f74f646d56ad Mon Sep 17 00:00:00 2001 From: Cathrine Paulsen Date: Tue, 5 Apr 2022 07:41:24 +0000 Subject: [PATCH 1/4] Add environment as a new filter to _cascade.target Fixes #9612 --- content/en/content-management/front-matter.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/en/content-management/front-matter.md b/content/en/content-management/front-matter.md index 6986f067f..cac4ef952 100644 --- a/content/en/content-management/front-matter.md +++ b/content/en/content-management/front-matter.md @@ -189,6 +189,9 @@ kind lang : A Glob pattern matching the Page's language, e.g. "{en,sv}". +environment +: A Glob pattern matching the build environment, e.g. "{production,development}" + Any of the above can be omitted. ### Example From 21f108f128b0fa991ac16b56770d3f5954da7528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Fri, 8 Apr 2022 13:31:50 +0200 Subject: [PATCH 2/4] docs: Regen CLI docs --- content/en/commands/hugo_server.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/en/commands/hugo_server.md b/content/en/commands/hugo_server.md index 33b95d51c..7d8067386 100644 --- a/content/en/commands/hugo_server.md +++ b/content/en/commands/hugo_server.md @@ -64,7 +64,8 @@ hugo server [flags] --printMemoryUsage print memory usage to screen at intervals --printPathWarnings print warnings on duplicate target paths etc. --printUnusedTemplates print warnings on unused templates. - --renderToDisk render to Destination path (default is render to memory & serve from there) + --renderStaticToDisk serve static files from disk and dynamic files from memory + --renderToDisk serve all files from disk (default is from memory) --templateMetrics display metrics about template executions --templateMetricsHints calculate some improvement hints when combined with --templateMetrics -t, --theme strings themes to use (located in /themes/THEMENAME/) From 9239c5f2aa0b3691e316b8d70a121dcb05347cb9 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Fri, 8 Apr 2022 11:38:37 -0700 Subject: [PATCH 3/4] deps: Update github.com/tdewolff/minify/v2 v2.10.0 => v2.11.0 Fixes #9713 Fixes #9740 Adds support for minify.tdewolff.svg.keepComments (bool) --- data/docs.json | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/data/docs.json b/data/docs.json index 2440fc930..ddd9e1246 100644 --- a/data/docs.json +++ b/data/docs.json @@ -1860,6 +1860,7 @@ "keepNumbers": false }, "svg": { + "keepComments": false, "precision": 0 }, "xml": { @@ -4665,6 +4666,12 @@ ], "Examples": [] }, + "ByType": { + "Description": "", + "Args": null, + "Aliases": null, + "Examples": null + }, "Concat": { "Description": "", "Args": null, @@ -4694,7 +4701,7 @@ "Examples": null }, "Get": { - "Description": "Get locates the filename given in Hugo's assets filesystem and\ncreates a Resource object that can be used for\nfurther transformations.", + "Description": "Get locates the filename given in Hugo's assets filesystem\nand creates a Resource object that can be used for further transformations.", "Args": [ "filename" ], @@ -4862,6 +4869,12 @@ "Aliases": null, "Examples": null }, + "Current": { + "Description": "", + "Args": null, + "Aliases": null, + "Examples": null + }, "Data": { "Description": "", "Args": null, From 73e82d911da8f13b6df33482ebfe45203684b41e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Mon, 11 Apr 2022 10:34:08 +0200 Subject: [PATCH 4/4] resources: Add `key` to reources.GetRemote options map If set, `key` will be used as the only cache key element for the resource. The default behaviour is to calculate the key based on the URL and all the options. This means that you can now do: ``` {{ $cacheKey := print $url (now.Format "2006-01-02") }} {{ $resource := resource.GetRemote $url (dict "key" $cacheKey) }} ``` Fixes #9755 --- content/en/hugo-pipes/introduction.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/content/en/hugo-pipes/introduction.md b/content/en/hugo-pipes/introduction.md index 83d64d1d3..bbafe55b2 100755 --- a/content/en/hugo-pipes/introduction.md +++ b/content/en/hugo-pipes/introduction.md @@ -53,6 +53,19 @@ With `resources.GetRemote`, the first argument is a remote URL: `resources.Get` and `resources.GetRemote` return `nil` if the resource is not found. +### Caching + +By default, Hugo calculates a cache key based on the `URL` and the `options` (e.g. headers) given. + + +{{< new-in "0.97.0" >}} You can override this by setting a `key` in the options map. This can be used to get more fine grained control over how often a remote resource is fetched, e.g.: + + +```go-html-template +{{ $cacheKey := print $url (now.Format "2006-01-02") }} +{{ $resource := resource.GetRemote $url (dict "key" $cacheKey) }} +``` + ### Error Handling {{< new-in "0.91.0" >}}