Hugo 101: only display pages with a specific taxonomy term and that are from a specific folder

I am trying to display pages with a taxonomy priority: 3 and from the directory link. What am I doing wrong?

{{range .Pages}}
    {{if in .Params.priorities "3"}}
        {{if in .Pages.Section "link"}}
            {{partial "listLink" .}}
        {{else}}
            {{partial "listDefault" .}}
        {{end}}
    {{end}}
{{end}}

This is a very complex filtering question.

You need to provide a minimal repo that illustrates your project’s structure. For example what is the link directory? Is it a Section? Is it a Page Bundle?
You also need to write where you’re trying to render these pages. Is it on the homepage? Is it a section?

Once you answer the above then maybe either me or someone else in the Forum can help you.

2 Likes

before I answer @alexandros I realized I need to ask one more foundamental question:

Homepage has access to all pages of the site. Is it possible to create another page that can also access all pages of the site?

For example. I am trying to make index.html to display all pages of my website (the website has many folders). And I also want to create /top-picks.html page that will display all pages of the site with frontmatter „selected”. How one can access all pages of the site outside of homepage?

By using

{{ site.Pages }}
1 Like

thanks!

and what is the most reasonable way to create a list page like /top-picks.html.

Should I create an empty folder with _index.md? Is there any other way to do it?

Yep. Specifically here’s how I’d do it.

Create the section, a list file, and give it the front matter type: top-picks

content/top-picks/_index.md

Then create a list template just for that section

layouts/top-picks/list.html
1 Like

thanks, makes sense!