mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-23 21:53:09 +02:00
Merge commit '35dec7c96f7ee3eb17dd444f7067f0c776fb56ae'
This commit is contained in:
@@ -1,26 +1,20 @@
|
||||
---
|
||||
title: collections.Intersect
|
||||
linkTitle: intersect
|
||||
description: Returns the common elements of two arrays or slices, in the same order as the first array.
|
||||
categories: [functions]
|
||||
categories: []
|
||||
keywords: []
|
||||
menu:
|
||||
docs:
|
||||
parent: functions
|
||||
function:
|
||||
action:
|
||||
aliases: [intersect]
|
||||
related:
|
||||
- functions/collections/Complement
|
||||
- functions/collections/SymDiff
|
||||
- functions/collections/Union
|
||||
returnType: any
|
||||
signatures: [collections.Intersect SET1 SET2]
|
||||
relatedFunctions:
|
||||
- collections.Complement
|
||||
- collections.Intersect
|
||||
- collections.SymDiff
|
||||
- collections.Union
|
||||
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") }}
|
||||
@@ -32,6 +26,5 @@ The above fetches regular pages not of `page` or `about` type unless they are pi
|
||||
|
||||
See [union](/functions/collections/union) for `OR`.
|
||||
|
||||
|
||||
[partials]: /templates/partials/
|
||||
[single]: /templates/single-page-templates/
|
||||
|
Reference in New Issue
Block a user