Hi,
I have the following structure for the content where the section « Projects » is structured with nested subfolders with 2 levels:
content
└── Projects
├── project-A
|-- post-A1
|_index.md
|-- post-A2
|_index.md
|-- post-A3
|-- post-A4
|-- _index.md
└── Project-B
|-- post-B1
|-- post-B2
|-- post-B3
|-- post-B4
|-- _index.md
How to list only the first level of subfolders, meaning listing only the information from _index.md
at the first level with the result as follows :
- Project A
- Project B
- Etc.
With no listing of the post-A1, post-A2, etc…
Thanks for your help
bep
June 25, 2017, 1:13pm
2
(.Site.GetPage "section" "Projects").Sections
should give you the sections you want.
HI,
Thank you but it doesn’t work.
@Polarhardboiled Just to make sure, are you doing this (below), and it doesn’t work?
{{ $sections := (.Site.GetPage "section" "Projects").Sections }}
then
{{ range $sections }}
{{ .Title }} <!-- or whatever -->
{{ end }}
And one more note. I believe the section name is case sensitive, so if your folder name is “projects” make sure you’re using lower case. You can avoid this altogether by using something like this:
{{ $sections := (.Site.GetPage "section" .Section).Sections }}
Note, instead of using Projects
I used .Section
which will pick up whatever section you’re currently on.
1 Like