Range statement where clause with "or" logic operator

Hi - I looked in the docs and in the forum here for an answer, but, cannot seem to come up with anything, so I’m going to ask. I see how I can specify one section (edit: in my home page index.html template), like this:

{{ range where .Paginator.Pages "Section" "aaa" }}
    {{ .Render "summary" }}
{{ end }}

But if I have two sections I would like shown via this range statement, aaa and bbb, then how can I write the where clause to show that?

I tried things like:

{{ range where .Paginator.Pages "Section" "aaa" or "bbb" }}
{{ range where .Paginator.Pages "Section" ("aaa" or "bbb") }}
{{ range (where .Paginator.Pages "Section" "aaa") or (where .Paginator.Pages "Section" "bbb" }}

… but no joy. How must this be written?

I did try:

content/post/aaa/mypost.md
content/post/bbb/mypost.md

… so that I could simply use "Section" "post" in the where, but then, Hugo does not pick up the aaa and bbb in the URL path. I looked at how to specify the permalink, but, it appears there is no way to specify a subpath under a section. Putting it in the slug param in frontmatter does not work either.

I’ve searched extensively and I can’t find the answer to this question either. Can anyone help @RickCogley and I?

Perhaps the in operator can help. Untested:

{{{ range where .Paginator.Pages "Section" "in" (slice "aaa" "bbb") }}

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.