[SOLVED] Organizing Content in Subsections & Categories

Hi There,

I am building a site that organizes important contact information for different locations.

I’ve structured my content like this:

/content/<state>/<city>/<contact>

├── california/
│   └── los-angeles/
│       └── police.md | categories = ["emergency"]
│       └── fire.md | categories = ["emergency"]
│       └── parking-authority.md | categories = ["municipal"]
│       └── animal-control.md | categories = ["municipal"]
│   └── san-francisco/
│   └── san-diego/
│   └── pasadena/
├── new-york/
├── florida/
├── texas/
...
  1. Is it okay to structure content into sub-sections/folders like this?

  2. For a given contact record I would like to apply categories like “emergency” or “municipal” above and then be able to view content within a specific subsection (aka city) and for a specific category. What’s the best way to implement this?

For Example:

california/los-angeles/ --> Displays all contacts for Los Angeles
california/los-angeles/emergency/ --> Displays 'police.md' & 'fire.md'
california/los-angeles/municipal/ --> Displays 'parking-authority.md' & 'animal-control.md'
  1. Is there a good way to break up content on a page by category?

For Example:


Los Angeles, CA

Emergency

Police Department

Email: police@losangeles.org

Fire Department

Email: fire@losangeles.org

Municipal

Animal Control

Email: animalcontrol@losangeles.org

Parking Authority

Email: parking@losangeles.org

Thanks in advance for your help!

Regards,
A.J.

You could use categories if you wanted, but based on your example and URL structure, you should likely just continue to use the bundles as you are currently, and just extend it another layer deep.

/content/<state>/<city>/<contact>

├── california/
│   └── los-angeles/
│       └── _index.md
│       └── emergency/
│           └── _index.md
│           └── police.md
│           └── fire.md
│       └── municipal/
│           └── _index.md
│           └── parking-authority.md
│           └── animal-control.md
│   └── san-francisco/
│   └── san-diego/
│   └── pasadena/
├── new-york/
├── florida/
├── texas/

Then on the /los-angeles page you would be able to see the full list of los-angeles content, and the /los-angeles/emergency/ page would be a list of the emergency content.

Here is a good walk through: https://scripter.co/hugo-leaf-and-branch-bundles/

2 Likes
  1. Yes, though it seems to me (without too much knowledge of your content) that you could wrap some of those end-documents (e.g. police.md, fire.md etc.) into front matter of a city-level document. So california/los-angeles.md with los-angeles.md containing the front matter with the other data within it. You really only want the document to be for the page you want to display and I wouldn’t imagine you’d need a page for every police department (though I’m guessing).

  2. I think that makes sense. I definitely think categories is the right approach.

2 & 3. I don’t think there’s an easy answer here short of digging in and doing the work for you. Hugo’s taxonomy functionality is quite powerful once you get to know it. I think we’d be more helpful with very specific issues though.

Hope that helps!