Scope of the last argument of "where"

I’ve been reading this article on Hugo related content and seen this:

```
{{ $characters := where .Site.Pages.ByTitle ".Params.novel" "intersect" (slice .Params.id)}}
```

I’ve been wondering, according to GoLang template rules, once you get into a function (like “where”), the scope changes to that function.

However, here, it isn’t the case. “.Params.novel” refers to the scope of the current cursor of “.Site.Pages.ByTitle”, while “.Params.id” refers to the CURRENT PAGE “id” front matter variable. How is this possible? Is there some scope tweak inside “where” that I’m not aware of?

I think the example in the article is wrong. /cc @regis

How is it wrong? Can you explain?

where takes 2 or 3 arguments. I count 4 in the example.

It does take 4 in this doc example. https://gohugo.io/functions/intersect/#and-filter-in-where-query

I would have to get back to you next week when I return from vacation.

You are right, I was wrong – I just looked at it again and it looks correct … sorry about the confusion.

The “left scope” and the “right scope” isn’t connected, so to speak. “.Params.novel” is each page in .Site.Pages, .Params.id is the “current page”.