Skip to content

Commit

Permalink
docs: Document complement
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Nov 7, 2018
1 parent 3a44920 commit ddcb402
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
29 changes: 29 additions & 0 deletions docs/content/en/functions/complement.md
Original file line number Diff line number Diff line change
@@ -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.





2 changes: 1 addition & 1 deletion docs/content/en/functions/intersect.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ categories: [functions]
menu:
docs:
parent: "functions"
keywords: []
keywords: [collections,intersect,union,complement,symdiff]
signature: ["intersect SET1 SET2"]
workson: []
hugoversion:
Expand Down
1 change: 0 additions & 1 deletion docs/themes/gohugoioTheme/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
{{ end }}

{{ define "main" }}

<section class="w-100 ph4 ph5-ns pv4">
{{- partial "home-page-sections/features-icons" . -}}
</section>
Expand Down

0 comments on commit ddcb402

Please sign in to comment.