Hello. I have a Hugo site running through Hugo v0.83.1-extended that contains a content
folder organized with this hierarchy:
content
| |
| folder
| | |
| | _index.md
| | |
| | subfolder
| | | _index.md
| | | first.md
| | | second.md
| | | third.md
| | | fourth.md
| | |
| | other_subfolder
| | | _index.md
| | | first.md
| | | second.md
| | | third.md
I am trying to list every file in every subfolder.
Basically, my goal is to show on the homepage a list of every file in each subfolder, like this:
subfolder/_index.md
subfolder/first.md
subfolder/second.md
subfolder/third.md
subfolder/fourth.md
other_subfolder/_index.md
other_subfolder/first.md
other_subfolder/second.md
other_subfolder/third.md
So I wrote this in my template index.html
:
{{ $folder := .Site.GetPage "folder" }}
<ol>
{{ range $folder.Pages }}
<li>{{ .RelPermalink }}</li>
{{ end }}
</ol>
But I’m getting this as the result:
1. /folder/other_subfolder/
2. /folder/subfolder/
3. /folder/other_subfolder/second/
4. /folder/other_subfolder/third/
So I am missing a couple of files here and there, like /folder/subfolder/first/
or folder/other_subfolder/first/
.
Could you help and explain me what I am doing wrong, please?
Thank you very much in advance.
P.S. : For completeness, I have uploaded the whole Hugo website here: test-hugo.zip - Google Drive