From ddcb402859b50193bfd6d8b752b568d26d14f603 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Wed, 7 Nov 2018 08:52:41 +0100 Subject: [PATCH] docs: Document complement Closes https://github.com/gohugoio/hugoDocs/issues/658 --- docs/content/en/functions/complement.md | 29 ++++++++++++++++++++ docs/content/en/functions/intersect.md | 2 +- docs/themes/gohugoioTheme/layouts/index.html | 1 - 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 docs/content/en/functions/complement.md diff --git a/docs/content/en/functions/complement.md b/docs/content/en/functions/complement.md new file mode 100644 index 00000000000..461227789db --- /dev/null +++ b/docs/content/en/functions/complement.md @@ -0,0 +1,29 @@ +--- +title: "complement" +description: "`collections.Complement` (alias `complement`) gives the elements of a collection that are not in any of the others." +date: 2018-11-07 +categories: [functions] +menu: + docs: + parent: "functions" +keywords: [collections,intersect,union] +signature: ["COLLECTION | complement COLLECTION [COLLECTION]..." ] +hugoversion: "0.51" +aliases: [] +--- + +Example: + +```go-html-template +{{ $pages := .Site.RegularPages | first 50 }} +{{ $news := where $pages "Type" "news" | first 5 }} +{{ $blog := where $pages "Type" "blog" | first 5 }} +{{ $other := $pages | complement $news $blog | first 10 }} +``` + +The above is an imaginary use case for the home page where you want to display different page listings in sections/boxes on different places on the page: 5 from `news`, 5 from the `blog` and then 10 of the pages not shown in the other listings, to _complement_ them. + + + + + diff --git a/docs/content/en/functions/intersect.md b/docs/content/en/functions/intersect.md index 6d2efacbca4..53f26d95045 100644 --- a/docs/content/en/functions/intersect.md +++ b/docs/content/en/functions/intersect.md @@ -10,7 +10,7 @@ categories: [functions] menu: docs: parent: "functions" -keywords: [] +keywords: [collections,intersect,union,complement,symdiff] signature: ["intersect SET1 SET2"] workson: [] hugoversion: diff --git a/docs/themes/gohugoioTheme/layouts/index.html b/docs/themes/gohugoioTheme/layouts/index.html index 2f9364c8c29..93dfdd6c60e 100644 --- a/docs/themes/gohugoioTheme/layouts/index.html +++ b/docs/themes/gohugoioTheme/layouts/index.html @@ -4,7 +4,6 @@ {{ end }} {{ define "main" }} -
{{- partial "home-page-sections/features-icons" . -}}