Hugo

Loop all pages in a folder on homepage

Hello !

My content is organized inside one folder :
/content/portfolio/
which contains .md files and media files
I gave all .md files a type: portfolio

On my index page I want to loop through all pages.

This loop is empty:

{{ $portfolio := (where .Site.RegularPages “Section” “portfolio”).ByWeight }}
{{ range $portfolio }}

This loop returns one item:

{{ $portfolio := (where .Site.RegularPages “Type” “portfolio”).ByWeight }}
{{ range $portfolio }}

What am I missing here ?

Thanks !

Hi there,

It’s difficult to say what’s wrong with just the description you gave. Do you have your code somewhere we can have a look at? Please also have a look at Requesting Help .

1 Like