Moving sub pages from one top level menu to another

I wonder if someone could tell me if what I am trying to do is possible, and if it is possible, point me in the right direction within the documentation? I am still very new to Hugo and SSG’s in general, so please forgive me asking about what may be a very simple issue.

I am hoping to build a site using Hugo the content of which will be edited by non technical people using the Netlify CMS.

A key requirement is to be able to move sub pages from one top level menu item to another.
ie: domain.com/dogs-looking-for-homes/jack-01 would move to domain.com/happy-endings/jack-01 when Jack has been adopted.

Using a database driven CMS (in my case MODX) the page can be dragged from one container to another in order to achieve the desired result.

As I understand it Hugo expects the arrangement of the source documents to match the final site structure. If I were working directly with the source files I would be able to move them from one location to another and presumably this would have the desired effect.

However, as far as I can tell, the Netlify CMS does not provide the ability to move files.

So I am wondering if there is a way of governing which top level menu a page appears under using data within the page itself, or if anyone could suggest another way I could do this?

You can do so if you use aliases and manual URLs.

I don’t suggest it, though. No one likes that: search engines, people, site maintainers. The URL itself doesn’t really matter, just that it stays the same. But that’s all I’ll advocate, you came looking for an answer, not a lecture. :slight_smile:

Thank you @maiki for the link, and the thoughts on urls! I’ll will read up on aliases.

This was a way to do it in your CMS, but that restraint no longer exists, so let’s consider what you are trying to do: make a profile stop showing at one section and start showing at the other. Okay, is that because those URLs are listings?

/dogs-looking-for-home/ - profiles of dogs in a list
/happy-endings/ - profiles of dogs that were adopted

If only the status of the dog is changing, then you should just use a field called status:

  • looking
  • adopted
  • works here part time
  • may be a cat

And then make those listings only list the profiles that are relevant. For the individual profiles, make them /dogs/, so you get example.org/dogs/jack-01.

Then when folks were looking at a profile, when they return they’ll visit the same URL, and will be updated on how it’s going.

That is better for search, better for site visitors and future family members, and easier for your site maintainers, as they don’t need to consider information architecture, they can just change the status, maybe post a new family photo, and move right along. :slight_smile:

Yes, you are correct, I wish to be able to display, in a list, animals that have a specific status like looking or adopted (I’ll ask the rescue about the ambiguous cat category - you never know!). Going down your suggested ‘status field’ route is much more appealing.

I don’t want to take up too much of your time, but could you point me in the right direction in the documentation for creating a menu item/clickable link that would display the animals with the relevant status?

The easy way is to create a taxonomy, and you’ll create a have a standard list, so for each term page you can override the URL to have it list where you want; your adopted term can have it’s URL set in front matter so it renders at example.org/happy-endings (though honestly, I’d probably name it something else), and have looking would render at example.org/dogs-looking-for-homes, etc.

This might be a lot to think about jumping into Hugo fresh, so my recommendation would be to start a small project to learn the template system and all that. :slight_smile:

Thats is a great help. Thank you @maiki. I will let you know how I get on.

1 Like