Contentful logo

Contentful Community

Creating Subdirectories

I am trying to understand how you set up directories for content types in contentful

We have a Contentful Space that houses both blog posts and resource guides. I want to set up blog posts to be under /blog/ and in some cases even one step deeper /blog/employer/ and the resources to be under /resources/

I don’t understand how I do that and see that the people before me handled this with redirects (picture Macauley Culkin in home alone here).

I have tried to find this in documentation and in questions but cannot seem to find it.

Thanks in advance :slight_smile: :female_detective:

Hi @jennifer.garcia, each entry usually has a ‘slug’ field that is auto-generated from the title of the Entry. However, as you describe your case, you would like to group your content by ‘Category’ (or categories), in this case I would suggest that each Category to have their own slug. Then the Category can be linked from your ‘Blog’ entry.

At the end your FE application will need to have some rules on how to retrieve the particular entry. For example:
/blog/10-best-laptops (/blog would exists as a slug for Blog category and /10-best-laptops for an entry). Ideally you would need to split the URL by the slashes and query categories first, then the last part as the entry slug. I hope this advice can help :slight_smile: