I’ve made a couple of sites with Hugo now and consider myself pretty proficient, but I’ve got a content organization issue which is flummoxing me to no end. Here’s the deal:
Let’s imagine that I have a site which sells gift bags. Every gift bag contains a list of items. Here’s what my content looks like. You can see that I’ve got two bags: chocolates, and flowers.
├── addons
│ ├── _index.md
│ ├── candles.md
│ └── soap.md
└── bags
├── _index.md
├── chocolates
│ ├── _index.md
│ ├── dark.md
│ └── milk.md
└── flowers
├── _index.md
├── dahlia.md
└── tulips.md
The _index.md file in /bags/ contains metadata about the bags section.
---
title: Our Amazing Bags
---
Each bag’s _index.md contains information about the bag itself, e.g.:
---
title: Bag O' Chocolate
price: $15
---
and the rest of the files contain information about the items in the bag. e.g.:
---
title: Milk Chocolate
type: item
---
Now, here’s what I don’t understand: when I navigate here:
I see the title not from bags/_index.md – but from bags/flowers/_index.md!
What’s more, I would expect .Data.Pages in the /bags/ section to contain the bags. It doesn’t. It only contains the items. Here’s the layouts/_default/section.html file from my template:
<h1>Section: {{ .Title }}</h1>
{{ range .Data.Pages }}
{{ .Render "single" }}
{{ end }}
I think I’m missing something fundamental about the new “everything’s a page” model in Hugo. What is it, and how would you organize this content?
