List pages from a specific section, but don't include this section in the output

Hello,

How can I iterate through Pages from a specific section, without having this section to be output along with its content?

My /content structure is as follows:

├── content
│   ├── (...)
│   ├── portfolio
│   │   ├── entry1
│   │   ├── entry2
│   │   └── (...)
│   └── posts
│       ├── post1
│       ├── post2
│       ├── (...)

Currently I’m using this code:

{{ range where .Site.Pages "Section" "portfolio" }}

But to avoid “Portfolios” section from being displayed along with its pages, I need to resort to a condition, which of course works, but I doubt is the best solution to this problem:

{{ if eq .Title "Portfolios" }}
	<!-- Do nothing -->
{{ else }}
	<!-- List out content of all pages -->
{{ end }}

Perhaps there’s a better way to deal with it?

Maybe .Site.RegularPages.

2 Likes

Perfect! Thank you @maiki.

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