diff --git a/content/en/content-management/multilingual.md b/content/en/content-management/multilingual.md index 91099511e..63312a054 100644 --- a/content/en/content-management/multilingual.md +++ b/content/en/content-management/multilingual.md @@ -344,7 +344,7 @@ The function will read `.Count` from `.ReadingTime` and evaluate whether the num {{< code-toggle file="i18n/en-US" >}} [readingTime] one = "One minute to read" -other = "{{.Count}} minutes to read" +other = "{{.Count }} minutes to read" {{< /code-toggle >}} Assuming `.ReadingTime.Count` in the context has value is 525600. The result will be: diff --git a/content/en/content-management/toc.md b/content/en/content-management/toc.md index d136972cc..9e1421dc7 100644 --- a/content/en/content-management/toc.md +++ b/content/en/content-management/toc.md @@ -15,7 +15,7 @@ aliases: [/extras/toc/] {{% note "TOC Heading Levels are Fixed" %}} -Previously, there was no out-of-the-box way to specify which heading levels you want the TOC to render. [See the related GitHub discussion (#1778)](https://github.com/gohugoio/hugo/issues/1778). As such, the resulting `` was going to start at `

` when pulling from `{{.Content}}`. +Previously, there was no out-of-the-box way to specify which heading levels you want the TOC to render. [See the related GitHub discussion (#1778)](https://github.com/gohugoio/hugo/issues/1778). As such, the resulting `` was going to start at `

` when pulling from `{{.Content }}`. Hugo [v0.60.0](https://github.com/gohugoio/hugo/releases/tag/v0.60.0) made a switch to [Goldmark](https://github.com/yuin/goldmark/) as the default library for Markdown which has improved and configurable implementation of TOC. Take a look at [how to configure TOC](/getting-started/configuration-markup/#table-of-contents) for Goldmark renderer. @@ -73,15 +73,15 @@ The following is a [partial template][partials] that adds slightly more logic fo {{ if and (gt .WordCount 400 ) (.Params.toc) }} {{ end }} {{< /code >}} {{% note %}} -With the preceding example, even pages with > 400 words *and* `toc` not set to `false` will not render a table of contents if there are no headings in the page for the `{{.TableOfContents}}` variable to pull from. +With the preceding example, even pages with > 400 words *and* `toc` not set to `false` will not render a table of contents if there are no headings in the page for the `{{.TableOfContents }}` variable to pull from. {{% /note %}} ## Usage with AsciiDoc diff --git a/content/en/contribute/documentation.md b/content/en/contribute/documentation.md index 641f86c81..c55a74b41 100644 --- a/content/en/contribute/documentation.md +++ b/content/en/contribute/documentation.md @@ -81,7 +81,7 @@ Here is a review of the front matter fields automatically generated for you usin `relatedfuncs` : other [templating functions] you feel are related to your new function to help fellow Hugo users. -`{{.Content}}` +`{{.Content }}` : an extended description of the new function; examples are not only welcomed but encouraged. In the body of your function, expand the short description used in the front matter. Include as many examples as possible, and leverage the Hugo docs [`code` shortcode](#add-code-blocks). If you are unable to add examples but would like to solicit help from the Hugo community, add `needsexample: true` to your front matter. @@ -145,15 +145,15 @@ This example HTML code block tells Hugo users the following:
-

{{.Title}}

- {{with .Params.subtitle}} +

{{.Title }}

+ {{ with .Params.subtitle }} {{.}}
- {{.Content}} + {{.Content }}
@@ -170,15 +170,15 @@ The output of this example will render to the Hugo docs as follows:
-

{{.Title}}

- {{with .Params.subtitle}} +

{{.Title }}

+ {{ with .Params.subtitle }} {{.}}
- {{.Content}} + {{.Content }}
diff --git a/content/en/functions/RenderString.md b/content/en/functions/RenderString.md index e4440971f..25fdcf60e 100644 --- a/content/en/functions/RenderString.md +++ b/content/en/functions/RenderString.md @@ -26,8 +26,8 @@ Some examples: {{ $optBlock := dict "display" "block" }} {{ $optOrg := dict "markup" "org" }} {{ "**Bold Markdown**" | $p.RenderString }} -{{ "**Bold Block Markdown**" | $p.RenderString $optBlock }} -{{ "/italic org mode/" | $p.RenderString $optOrg }} +{{ "**Bold Block Markdown**" | $p.RenderString $optBlock }} +{{ "/italic org mode/" | $p.RenderString $optOrg }} ``` {{< new-in "0.93.0" >}} **Note**: [markdownify](/functions/markdownify/) uses this function in order to support [Render Hooks](/getting-started/configuration-markup/#markdown-render-hooks). diff --git a/content/en/functions/after.md b/content/en/functions/after.md index 1d513e775..df2142ab6 100644 --- a/content/en/functions/after.md +++ b/content/en/functions/after.md @@ -40,9 +40,9 @@ You can use `after` in combination with the [`first` function] and Hugo's [power

Featured Article

{{ range first 1 .Pages.ByPublishDate.Reverse }}
-

{{.Title}}

+

{{.Title }}

-

{{.Description}}

+

{{.Description }}

{{ end }}
@@ -50,9 +50,9 @@ You can use `after` in combination with the [`first` function] and Hugo's [power {{ range first 3 (after 1 .Pages.ByPublishDate.Reverse) }}
-

{{.Title}}

+

{{.Title }}

-

{{.Description}}

+

{{.Description }}

{{ end }}
diff --git a/content/en/functions/base64.md b/content/en/functions/base64.md index 54ca0440c..fb9ec9997 100644 --- a/content/en/functions/base64.md +++ b/content/en/functions/base64.md @@ -43,7 +43,7 @@ Using base64 to decode and encode becomes really powerful if we have to handle responses from APIs. ``` -{{ $resp := getJSON "https://api.github.com/repos/gohugoio/hugo/readme" }} +{{ $resp := getJSON "https://api.github.com/repos/gohugoio/hugo/readme" }} {{ $resp.content | base64Decode | markdownify }} ``` diff --git a/content/en/functions/chomp.md b/content/en/functions/chomp.md index 3e61c8db5..9bdb1be8a 100644 --- a/content/en/functions/chomp.md +++ b/content/en/functions/chomp.md @@ -22,5 +22,5 @@ deprecated: false Useful in a pipeline to remove newlines added by other processing (e.g., [`markdownify`](/functions/markdownify/)). ``` -{{chomp "

Blockhead

\n"}} → "

Blockhead

" +{{ chomp "

Blockhead

\n"}} → "

Blockhead

" ``` diff --git a/content/en/functions/complement.md b/content/en/functions/complement.md index 91640d803..87bb3af62 100644 --- a/content/en/functions/complement.md +++ b/content/en/functions/complement.md @@ -17,7 +17,7 @@ To find the elements within `$c3` that do not exist in `$c1` or `$c2`: ```go-html-template {{ $c1 := slice 3 }} -{{ $c2 := slice 4 5 }} +{{ $c2 := slice 4 5 }} {{ $c3 := slice 1 2 3 4 5 }} {{ complement $c1 $c2 $c3 }} → [1 2] diff --git a/content/en/functions/default.md b/content/en/functions/default.md index f3493fb26..defdad480 100644 --- a/content/en/functions/default.md +++ b/content/en/functions/default.md @@ -52,7 +52,7 @@ Both of the above `default` function calls return `Roboto`. A `default` value, however, does not need to be hard coded like the previous example. The `default` value can be a variable or pulled directly from the front matter using dot notation: {{< code file="variable-as-default-value.html" copy="false" >}} -{{$old := .Params.oldparam }} +{{ $old := .Params.oldparam }}

{{ .Params.newparam | default $old }}

{{< /code >}} @@ -79,13 +79,13 @@ The following have equivalent return values but are far less terse. This demonst Using `if`: {{< code file="if-instead-of-default.html" copy="false" >}} -{{if .Params.seo_title}}{{.Params.seo_title}}{{else}}{{.Title}}{{end}} +{{ if .Params.seo_title }}{{.Params.seo_title }}{{ else }}{{.Title }}{{ end }} => Sane Defaults {{< /code >}} Using `with`: {{< code file="with-instead-of-default.html" copy="false" >}} -{{with .Params.seo_title}}{{.}}{{else}}{{.Title}}{{end}} +{{ with .Params.seo_title }}{{.}}{{ else }}{{.Title }}{{ end }} => Sane Defaults {{< /code >}} diff --git a/content/en/functions/delimit.md b/content/en/functions/delimit.md index 10045b780..4705a7f2d 100644 --- a/content/en/functions/delimit.md +++ b/content/en/functions/delimit.md @@ -22,7 +22,7 @@ aliases: [] `delimit` called in your template takes the form of ``` -{{ delimit array/slice/map delimiter optionallastdelimiter}} +{{ delimit array/slice/map delimiter optionallastdelimiter }} ``` `delimit` loops through any array, slice, or map and returns a string of all the values separated by a delimiter, the second argument in the function call. There is an optional third parameter that lets you choose a different delimiter to go between the last two values in the loop. diff --git a/content/en/functions/hugo.md b/content/en/functions/hugo.md index 41c7a0322..91f517be2 100644 --- a/content/en/functions/hugo.md +++ b/content/en/functions/hugo.md @@ -100,7 +100,7 @@ An example table listing the dependencies: {{ with $element.Owner }}{{.Path }}{{ end }} {{ $element.Path }} - {{ with $element.Replace}} + {{ with $element.Replace }} => {{ .Path }} {{ end }} diff --git a/content/en/functions/humanize.md b/content/en/functions/humanize.md index 18a087591..444761c88 100644 --- a/content/en/functions/humanize.md +++ b/content/en/functions/humanize.md @@ -22,8 +22,8 @@ If the input is either an int64 value or the string representation of an integer ``` -{{humanize "my-first-post"}} → "My first post" -{{humanize "myCamelPost"}} → "My camel post" -{{humanize "52"}} → "52nd" -{{humanize 103}} → "103rd" +{{ humanize "my-first-post"}} → "My first post" +{{ humanize "myCamelPost"}} → "My camel post" +{{ humanize "52"}} → "52nd" +{{ humanize 103 }} → "103rd" ``` diff --git a/content/en/functions/images/index.md b/content/en/functions/images/index.md index e7fc50f7e..7bc424048 100644 --- a/content/en/functions/images/index.md +++ b/content/en/functions/images/index.md @@ -222,6 +222,6 @@ images.ImageConfig PATH ```go-html-template {{ with (imageConfig "favicon.ico") }} -favicon.ico: {{.Width}} x {{.Height}} +favicon.ico: {{.Width }} x {{.Height }} {{ end }} ``` diff --git a/content/en/functions/isset.md b/content/en/functions/isset.md index aa36f6dac..2bfc43203 100644 --- a/content/en/functions/isset.md +++ b/content/en/functions/isset.md @@ -25,6 +25,6 @@ Takes either a slice, array, or channel and an index or a map and a key as input ``` {{% warning %}} -All site-level configuration keys are stored as lower case. Therefore, a `myParam` key-value set in your [site configuration file](/getting-started/configuration/) needs to be accessed with `{{if isset .Site.Params "myparam"}}` and *not* with `{{if isset .Site.Params "myParam"}}`. Note that you can still access the same config key with `.Site.Params.myParam` *or* `.Site.Params.myparam`, for example, when using [`with`](/functions/with). +All site-level configuration keys are stored as lower case. Therefore, a `myParam` key-value set in your [site configuration file](/getting-started/configuration/) needs to be accessed with `{{ if isset .Site.Params "myparam"}}` and *not* with `{{ if isset .Site.Params "myParam"}}`. Note that you can still access the same config key with `.Site.Params.myParam` *or* `.Site.Params.myparam`, for example, when using [`with`](/functions/with). This restriction also applies when accessing page-level front matter keys from within [shortcodes](/content-management/shortcodes/). {{% /warning %}} diff --git a/content/en/functions/len.md b/content/en/functions/len.md index 9f15d79c7..1d7f9caf4 100644 --- a/content/en/functions/len.md +++ b/content/en/functions/len.md @@ -39,7 +39,7 @@ You may want to append a class to a heading according to the length of the strin {{< code file="check-title-length.html" >}}
- {{.Title}} + {{.Title }}
{{< /code >}} diff --git a/content/en/functions/slicestr.md b/content/en/functions/slicestr.md index 8164f2720..d6e4b3439 100644 --- a/content/en/functions/slicestr.md +++ b/content/en/functions/slicestr.md @@ -23,5 +23,5 @@ aliases: [] For example, 1 and 4 creates a slice including elements 1 through 3. The `end` index can be omitted; it defaults to the string's length. -* `{{slicestr "BatMan" 3}}` → "Man" -* `{{slicestr "BatMan" 0 3}}` → "Bat" +* `{{ slicestr "BatMan" 3 }}` → "Man" +* `{{ slicestr "BatMan" 0 3 }}` → "Bat" diff --git a/content/en/functions/string.md b/content/en/functions/string.md index 33a781e45..4905765aa 100644 --- a/content/en/functions/string.md +++ b/content/en/functions/string.md @@ -18,4 +18,4 @@ deprecated: false aliases: [] --- -* `{{string "BatMan"}}` → "BatMan" +* `{{ string "BatMan"}}` → "BatMan" diff --git a/content/en/functions/time.md b/content/en/functions/time.md index 175e2dbfe..b995f78f2 100644 --- a/content/en/functions/time.md +++ b/content/en/functions/time.md @@ -48,11 +48,11 @@ The following example takes a UNIX timestamp---set as `utimestamp: "1489276800"` The following example may be useful when setting up [multilingual sites][multilingual]: {{< code file="unix-to-month-integer.html" >}} -{{$time := time (int .Params.addDate)}} +{{ $time := time (int .Params.addDate)}} => $time = 1489276800 -{{$time.Month}} +{{ $time.Month }} => "March" -{{$monthindex := printf "%d" $time.Month }} +{{ $monthindex := printf "%d" $time.Month }} => $monthindex = 3 {{< /code >}} diff --git a/content/en/functions/title.md b/content/en/functions/title.md index 6c87d69ac..28444f400 100644 --- a/content/en/functions/title.md +++ b/content/en/functions/title.md @@ -22,7 +22,7 @@ aliases: [] ``` -{{title "BatMan"}}` → "Batman" +{{ title "BatMan"}}` → "Batman" ``` Can be combined in pipes. In the following snippet, the link text is cleaned up using `humanize` to remove dashes and `title` to convert the value of `$name` to Initial Caps. diff --git a/content/en/functions/trim.md b/content/en/functions/trim.md index fec435ec7..2cda7a59a 100644 --- a/content/en/functions/trim.md +++ b/content/en/functions/trim.md @@ -26,7 +26,7 @@ deprecated: false `trim` *requires* the second argument, which tells the function specifically what to remove from the first argument. There is no default value for the second argument, so **the following usage will not work**: ``` -{{ trim .Inner}} +{{ trim .Inner }} ``` Instead, the following example tells `trim` to remove extra new lines from the content contained in the [shortcode `.Inner` variable][shortcodevars]: diff --git a/content/en/functions/urlize.md b/content/en/functions/urlize.md index df939eba1..1ba20506b 100644 --- a/content/en/functions/urlize.md +++ b/content/en/functions/urlize.md @@ -31,18 +31,18 @@ The following might be used as a partial within a [single page template][singlet {{< code file="layouts/partials/content-header.html" download="content-header.html" >}}
-

{{.Title}}

+

{{.Title }}

{{ with .Params.location }} -
{{.}}
+
{{.}}
{{ end }} {{ with .Params.tags }} {{ end }}
diff --git a/content/en/functions/urls.Parse.md b/content/en/functions/urls.Parse.md index 9ed4f55d3..6714c8e00 100644 --- a/content/en/functions/urls.Parse.md +++ b/content/en/functions/urls.Parse.md @@ -17,7 +17,7 @@ The `urls.Parse` function parses a URL into a [URL structure](https://godoc.org/ ```go-html-template {{ $url := "https://example.org:123/foo?a=6&b=7#bar" }} -{{ $u := urls.Parse $url}} +{{ $u := urls.Parse $url }} {{ $u.IsAbs }} → true {{ $u.Scheme }} → https diff --git a/content/en/functions/where.md b/content/en/functions/where.md index a06ee020f..07bf913f5 100644 --- a/content/en/functions/where.md +++ b/content/en/functions/where.md @@ -85,9 +85,9 @@ The following logical operators are available with `where`: ## Use `where` with `Booleans` When using booleans you should not put quotation marks. ```go-html-template -{{range where .Pages "Draft" true}} -

{{.Title}}

-{{end}} +{{ range where .Pages "Draft" true }} +

{{.Title }}

+{{ end }} ``` diff --git a/content/en/functions/with.md b/content/en/functions/with.md index ae643caf7..bfd58bcf2 100644 --- a/content/en/functions/with.md +++ b/content/en/functions/with.md @@ -26,9 +26,9 @@ If you want to render a block if an index or key is present in a slice, array, c The following example checks for a [user-defined site variable](/variables/site/) called `twitteruser`. If the key-value is not set, the following will render nothing: {{< code file="layouts/partials/twitter.html" >}} -{{with .Site.Params.twitteruser}} +{{ with .Site.Params.twitteruser }} -{{end}} +{{ end }} {{< /code >}} diff --git a/content/en/hugo-pipes/introduction.md b/content/en/hugo-pipes/introduction.md index 5abf623a0..879565358 100755 --- a/content/en/hugo-pipes/introduction.md +++ b/content/en/hugo-pipes/introduction.md @@ -108,13 +108,13 @@ Note that if you do not handle `.Err` yourself, Hugo will fail the build the fir When fetching a remote `Resource`, `resources.GetRemote` takes an optional options map as the second argument, e.g.: ```go-html-template -{{ $resource := resources.GetRemote "https://example.org/api" (dict "headers" (dict "Authorization" "Bearer abcd")) }} +{{ $resource := resources.GetRemote "https://example.org/api" (dict "headers" (dict "Authorization" "Bearer abcd")) }} ``` If you need multiple values for the same header key, use a slice: ```go-html-template -{{ $resource := resources.GetRemote "https://example.org/api" (dict "headers" (dict "X-List" (slice "a" "b" "c"))) }} +{{ $resource := resources.GetRemote "https://example.org/api" (dict "headers" (dict "X-List" (slice "a" "b" "c"))) }} ``` You can also change the request method and set the request body: diff --git a/content/en/news/0.59.0-relnotes/index.md b/content/en/news/0.59.0-relnotes/index.md index 1a7552d09..d122e4c44 100644 --- a/content/en/news/0.59.0-relnotes/index.md +++ b/content/en/news/0.59.0-relnotes/index.md @@ -19,13 +19,13 @@ See [Image Processing Options](https://gohugo.io/content-management/image-proces Another useful addon is the `$pages.Next` and `$pages.Prev` methods on the core page collections in Hugo. These works the same way as the built-in static variants one `Page`, e.g. `.Next` and `.NextInSection`: ``` -{{with .Site.RegularPages.Next . }}{{.RelPermalink}}{{end}} +{{ with .Site.RegularPages.Next . }}{{.RelPermalink }}{{ end }} ``` The above is a functionally equivalent (but slightly slower) variant of: ``` -{{with .Next }}{{.RelPermalink}}{{end}} +{{ with .Next }}{{.RelPermalink }}{{ end }} ``` See [Pages Methods](https://gohugo.io/variables/pages/) for more information. @@ -113,8 +113,3 @@ Hugo now has: * Fix cache key transformed resources [6dec671f](https://github.com/gohugoio/hugo/commit/6dec671fb930029e18ba9aa5135b3a27adcddb21) [@bep](https://github.com/bep) [#6348](https://github.com/gohugoio/hugo/issues/6348) * Fix cache keys for bundled resoures in transform.Unmarshal [c0d75736](https://github.com/gohugoio/hugo/commit/c0d7573677e9726c14749ccd432dccb75e0d194d) [@bep](https://github.com/bep) [#6327](https://github.com/gohugoio/hugo/issues/6327) * Fix concat with fingerprint regression [3be2c253](https://github.com/gohugoio/hugo/commit/3be2c25351b421a26ee1ff2a38cbab00280c0583) [@bep](https://github.com/bep) [#6309](https://github.com/gohugoio/hugo/issues/6309) - - - - - diff --git a/content/en/templates/base.md b/content/en/templates/base.md index c82cc09a1..6488b6b48 100644 --- a/content/en/templates/base.md +++ b/content/en/templates/base.md @@ -87,7 +87,7 @@ The following shows how you can override both the `"main"` and `"title"` block a {{< code file="layouts/_default/single.html" download="single.html" >}} {{ define "title" }} - + {{ .Title }} – {{ .Site.Title }} {{ end }} {{ define "main" }} diff --git a/content/en/templates/data-templates.md b/content/en/templates/data-templates.md index 30f708644..8051e554d 100644 --- a/content/en/templates/data-templates.md +++ b/content/en/templates/data-templates.md @@ -131,7 +131,7 @@ Achievements: You can use the following code to render the `Short Description` in your layout: ```go-html-template -
Short Description of {{.Site.Data.User0123.Name}}:

{{ index .Site.Data.User0123 "Short Description" | markdownify }}

+
Short Description of {{.Site.Data.User0123.Name }}:

{{ index .Site.Data.User0123 "Short Description" | markdownify }}

``` Note the use of the [`markdownify` template function][markdownify]. This will send the description through the Markdown rendering engine. @@ -173,13 +173,13 @@ This will resolve internally to the following: Both `getJSON` and `getCSV` takes an optional map as the last argument, e.g.: ```go-html-template -{{ $data := getJSON "https://example.org/api" (dict "Authorization" "Bearer abcd") }} +{{ $data := getJSON "https://example.org/api" (dict "Authorization" "Bearer abcd") }} ``` If you need multiple values for the same header key, use a slice: ```go-html-template -{{ $data := getJSON "https://example.org/api" (dict "X-List" (slice "a" "b" "c")) }} +{{ $data := getJSON "https://example.org/api" (dict "X-List" (slice "a" "b" "c")) }} ``` ### Example for CSV files @@ -209,7 +209,7 @@ For `getCSV`, the one-character-long separator must be placed in the first posit {{< /code >}} -The expression `{{index $r number}}` must be used to output the nth-column from the current row. +The expression `{{ index $r number }}` must be used to output the nth-column from the current row. ### Cache URLs diff --git a/content/en/templates/homepage.md b/content/en/templates/homepage.md index ace3f259b..b72889301 100644 --- a/content/en/templates/homepage.md +++ b/content/en/templates/homepage.md @@ -38,20 +38,20 @@ See the homepage template below or [Content Organization][contentorg] for more i ## Example Homepage Template -The following is an example of a homepage template that uses [partial][partials], [base] templates, and a content file at `content/_index.md` to populate the `{{.Title}}` and `{{.Content}}` [page variables][pagevars]. +The following is an example of a homepage template that uses [partial][partials], [base] templates, and a content file at `content/_index.md` to populate the `{{.Title }}` and `{{.Content }}` [page variables][pagevars]. {{< code file="layouts/index.html" download="index.html" >}} {{ define "main" }}
-

{{.Title}}

+

{{.Title }}

{{ with .Params.subtitle }} {{.}} {{ end }}
- {{.Content}} + {{.Content }}
{{ range first 10 .Site.RegularPages }} diff --git a/content/en/templates/introduction.md b/content/en/templates/introduction.md index 87c479f6d..2f907e033 100644 --- a/content/en/templates/introduction.md +++ b/content/en/templates/introduction.md @@ -241,7 +241,7 @@ If the _map_, _array_, or _slice_ passed into the range is zero-length then the ```go-html-template {{ range $array }} {{ . }} -{{else}} +{{ else }} {{ end }} ``` @@ -414,7 +414,7 @@ The following shows how to define a variable independent of the context. {{< /code >}} {{% note %}} -Notice how once we have entered the loop (i.e. `range`), the value of `{{ . }}` has changed. We have defined a variable outside the loop (`{{$title}}`) that we've assigned a value so that we have access to the value from within the loop as well. +Notice how once we have entered the loop (i.e. `range`), the value of `{{ . }}` has changed. We have defined a variable outside the loop (`{{ $title }}`) that we've assigned a value so that we have access to the value from within the loop as well. {{% /note %}} ### 2. Use `$.` to Access the Global Context @@ -553,11 +553,11 @@ Here is an example of corresponding code that could be used inside a `toc.html` {{ if not .Params.notoc }} {{ end }} @@ -583,7 +583,7 @@ Within a footer layout, you might then declare a `
` that is only rendere ```go-html-template {{ if .Site.Params.copyrighthtml }}
-
{{.Site.Params.CopyrightHTML | safeHTML}}
+
{{.Site.Params.CopyrightHTML | safeHTML }}
{{ end }} ``` @@ -606,7 +606,7 @@ Finally, you can pull "magic constants" out of your layouts as well. The followi

Recent Posts

diff --git a/content/en/templates/lists/index.md b/content/en/templates/lists/index.md index c78555d39..95d45a9d9 100644 --- a/content/en/templates/lists/index.md +++ b/content/en/templates/lists/index.md @@ -94,16 +94,16 @@ You can now access this `_index.md`'s' content in your list template:
-

{{.Title}}

+

{{.Title }}

- - {{.Content}} + + {{.Content }}
@@ -133,7 +133,7 @@ This above will output the following HTML: ### List Pages Without `_index.md` -You do *not* have to create an `_index.md` file for every list page (i.e. section, taxonomy, taxonomy terms, etc) or the homepage. If Hugo does not find an `_index.md` within the respective content section when rendering a list template, the page will be created but with no `{{.Content}}` and only the default values for `.Title` etc. +You do *not* have to create an `_index.md` file for every list page (i.e. section, taxonomy, taxonomy terms, etc) or the homepage. If Hugo does not find an `_index.md` within the respective content section when rendering a list template, the page will be created but with no `{{.Content }}` and only the default values for `.Title` etc. Using this same `layouts/_default/list.html` template and applying it to the `quotes` section above will render the following output. Note that `quotes` does not have an `_index.md` file to pull from: @@ -381,14 +381,14 @@ Hugo provides some functions for grouping pages by Section, Type, Date, etc. {{ end }} {{< /code >}} -In the above example, you may want `{{.Title}}` to point the `title` field you have added to your `_index.md` file instead. You can access this value using the [`.GetPage` function][getpage]: +In the above example, you may want `{{.Title }}` to point the `title` field you have added to your `_index.md` file instead. You can access this value using the [`.GetPage` function][getpage]: {{< code file="layouts/partials/by-page-field.html" >}} {{ range .Pages.GroupBy "Section" }} {{ with $.Site.GetPage "section" .Key }} -

{{.Title}}

+

{{.Title }}

{{ else }}

{{ .Key | title }}

@@ -544,7 +544,7 @@ While these are logical defaults, they are not always the desired order. There a ### Order Within Groups -Because Grouping returns a `{{.Key}}` and a slice of pages, all the ordering methods listed above are available. +Because Grouping returns a `{{.Key }}` and a slice of pages, all the ordering methods listed above are available. Here is the ordering for the example that follows: diff --git a/content/en/templates/menu-templates.md b/content/en/templates/menu-templates.md index 7649c0e56..9cb92459a 100644 --- a/content/en/templates/menu-templates.md +++ b/content/en/templates/menu-templates.md @@ -44,7 +44,7 @@ This partial template recursively "walks" a menu structure, rendering a localize {{- define "partials/inline/menu/walk.html" }} {{- $page := .page }} {{- range .menuEntries }} - {{- $attrs := dict "href" .URL}} + {{- $attrs := dict "href" .URL }} {{- if $page.IsMenuCurrent .Menu . }} {{- $attrs = merge $attrs (dict "class" "active" "aria-current" "page") }} {{- else if $page.HasMenuCurrent .Menu .}} diff --git a/content/en/templates/pagination.md b/content/en/templates/pagination.md index bdb10d5bb..32c130b72 100644 --- a/content/en/templates/pagination.md +++ b/content/en/templates/pagination.md @@ -59,7 +59,7 @@ The global page size setting (`Paginate`) can be overridden by providing a posit It is also possible to use the `GroupBy` functions in combination with pagination: ```go-html-template -{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} +{{ range (.Paginate (.Pages.GroupByDate "2006")).PageGroups }} ``` ## Build the navigation diff --git a/content/en/templates/render-hooks.md b/content/en/templates/render-hooks.md index b3483712c..a0534d20e 100644 --- a/content/en/templates/render-hooks.md +++ b/content/en/templates/render-hooks.md @@ -108,7 +108,7 @@ Ordinal {{< new-in "0.108.0" >}} Here is a code example for how the render-link.html template could look: {{< code file="layouts/_default/_markup/render-link.html" >}} -{{ .Text | safeHTML }} +{{ .Text | safeHTML }} {{< /code >}} ### Image Markdown example @@ -121,7 +121,7 @@ Here is a code example for how the render-image.html template could look: {{< code file="layouts/_default/_markup/render-image.html" >}}

- {{ .Text }} + {{ .Text }}

{{< /code >}} diff --git a/content/en/templates/section-templates.md b/content/en/templates/section-templates.md index 3cb37b111..3ca732e4b 100644 --- a/content/en/templates/section-templates.md +++ b/content/en/templates/section-templates.md @@ -54,7 +54,7 @@ Examples: {{ .Content }}
    {{ range .Paginator.Pages }} -
  • {{.Title}} +
  • {{.Title }}
    {{ partial "summary.html" . }}
    diff --git a/content/en/templates/shortcode-templates.md b/content/en/templates/shortcode-templates.md index fea06e73b..6cfb6d460 100644 --- a/content/en/templates/shortcode-templates.md +++ b/content/en/templates/shortcode-templates.md @@ -321,9 +321,9 @@ You also have an `img` shortcode with a single named `src` parameter that you wa {{< code file="layouts/shortcodes/img.html" >}} {{- $src := .Get "src" -}} {{- with .Parent -}} - + {{- else -}} - + {{- end -}} {{< /code >}} diff --git a/content/en/templates/single-page-templates.md b/content/en/templates/single-page-templates.md index 925f97b03..9fac42c02 100644 --- a/content/en/templates/single-page-templates.md +++ b/content/en/templates/single-page-templates.md @@ -64,10 +64,10 @@ This single page template makes use of Hugo [base templates], the [`.Format` fun
{{ with .PrevInSection }} - + {{ end }} {{ with .NextInSection }} - + {{ end }}
diff --git a/content/en/templates/taxonomy-templates.md b/content/en/templates/taxonomy-templates.md index 86abeb678..4411164da 100644 --- a/content/en/templates/taxonomy-templates.md +++ b/content/en/templates/taxonomy-templates.md @@ -258,7 +258,7 @@ This would be very useful in a sidebar as “featured content”. You could even
  • {{ $key }}
  • {{ end }} @@ -299,8 +299,8 @@ This example will list all taxonomies and their terms, as well as all the conten
  • {{ $key }}
  • @@ -322,7 +322,7 @@ Because taxonomies are lists, the [`.GetPage` function][getpage] can be used to diff --git a/content/en/variables/page.md b/content/en/variables/page.md index 02eb6932d..c6d29d39c 100644 --- a/content/en/variables/page.md +++ b/content/en/variables/page.md @@ -97,10 +97,10 @@ See also `.ExpiryDate`, `.Date`, `.PublishDate`, and [`.GitInfo`][gitinfo]. : access when creating links to the content. If set, Hugo will use the `linktitle` from the front matter before `title`. .Next -: Points up to the next [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath)). Example: `{{with .Next}}{{.Permalink}}{{end}}`. Calling `.Next` from the first page returns `nil`. +: Points up to the next [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath)). Example: `{{ with .Next }}{{.Permalink }}{{ end }}`. Calling `.Next` from the first page returns `nil`. .NextInSection -: Points up to the next [regular page](/variables/site/#site-pages) below the same top level section (e.g. in `/blog`)). Pages are sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath). Example: `{{with .NextInSection}}{{.Permalink}}{{end}}`. Calling `.NextInSection` from the first page returns `nil`. +: Points up to the next [regular page](/variables/site/#site-pages) below the same top level section (e.g. in `/blog`)). Pages are sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath). Example: `{{ with .NextInSection }}{{.Permalink }}{{ end }}`. Calling `.NextInSection` from the first page returns `nil`. .OutputFormats : contains all formats, including the current format, for a given page. Can be combined the with [`.Get` function](/functions/get/) to grab a specific format. (See [Output Formats](/templates/output-formats/).) @@ -119,10 +119,10 @@ See also `.ExpiryDate`, `.Date`, `.PublishDate`, and [`.GitInfo`][gitinfo]. : the slice of strings that results from splitting .Plain into words, as defined in Go's [strings.Fields](https://pkg.go.dev/strings#Fields). .Prev -: Points down to the previous [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath)). Example: `{{if .Prev}}{{.Prev.Permalink}}{{end}}`. Calling `.Prev` from the last page returns `nil`. +: Points down to the previous [regular page](/variables/site/#site-pages) (sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath)). Example: `{{ if .Prev }}{{.Prev.Permalink }}{{ end }}`. Calling `.Prev` from the last page returns `nil`. .PrevInSection -: Points down to the previous [regular page](/variables/site/#site-pages) below the same top level section (e.g. `/blog`). Pages are sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath). Example: `{{if .PrevInSection}}{{.PrevInSection.Permalink}}{{end}}`. Calling `.PrevInSection` from the last page returns `nil`. +: Points down to the previous [regular page](/variables/site/#site-pages) below the same top level section (e.g. `/blog`). Pages are sorted by Hugo's [default sort](/templates/lists#default-weight--date--linktitle--filepath). Example: `{{ if .PrevInSection }}{{.PrevInSection.Permalink }}{{ end }}`. Calling `.PrevInSection` from the last page returns `nil`. .PublishDate : the date on which the content was or will be published; `.Publishdate` pulls from the `publishdate` field in a content's front matter. See also `.ExpiryDate`, `.Date`, and `.Lastmod`. diff --git a/content/en/variables/pages.md b/content/en/variables/pages.md index 61036dd74..de8017945 100644 --- a/content/en/variables/pages.md +++ b/content/en/variables/pages.md @@ -23,8 +23,8 @@ Also see [List templates](/templates/lists) for an overview of sort methods. `.Next` and `.Prev` on `Pages` work similar to the methods with the same names on `.Page`, but are more flexible (and slightly slower) as they can be used on any page collection. -`.Next` points **up** to the next page relative to the page sent in as the argument. Example: `{{with .Site.RegularPages.Next . }}{{.RelPermalink}}{{end}}`. Calling `.Next` with the first page in the collection returns `nil`. +`.Next` points **up** to the next page relative to the page sent in as the argument. Example: `{{ with .Site.RegularPages.Next . }}{{.RelPermalink }}{{ end }}`. Calling `.Next` with the first page in the collection returns `nil`. ## .Prev PAGE -`.Prev` points **down** to the previous page relative to the page sent in as the argument. Example: `{{with .Site.RegularPages.Prev . }}{{.RelPermalink}}{{end}}`. Calling `.Prev` with the last page in the collection returns `nil`. +`.Prev` points **down** to the previous page relative to the page sent in as the argument. Example: `{{ with .Site.RegularPages.Prev . }}{{.RelPermalink }}{{ end }}`. Calling `.Prev` with the last page in the collection returns `nil`. diff --git a/content/en/variables/site.md b/content/en/variables/site.md index fb113198c..ffa728510 100644 --- a/content/en/variables/site.md +++ b/content/en/variables/site.md @@ -117,7 +117,7 @@ baseURL = "https://yoursite.example.com/" You can use `.Site.Params` in a [partial template](/templates/partials/) to call the default site description: {{< code file="layouts/partials/head.html" >}} - + {{< /code >}} ## The `.Site.Pages` Variable {#site-pages} diff --git a/content/en/variables/taxonomy.md b/content/en/variables/taxonomy.md index 901769b31..336930672 100644 --- a/content/en/variables/taxonomy.md +++ b/content/en/variables/taxonomy.md @@ -124,7 +124,7 @@ For example, to render the entire taxonomy data structure as a nested unordered