[SOLVED] List of pages in sections for navigation

I have a list of projects, with images for each of them. They are in the following structure:

    _index.md # title: Works

I would like to list the projects in the navigation as follows:

 <ul class="menu">
                {{ range .Site.Sections }}
                <li>{{ .Title }}
                    <ul class="sub-menu">
                        {{ range .Pages }}
                            <a href="{{ . }}">{{ . }}</a>
                        {{ end }}
                {{ end }}

The top level link (Works) is displayed correctly, but the projects are not.

Additionally I would like to just generate one file for all of the projects without having single pages per projects. For this would it be enough to just define the list.html and not define the single.html in the layouts directory?

The above should be <a href="{{ .Permalink }}">{{ .Title }}</a>

You are trying to list the permalinks and titles of pages that belong in a Section. To render these you need to use the relative variables, not just plain dots.

Have a look at .GetPage

As for which template you need to use for this page it depends on the URL you have in mind.

Thanks for the tips.

My problem is that I can not access the entries in the /works directory. So when I loop the .Site.Sections and then the .Pages then the list is empty.

When I create a post as a file under /works then this is visible.

My expectation is that project01 is a page bundle and when I loop over the .Pages of a .Section then it will be in there.

Please post a link to your repository, or if you cannot share it then make another one with dummy content.

This is the link to the repo: https://bitbucket.org/medveczky/web/src/hugo-conversion/

The mock-up site is under master. You can see it here: https://peletomi.bitbucket.io/

Well… your 2 content files under /works/ schlitz.md and standard.md have draft: true hence the empty list page.

:man_facepalming: thanks!