From 8cd6ac38741a557f73739090034c0c70027cd700 Mon Sep 17 00:00:00 2001 From: Joe Mooring Date: Sat, 12 Aug 2023 13:35:47 -0700 Subject: [PATCH] Miscellaneous edits --- content/en/functions/apply.md | 8 ++++---- content/en/functions/findRe.md | 2 +- content/en/functions/findresubmatch.md | 2 +- content/en/functions/highlight.md | 4 ++-- content/en/functions/index-function.md | 2 +- content/en/functions/partialCached.md | 6 +++--- content/en/functions/ref.md | 2 +- content/en/functions/relref.md | 2 +- content/en/functions/replace.md | 2 +- content/en/functions/replacere.md | 2 +- content/en/functions/substr.md | 2 +- content/en/functions/time.md | 2 +- content/en/showcase/letsencrypt/index.md | 2 +- content/en/templates/partials.md | 26 ++++-------------------- 14 files changed, 23 insertions(+), 41 deletions(-) diff --git a/content/en/functions/apply.md b/content/en/functions/apply.md index b9dbd81e7..c507a35bf 100644 --- a/content/en/functions/apply.md +++ b/content/en/functions/apply.md @@ -10,11 +10,11 @@ signature: ["apply COLLECTION FUNCTION [PARAM...]"] relatedfuncs: [] --- -`apply` expects at least three parameters, depending on the function being applied. +`apply` expects at least three arguments, depending on the function being applied. -1. The first parameter is the sequence to operate on. -2. The second parameter is the name of the function as a string, which must be the name of a valid [Hugo function][functions]. -3. After that, the parameters to the applied function are provided, with the string `"."` standing in for each element of the sequence the function is to be applied against. +1. The first argument is the sequence to operate on. +2. The second argument is the name of the function as a string, which must be the name of a valid [Hugo function][functions]. +3. After that, the arguments to the applied function are provided, with the string `"."` standing in for each element of the sequence the function is to be applied against. Here is an example of a content file with `names:` as a front matter field: diff --git a/content/en/functions/findRe.md b/content/en/functions/findRe.md index 3c977118c..104db0f27 100644 --- a/content/en/functions/findRe.md +++ b/content/en/functions/findRe.md @@ -11,7 +11,7 @@ signature: - "strings.FindRE PATTERN INPUT [LIMIT]" relatedfuncs: [findRESubmatch, replaceRE] --- -By default, `findRE` finds all matches. You can limit the number of matches with an optional LIMIT parameter. +By default, `findRE` finds all matches. You can limit the number of matches with an optional LIMIT argument. {{% readfile file="/functions/common/regular-expressions.md" %}} diff --git a/content/en/functions/findresubmatch.md b/content/en/functions/findresubmatch.md index 1f0f26b49..f51ccdb97 100644 --- a/content/en/functions/findresubmatch.md +++ b/content/en/functions/findresubmatch.md @@ -12,7 +12,7 @@ signature: relatedfuncs: [findRE, replaceRE] --- -By default, `findRESubmatch` finds all matches. You can limit the number of matches with an optional LIMIT parameter. A return value of nil indicates no match. +By default, `findRESubmatch` finds all matches. You can limit the number of matches with an optional LIMIT argument. A return value of nil indicates no match. {{% readfile file="/functions/common/regular-expressions.md" %}} diff --git a/content/en/functions/highlight.md b/content/en/functions/highlight.md index 1a47fe37f..f91c1f562 100644 --- a/content/en/functions/highlight.md +++ b/content/en/functions/highlight.md @@ -12,7 +12,7 @@ toc: true --- The `highlight` function uses the [Chroma] syntax highlighter, supporting over 200 languages with more than 40 available styles. -## Parameters +## Arguments INPUT : The code to highlight. @@ -67,7 +67,7 @@ Substitute this number of spaces for each tab character in your highlighted code guessSyntax : Boolean. Default is `false`.\ -If the `LANG` parameter is blank or an unrecognized language, auto-detect the language if possible, otherwise use a fallback language. +If the `LANG` argument is blank or an unrecognized language, auto-detect the language if possible, otherwise use a fallback language. {{% note %}} Instead of specifying both `lineNos` and `lineNumbersInTable`, you can use the following shorthand notation: diff --git a/content/en/functions/index-function.md b/content/en/functions/index-function.md index e5ba47262..b2193c9c5 100644 --- a/content/en/functions/index-function.md +++ b/content/en/functions/index-function.md @@ -68,7 +68,7 @@ location = "oslo" The content of `oslo.toml` can be accessed from your template using the following node path: `.Site.Data.locations.oslo`. However, the specific file you need is going to change according to the front matter. -This is where the `index` function is needed. `index` takes 2 parameters in this use case: +This is where the `index` function is needed. `index` takes 2 arguments in this use case: 1. The node path 2. A string corresponding to the desired data; e.g.— diff --git a/content/en/functions/partialCached.md b/content/en/functions/partialCached.md index d443864f2..7eed566f6 100644 --- a/content/en/functions/partialCached.md +++ b/content/en/functions/partialCached.md @@ -22,18 +22,18 @@ Here is the simplest usage: {{ partialCached "footer.html" . }} ``` -You can also pass additional parameters to `partialCached` to create *variants* of the cached partial. For example, if you have a complex partial that should be identical when rendered for pages within the same section, you could use a variant based upon section so that the partial is only rendered once per section: +You can also pass additional arguments to `partialCached` to create *variants* of the cached partial. For example, if you have a complex partial that should be identical when rendered for pages within the same section, you could use a variant based upon section so that the partial is only rendered once per section: {{< code file="partial-cached-example.html" >}} {{ partialCached "footer.html" . .Section }} {{< /code >}} -If you need to pass additional parameters to create unique variants, you can pass as many variant parameters as you need: +If you need to pass additional arguments to create unique variants, you can pass as many variant arguments as you need: ```go-html-template {{ partialCached "footer.html" . .Params.country .Params.province }} ``` -Note that the variant parameters are not made available to the underlying partial template. They are only use to create a unique cache key. Since Hugo `0.61.0` you can use any object as cache key(s), not just strings. +Note that the variant arguments are not made available to the underlying partial template. They are only use to create a unique cache key. Since Hugo `0.61.0` you can use any object as cache key(s), not just strings. See also [The Full Partial Series Part 1: Caching!](https://regisphilibert.com/blog/2019/12/hugo-partial-series-part-1-caching-with-partialcached/). diff --git a/content/en/functions/ref.md b/content/en/functions/ref.md index 32bf79ca1..2d05ca427 100644 --- a/content/en/functions/ref.md +++ b/content/en/functions/ref.md @@ -10,7 +10,7 @@ signature: ["ref . PAGE"] relatedfuncs: [relref] --- -This function takes two parameters: +This function takes two arguments: - The context of the page from which to resolve relative paths, typically the current page (`.`) - The path to a page, with or without a file extension, with or without an anchor. A path without a leading `/` is first resolved relative to the given context, then to the remainder of the site. diff --git a/content/en/functions/relref.md b/content/en/functions/relref.md index f60d5559b..98ad724f7 100644 --- a/content/en/functions/relref.md +++ b/content/en/functions/relref.md @@ -10,7 +10,7 @@ signature: ["relref . PAGE"] relatedfuncs: [ref] --- -This function takes two parameters: +This function takes two arguments: - The context of the page from which to resolve relative paths, typically the current page (`.`) - The path to a page, with or without a file extension, with or without an anchor. A path without a leading `/` is first resolved relative to the given context, then to the remainder of the site. diff --git a/content/en/functions/replace.md b/content/en/functions/replace.md index fea92ab68..4c150bfef 100644 --- a/content/en/functions/replace.md +++ b/content/en/functions/replace.md @@ -13,7 +13,7 @@ relatedfuncs: [replaceRE] --- Replace returns a copy of `INPUT` with all occurrences of `OLD` replaced with `NEW`. -The number of replacements can be limited with an optional `LIMIT` parameter. +The number of replacements can be limited with an optional `LIMIT` argument. ``` `{{ replace "Batman and Robin" "Robin" "Catwoman" }}` diff --git a/content/en/functions/replacere.md b/content/en/functions/replacere.md index 8c3cc13c2..4dba19bfe 100644 --- a/content/en/functions/replacere.md +++ b/content/en/functions/replacere.md @@ -11,7 +11,7 @@ signature: - "strings.ReplaceRE PATTERN REPLACEMENT INPUT [LIMIT]" relatedfuncs: [findRE, FindRESubmatch, replace] --- -By default, `replaceRE` replaces all matches. You can limit the number of matches with an optional LIMIT parameter. +By default, `replaceRE` replaces all matches. You can limit the number of matches with an optional LIMIT argument. {{% readfile file="/functions/common/regular-expressions.md" %}} diff --git a/content/en/functions/substr.md b/content/en/functions/substr.md index 6a5f15592..90ee47b55 100644 --- a/content/en/functions/substr.md +++ b/content/en/functions/substr.md @@ -12,7 +12,7 @@ signature: relatedfuncs: [] --- -It normally takes two parameters: `start` and `length`. It can also take one parameter: `start`, i.e. `length` is omitted, in which case the substring starting from start until the end of the string will be returned. +It normally takes two argument: `start` and `length`. It can also take one argument: `start`, i.e. `length` is omitted, in which case the substring starting from start until the end of the string will be returned. To extract characters from the end of the string, use a negative start number. diff --git a/content/en/functions/time.md b/content/en/functions/time.md index 1fb6cc350..99182f317 100644 --- a/content/en/functions/time.md +++ b/content/en/functions/time.md @@ -21,7 +21,7 @@ relatedfuncs: [] ## Using locations -The optional `TIMEZONE` parameter is a string that sets a default time zone (or more specific, the location, which represents the collection of time offsets in a geographical area) that is associated with the specified time value. If the time value has an explicit timezone or offset specified, it will take precedence over the `TIMEZONE` parameter. +The optional `TIMEZONE` argument is a string that sets a default time zone (or more specific, the location, which represents the collection of time offsets in a geographical area) that is associated with the specified time value. If the time value has an explicit timezone or offset specified, it will take precedence over the `TIMEZONE` argument. The list of valid locations may be system dependent, but should include `UTC`, `Local`, or any location in the [IANA Time Zone database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). diff --git a/content/en/showcase/letsencrypt/index.md b/content/en/showcase/letsencrypt/index.md index d59908df0..18221ed68 100644 --- a/content/en/showcase/letsencrypt/index.md +++ b/content/en/showcase/letsencrypt/index.md @@ -13,7 +13,7 @@ The **Let’s Encrypt website** has a common set of elements: A landing page and I helped them port the site from Jekyll to Hugo. There are usually very few surprises doing this. I know Hugo very well, but working on sites with a history usually comes up with something new. -That site is bookmarked in many browsers, so preserving the URLs was a must. Hugo's URL handling is very flexible, but there was one challenge. The website has a mix of standard and what we in Hugo call _ugly URLs_ (`https://letsencrypt.org/2017/12/07/looking-forward-to-2018.html`). In Hugo this is handled automatically, and you can turn it on globally or per language. But before Hugo `0.33` you could not configure it for parts of your site. You could set it manually for the relevant pages in front matter -- which is how it was done in Jekyll -- but that would be hard to manage, especially when you start to introduce translations. So, in [Hugo 0.33](/news/0.33-relnotes) I added support for _ugly URLs_ per section and also `url` set in front matter for list pages (`https://letsencrypt.org/blog/`). +That site is bookmarked in many browsers, so preserving the URLs was a must. Hugo's URL handling is very flexible, but there was one challenge. The website has a mix of standard and what we in Hugo call _ugly URLs_ (`https://letsencrypt.org/2017/12/07/looking-forward-to-2018.html`). In Hugo this is handled automatically, and you can turn it on globally or per language. But before Hugo `0.33` you could not configure it for parts of your site. You could set it manually for the relevant pages in front matter -- which is how it was done in Jekyll -- but that would be hard to manage, especially when you start to introduce translations. So, in Hugo 0.33 I added support for _ugly URLs_ per section and also `url` set in front matter for list pages (`https://letsencrypt.org/blog/`). The lessons learned from this also lead to [disableLanguages](/content-management/multilingual/#disable-a-language) in Hugo `0.34` (a way to turn off languages during translation). And I also registered [this issue](https://github.com/gohugoio/hugo/issues/4463). Once fixed it will make it easier to handle partially translated sites. diff --git a/content/en/templates/partials.md b/content/en/templates/partials.md index 16c117f2f..a082be9a6 100644 --- a/content/en/templates/partials.md +++ b/content/en/templates/partials.md @@ -128,29 +128,11 @@ Value: {{ partial "my-inline-partial.html" . }} ## Cached partials -The [`partialCached` template function][partialcached] can offer significant performance gains for complex templates that don't need to be re-rendered on every invocation. The simplest usage is as follows: +The `partialCached` template function provides significant performance gains for complex templates that don't need to be re-rendered on every invocation. See [details][partialcached]. -```go-html-template -{{ partialCached "footer.html" . }} -``` +## Examples -You can also pass additional parameters to `partialCached` to create *variants* of the cached partial. - -For example, you can tell Hugo to only render the partial `footer.html` once per section: - -```go-html-template -{{ partialCached "footer.html" . .Section }} -``` - -If you need to pass additional parameters to create unique variants, you can pass as many variant parameters as you need: - -```go-html-template -{{ partialCached "footer.html" . .Params.country .Params.province }} -``` - -Note that the variant parameters are not made available to the underlying partial template. They are only use to create a unique cache key. - -### Example `header.html` +### `header.html` The following `header.html` partial template is used for [spf13.com](https://spf13.com/): @@ -175,7 +157,7 @@ The following `header.html` partial template is used for [spf13.com](https://spf The `header.html` example partial was built before the introduction of block templates to Hugo. Read more on [base templates and blocks](/templates/base/) for defining the outer chrome or shell of your master templates (i.e., your site's head, header, and footer). You can even combine blocks and partials for added flexibility. {{% /note %}} -### Example `footer.html` +### `footer.html` The following `footer.html` partial template is used for [spf13.com](https://spf13.com/):