diff --git a/content/en/functions/cast/ToInt.md b/content/en/functions/cast/ToInt.md
index 283da1e40..f82f029d5 100644
--- a/content/en/functions/cast/ToInt.md
+++ b/content/en/functions/cast/ToInt.md
@@ -18,8 +18,8 @@ With a decimal (base 10) input:
{{ int 11 }} → 11 (int)
{{ int "11" }} → 11 (int)
-{{ int 11/1 }} → 11 (int)
-{{ int 11/9 }} → 11 (int)
+{{ int 11.1 }} → 11 (int)
+{{ int 11.9 }} → 11 (int)
```
With a binary (base 2) input:
diff --git a/content/en/functions/collections/After.md b/content/en/functions/collections/After.md
index e5c2d9bd8..2808035ae 100644
--- a/content/en/functions/collections/After.md
+++ b/content/en/functions/collections/After.md
@@ -17,10 +17,20 @@ The following shows `after` being used in conjunction with the [`slice`]function
```go-html-template
{{ $data := slice "one" "two" "three" "four" }}
-{{ range after 2 $data }}
- {{ . }}
-{{ end }}
-→ ["three", "four"]
+
+ {{ range after 2 $data }}
+ - {{ . }}
+ {{ end }}
+
+```
+
+The template above is rendered to:
+
+```html
+
```
## Example of `after` with `first`: 2nd–4th most recent articles
diff --git a/content/en/functions/collections/Dictionary.md b/content/en/functions/collections/Dictionary.md
index a90c9e590..cf523350c 100644
--- a/content/en/functions/collections/Dictionary.md
+++ b/content/en/functions/collections/Dictionary.md
@@ -15,7 +15,19 @@ action:
aliases: [/functions/dict]
---
-`dict` is especially useful for passing more than one value to a partial template.
+```go-html-template
+{{ $m := dict "a" 1 "b" 2 }}
+```
+
+The above produces this data structure:
+
+```json
+{
+ "a": 1,
+ "b": 2
+}
+```
+
Note that the `key` can be either a `string` or a `string slice`. The latter is useful to create a deeply nested structure, e.g.:
@@ -25,7 +37,6 @@ Note that the `key` can be either a `string` or a `string slice`. The latter is
The above produces this data structure:
-
```json
{
"a": {
@@ -36,7 +47,7 @@ The above produces this data structure:
}
```
-## Example: using `dict` to pass multiple values to a `partial`
+## Pass values to a partial template
The partial below creates an SVG and expects `fill`, `height` and `width` from the caller:
diff --git a/content/en/functions/collections/First.md b/content/en/functions/collections/First.md
index ab7ea0b72..49a0362f5 100644
--- a/content/en/functions/collections/First.md
+++ b/content/en/functions/collections/First.md
@@ -1,6 +1,6 @@
---
title: collections.First
-description: Slices an array to the first N elements.
+description: Returns the given collection, limited to the first N elements.
categories: []
keywords: []
action:
@@ -9,38 +9,28 @@ action:
- functions/collections/After
- functions/collections/Last
returnType: any
- signatures: [collections.First LIMIT COLLECTION]
+ signatures: [collections.First N COLLECTION]
aliases: [/functions/first]
---
-`first` works in a similar manner to the [`limit` keyword in SQL][limitkeyword]. It reduces the array to only the `first N` elements. It takes the array and number of elements as input.
-
-`first` takes two arguments:
-
-1. `number of elements`
-2. `array` *or* `slice of maps or structs`
-
-{{< code file="layout/_default/section.html" >}}
-{{ range first 10 .Pages }}
+```go-html-template
+{{ range first 5 .Pages }}
{{ .Render "summary" }}
{{ end }}
-{{< /code >}}
+```
-*Note: Exclusive to `first`, LIMIT can be '0' to return an empty array.*
+Set `N` to zero to return an empty collection.
-## `first` and `where` Together
+```go-html-template
+{{ $emptyPageCollection := first 0 .Pages}}
+```
-Using `first` and [`where`] together can be very
-powerful. Below snippet gets a list of posts only from [main
-sections], sorts it by the `title` parameter, and then
-ranges through only the first 5 posts in that list:
+Use `first` and [`where`] together.
-{{< code file="first-and-where-together.html" >}}
-{{ range first 5 (where site.RegularPages "Type" "in" site.Params.mainSections).ByTitle }}
- {{ .Content }}
+```go-html-template
+{{ range where .Pages "Section" "articles" | first 5 }}
+ {{ .Render "summary" }}
{{ end }}
-{{< /code >}}
+```
-[limitkeyword]: https://www.techonthenet.com/sql/select_limit.php
[`where`]: /functions/collections/where
-[main sections]: /functions/collections/where#mainsections
diff --git a/content/en/functions/collections/Intersect.md b/content/en/functions/collections/Intersect.md
index efcbbf470..8bc60f8e1 100644
--- a/content/en/functions/collections/Intersect.md
+++ b/content/en/functions/collections/Intersect.md
@@ -13,9 +13,8 @@ action:
signatures: [collections.Intersect SET1 SET2]
aliases: [/functions/intersect]
---
-A useful example is to use it as `AND` filters when combined with where:
-## AND filter in where query
+A useful example is to use it as `AND` filters when combined with where:
```go-html-template
{{ $pages := where .Site.RegularPages "Type" "not in" (slice "page" "about") }}
diff --git a/content/en/functions/collections/Last.md b/content/en/functions/collections/Last.md
index 4eda570ff..8219e120d 100644
--- a/content/en/functions/collections/Last.md
+++ b/content/en/functions/collections/Last.md
@@ -1,6 +1,6 @@
---
title: collections.Last
-description: Slices an array to the last N elements.
+description: Returns the given collection, limited to the last N elements.
categories: []
keywords: []
action:
@@ -9,7 +9,7 @@ action:
- functions/collections/After
- functions/collections/First
returnType: any
- signatures: [collections.Last INDEX COLLECTION]
+ signatures: [collections.Last N COLLECTION]
aliases: [/functions/last]
---
@@ -18,3 +18,17 @@ aliases: [/functions/last]
{{ .Render "summary" }}
{{ end }}
```
+
+Set `N` to zero to return an empty collection.
+
+```go-html-template
+{{ $emptyPageCollection := last 0 .Pages}}
+```
+
+Use `last` and [`where`] together.
+
+```go-html-template
+{{ range where .Pages "Section" "articles" | last 5 }}
+ {{ .Render "summary" }}
+{{ end }}
+```
diff --git a/content/en/functions/collections/Seq.md b/content/en/functions/collections/Seq.md
index fca3e92d7..e7430e0d0 100644
--- a/content/en/functions/collections/Seq.md
+++ b/content/en/functions/collections/Seq.md
@@ -36,3 +36,11 @@ Iterate over a sequence of integers:
{{ end }}
{{ $product }} → 24
```
+
+The example above is contrived. To calculate the product of 2 or more numbers, use the [`math.Product`] function:
+
+```go-html-template
+{{ math.Product (seq 4) }} → 24
+```
+
+[`math.Product`]: /functions/math/product
diff --git a/content/en/functions/collections/Sort.md b/content/en/functions/collections/Sort.md
index 90fbc7591..9e9ea80ca 100644
--- a/content/en/functions/collections/Sort.md
+++ b/content/en/functions/collections/Sort.md
@@ -107,17 +107,11 @@ Victor Marius Jean
## Sort a page collection
-Although you can use the `sort` function to sort a page collection, Hugo provides [built-in methods for sorting page collections] by:
+{{% note %}}
+Although you can use the `sort` function to sort a page collection, Hugo provides [sorting and grouping methods] as well.
-- weight
-- linktitle
-- title
-- front matter parameter
-- date
-- expiration date
-- last modified date
-- publish date
-- length
+[sorting and grouping methods]: /methods/pages
+{{% /note %}}
In this contrived example, sort the site's regular pages by `.Type` in descending order:
@@ -126,5 +120,3 @@ In this contrived example, sort the site's regular pages by `.Type` in descendin
{{ end }}
```
-
-[built-in methods for sorting page collections]: /templates/lists/#sort-content
diff --git a/content/en/functions/collections/Union.md b/content/en/functions/collections/Union.md
index bdc7c2237..e2eb61313 100644
--- a/content/en/functions/collections/Union.md
+++ b/content/en/functions/collections/Union.md
@@ -1,6 +1,6 @@
---
title: collections.Union
-description: Given two arrays or slices, returns a new array that contains the elements or objects that belong to either or both arrays/slices.
+description: Given two arrays or slices, returns a new array that contains the elements that belong to either or both arrays/slices.
categories: []
keywords: []
action:
@@ -15,7 +15,7 @@ related:
aliases: [/functions/union]
---
-Given two arrays (or slices) A and B, this function will return a new array that contains the elements or objects that belong to either A or to B or to both. The elements supported are strings, integers, and floats (only float64).
+Given two arrays (or slices) A and B, this function will return a new array that contains the elements or objects that belong to either A or to B or to both.
```go-html-template
{{ union (slice 1 2 3) (slice 3 4 5) }}
diff --git a/content/en/functions/collections/Uniq.md b/content/en/functions/collections/Uniq.md
index bda239568..8266142ac 100644
--- a/content/en/functions/collections/Uniq.md
+++ b/content/en/functions/collections/Uniq.md
@@ -1,6 +1,6 @@
---
title: collections.Uniq
-description: Takes in a slice or array and returns a slice with duplicate elements removed.
+description: Returns the given collection, removing duplicate elements.
categories: []
keywords: []
action:
diff --git a/content/en/functions/collections/Where.md b/content/en/functions/collections/Where.md
index 3b8bbdd37..b466e0e3d 100644
--- a/content/en/functions/collections/Where.md
+++ b/content/en/functions/collections/Where.md
@@ -1,6 +1,6 @@
---
title: collections.Where
-description: Filters an array to only the elements containing a matching value for a given field.
+description: Returns the given collection, removing elements that do not match the given field.
categories: []
keywords: []
action:
@@ -17,11 +17,7 @@ aliases: [/functions/where]
toc: true
---
-`where` filters an array to only the elements containing a matching
-value for a given field.
-
-It works in a similar manner to the [`where` keyword in
-SQL][wherekeyword].
+The `where` function is similar to the SQL [`where`] keyword.
```go-html-template
{{ range where .Pages "Section" "foo" }}
@@ -38,7 +34,7 @@ series: golang
```go-html-template
{{ range where .Site.Pages "Params.series" "golang" }}
- {{ .Content }}
+ {{ .Content }}
{{ end }}
```
@@ -46,7 +42,7 @@ It can also be used with the logical operators `!=`, `>=`, `in`, etc. Without an
```go-html-template
{{ range where .Pages "Section" "!=" "foo" }}
- {{ .Content }}
+ {{ .Content }}
{{ end }}
```
@@ -132,7 +128,7 @@ then ranges through only the first 5 posts in that list:
```go-html-template
{{ range first 5 (where site.RegularPages "Type" "in" site.Params.mainSections) }}
- {{ .Content }}
+ {{ .Content }}
{{ end }}
```
@@ -157,7 +153,7 @@ Only the following operators are available for `nil`
```go-html-template
{{ range where .Pages "Params.specialpost" "!=" nil }}
- {{ .Content }}
+ {{ .Content }}
{{ end }}
```
@@ -183,4 +179,4 @@ The user can override the default:
{{< /code-toggle >}}
[intersect]: /functions/collections/intersect
-[wherekeyword]: https://www.techonthenet.com/sql/where.php
+[`where`]: https://www.techonthenet.com/sql/where.php
diff --git a/content/en/methods/page/RawContent.md b/content/en/methods/page/RawContent.md
index 9fea16db6..258a294d0 100644
--- a/content/en/methods/page/RawContent.md
+++ b/content/en/methods/page/RawContent.md
@@ -19,7 +19,7 @@ The `RawContent` method on a `Page` object returns the raw content. The raw cont
{{ .RawContent }}
```
-This is useful when rendering a page in a plain text [content format].
+This is useful when rendering a page in a plain text [output format].
{{% note %}}
[Shortcodes] within the content are not rendered. To get the raw content with shortcodes rendered, use the [`RenderShortcodes`] method on a `Page` object.
@@ -28,4 +28,4 @@ This is useful when rendering a page in a plain text [content format].
[`RenderShortcodes`]: /methods/page/rendershortcodes
{{% /note %}}
-[content format]: /templates/output-formats
+[output format]: /templates/output-formats
diff --git a/content/en/templates/data-templates.md b/content/en/templates/data-templates.md
index d4a4ddcc0..6a24cd2c8 100644
--- a/content/en/templates/data-templates.md
+++ b/content/en/templates/data-templates.md
@@ -95,7 +95,7 @@ You can now render the list of recordings for all the bass players in a template
```go-html-template
{{ range $.Site.Data.jazz.bass }}
- {{ partial "artist.html" . }}
+ {{ partial "artist.html" . }}
{{ end }}
```
diff --git a/content/en/templates/introduction.md b/content/en/templates/introduction.md
index f19144f8b..1d292a078 100644
--- a/content/en/templates/introduction.md
+++ b/content/en/templates/introduction.md
@@ -215,7 +215,7 @@ element's index.
```go-html-template
{{ range $elem_index, $elem_val := $array }}
- {{ $elem_index }} -- {{ $elem_val }}
+ {{ $elem_index }} -- {{ $elem_val }}
{{ end }}
```
@@ -226,7 +226,7 @@ key.
```go-html-template
{{ range $elem_key, $elem_val := $map }}
- {{ $elem_key }} -- {{ $elem_val }}
+ {{ $elem_key }} -- {{ $elem_val }}
{{ end }}
```
diff --git a/content/en/templates/pagination.md b/content/en/templates/pagination.md
index 0ac6509ca..291a4c29b 100644
--- a/content/en/templates/pagination.md
+++ b/content/en/templates/pagination.md
@@ -78,7 +78,7 @@ The following example shows how to create `.Paginator` before its used:
{{ $paginator := .Paginate (where .Pages "Type" "posts") }}
{{ template "_internal/pagination.html" . }}
{{ range $paginator.Pages }}
- {{ .Title }}
+ {{ .Title }}
{{ end }}
```
@@ -87,7 +87,7 @@ Without the `where` filter, the above example is even simpler:
```go-html-template
{{ template "_internal/pagination.html" . }}
{{ range .Paginator.Pages }}
- {{ .Title }}
+ {{ .Title }}
{{ end }}
```