Child page's URL doesn't contain parent page's slug

Our site has a navigation bar like this:

Home
Categories

  • Men Clothes
  • Women Clothes
    Shopping Cart
    Contact

Right now, the URL to Men Clothes category is oursite.com/categories/men-clothes. But we want it to be oursite.com/men-clothes, we don’t want to have another page at oursite.com/categories to care about.

I think of some hard-code in the theme, but I still want to use pages instead to let the person who manages the site can create more sub-menu like this Categories one by using pages an

overriding routing will be the way, detailed info in learn site:
https://learn.getgrav.org/content/routing

Thank you! I have tried routing, it works but only solves 50% of the problem. The navigation bar needs to show “men-clothes” instead of “categories/men-clothes”. It seems we really need to hard-code something in the theme?

Giới thiệu dự án Vinhomes Phạm Hùng tại địa chỉ http://vinhomesgroup.net.vn/du-an-chung-cu-vinhomes-sky-lake-pham-hung

Yes for the menu, you will have to change the logic in the navigation twig file, or as you said, maybe hard-coding those links might be easier.

Could you possibly clarify how these changes might be implemented?

I think i am in a similar boat – with a collection of hierarchical web pages (about 70 or so), but due to a pre-existing structure, my client would prefer all of them have the URL structure: domain/slug.html as opposed to domain/parent/parent/slug.html.

I needed to remove what I didn’t need in the URLs in my theme’s twig fiels. In your case, I remove “parent/parent/”. You also need to override the routes to allow us to go to the correct pages as Hugo mentioned.