雨果静态网站-尝试循环浏览多个子子文件夹并返回一个排序列表的问题

I have a folder in “content” called “projects” which has sub folders and also sub-sub folders. I’m trying to get the latest 12 pages content of all the sub-sub folders to show in a single list by date order. (see illustration below)

enter image description here

My current code (that doesn’t quite work):

<ul>
    {{ range .Sections }}
        <li><a href="{{ .RelPermalink }}">{{ .Title }}</a>
            {{ range .Sections }}
                {{ range first 12 .Pages }}
                    <ul>
                        <li><a href="{{ .RelPermalink}}">{{ .Title }}</a></li>
                    </ul>
                {{ end }}
            {{ end }}
        </li>
    {{ end }}
</ul>

This shows the first 12 pages from each sub-sub section. I need to get them all in one list and only show the latest 12 regardless or which sub-sub section they are in.

(This is on a list.html template and needs to be dynamic if it makes a difference - the folders could be called anything)

Cheers, A.

if what you are looking for is listing 12 pages from each 'main' section, this should work:

<ul>
    {{ range .Site.Sections }}
        {{ range first 12 .Pages }}
            <li><a href="{{ .RelPermalink}}">{{ .Title }}</a></li>
        {{ end }}
    {{ end }}
</ul>

Reference