I’m re-designing a site. In addition to normal blog-type content, it will also have “tests”, some but not all of which include sub-tests (currently I’ve no need for further levels, but I can imagine wanting sub-sub-tests at some point).
My first thought was to layout content like:
content/
/tests/
/test1.md
/test2.md
/test3/
_index.md
subtest31.md
subtest32.md
My goal when navigating to /tests/
is to render a listing for test1
, test2
, and test3
, but not the subtests. Only when navigating to /tests/test3
do I want to see the subtests.
If it helps, I put up a repository at https://github.com/wrex/testsite.git
.
Currently the site* at https://wrex.github.io/testsite/public/ lists all pages including subtests but not the test3 branch _index.md content, while https://wrex.github.io/testsite/public/tests/ fails to list test3
at all. Neither is what I desire.
(* Generated with Hugo v0.68.3.)
I’m fairly certain there is some simple conditional I can use in the list.html layout while ranging over .Pages
to tell if I’m in a sub-section (branch?) but I’m struggling to figure it out. I also strongly suspect there is “an easier way”.
I’ve just started the redesign and don’t have that much content to port over, so I have complete freedom in how I layout the content or otherwise organize the site, by the way.
I’d like to do it “the hugo way” and with as little unusual coding as possible. I’m a novice with hugo.
Thanks in advance for any help!