URL path structure

#1

I’m trying to migrate a wordpress blog to Grav & I have a few questions:

In wordpress you use categories to structure breadcrumbs. So, for the article “Tasty Homemade Cat Food Recipes” I would have:

Pets (main category)
Cats (sub category of pets)
Cat Food (Sub category of Cats)

Then I would assign my article to the Cat Food category.

Name my article would be named: Tasty Homemade Cat Food Recipes.

It would produce the URL mydomain/tasty-homemade-cat-food-recipes/

The breadcrumb structure would look like this: Pets > Cats > Cat Food > Tasty Homemade Cat Food Recipes

With Grav if I make a blog post nested within a blog post I get this url: mydomain/pets/cats/cat-food/tasty-homemade-cat-food-recipes/

Doing so does give me the breadcrumb structure: Pets > Cats > Cat Food > Tasty Homemade Cat Food Recipes

That is what I want. However, the URL is not what I want. Also, I don’t understand how to get the categories going.

My question is:

How do I make the blog folders like this: mydomain/pets/cats/cat-food/tasty-homemade-cat-food-recipes/

But have the url to access it like this: mydomain/tasty-homemade-cat-food-recipes/

#2

you can change route in your article blueprint
with /tasty-homemade-cat-food-recipes

… Welcome to Grav Community :grinning:

#3

Ok thanks for the help. I’m not using the admin panel. I figured out that I can add this to the page headers:

routes:
default: /tasty-homemade-cat-food-recipes

Now, when I try to do it site-wide by editing the user/config/site.yaml file it doesn’t work.

What’s the code to replicate this in the site.yaml file?

#4

you have to edit your article frontmatter (each article) ex: item.md

routes:
    default: /tasty-homemade-cat-food-recipes

or make a plugin to do it auto
but maybe i misunderstand what you want to achieve

#5

So, I read here: https://learn.getgrav.org/16/content/routing#regex-based-aliases

That you can edit the user/config/site.yaml & you can change the url structure for all blog posts. So instead of going into each blog post individually & doing this:

routes:
default: /tasty-homemade-cat-food-recipes

According to the document I can edit user/config/site.yaml & put something like this:

routes:
   /blog/(.*): /$1

My understanding is that this way, I don’t have to go into each individual blog post to add the route.

However, when I do this: /blog/(.*): /$1 it create blank pages, if you click on the url. Do I have the code wrong or do I am I missing something?