Range where with operator "contains"

I have the following range where statement:

{{ range where .Site.Pages .RelPermalink "operator" $subsection }}

I want to filter pages where the RelPermalink contains a subsection, e.g. (pseudocode)

RelPermalink of post1 = '/blog/foo/bar'
RelPermalink of post2 = '/blog/baz/bar'
subsection = 'foo'

In this case I would like to have just post1 returned. Is this somehow possible? The in-operator sounds good but its arguments should flipped, e.g. foo is in /blog/foo/bar but the operator checks for /blog/foo/bar is in foo. I need something like an contains-operator…

1 Like