Custom Url Architecture That Goes Beyond First Level Structure

Hi all! I’m running into a little pickle. The URL architecture for my Hugo site is based on a documentation architecture. Once you reach three levels into a directory, you have to escape to access another directory, in order for the URL scheme to work.

So for example, you access the entire website and land on the homepage. This is served by accessing /content/landing/index.md.

On that page, you see a list of pages in the sidebar that are served up by, {{- range first 100 (where .Data.Pages "Type" "pages") }}. This will list out all of the folders within the directory /content/pages/. Accessing one of these pages by clicking on the links from the homepage, directs you to the folders based on the link you clicked. However, this were I’m having trouble…

You have the ability to access more folders when accessing one of the pages folders. This becomes problematic, because on the landing page which has a range and a type of pages, if I add another folder within a folder, it will simply output the folder I just added to the homepage list. I don’t want that.

I’ve been able go around this by creating a folder outside of /content/pages and call it /content/guides. I then list out all of the pages I want to access from /pages by calling /guides. The issue, is that my url structure goes from /pages/design-frameworks to /guides/buttons, when it should be /pages/design-frameworks/buttons.

Current architecture:

  • Hugo homepage (index.html)
  • /pages
  • /guides (Accessible from /pages)

Anyone have a solution that could fix this URL structure?

/_index.md
/pages/design-frameworks/_index.md
/pages/design-frameworks/buttons/_index.md
/pages/guides/_index.md

Or similar.