Add 'category' to link of folder in content root

The folders in content/posts/ all get a /category/name link but those in the root of content are just /name/. I would like to append the /category/ to a folder in the content folder root. Is that possible?

You can do this on a per content file basis by setting the url front matter parameter.

I am already using /:slug/ for permalink and I want the contents in that folder to remain that way. So, I assume, there is no workaround?

In the project config you would need to specify the Permalink configuration that you need for each folder (section) that is directly under the root of the contentDir.

But that adds the slug /category/post-title/ to all posts instead of /post-title/. I only want the section itself to have the /category/section/ but the posts to remain the same. I am using this as the layout.

Ignore this. Found a workaround using the ‘where’ filter.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.