Most efficient way to organize content and lists?

Hey folks! Need advice on organizing directories and subdirectories within my content folder. Started to build out my file structure and am having trouble pulling in the information that I need -I’ve looked at the leaf/branch models but need some clarification.

Here’s what I have:

content/
└── research/
    ├── universal/
    │   ├── project1
    │   └── project2
    ├── global/
    │   ├── project1
    │   └── project2
    ├── local/
    │   ├── project1
    │   └── project2
    └── personal/
        ├── project1
        └── project2

I want to create a list page at /research to show universal, global, local, and personal (but not the projects within), and another list page for each subdirectory (/personal, for example) that shows each of the individual projects.

Can I do this by creating one list.html default layout? Do i need a index.md page for each of my subdirectories to get them to appear on the list?

thanks all!

Convert each subdirectory into a section by adding _index.md files.

https://gohugo.io/getting-started/glossary/#section

For example:

content/
├── research/
│   ├── global/
│   │   ├── _index.md
│   │   ├── project-1.md
│   │   └── project-2.md
│   ├── local/
│   │   ├── _index.md
│   │   ├── project-1.md
│   │   └── project-2.md
│   ├── personal/
│   │   ├── _index.md
│   │   ├── project-1.md
│   │   └── project-2.md
│   ├── universal/
│   │   ├── _index.md
│   │   ├── project-1.md
│   │   └── project-2.md
│   └── _index.md
└── _index.md

Then range through .Pages in your section template (e.g., layouts/_default/list.html).

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.