I've asked already about nested categories here, but I've just upgraded to Craft 3 and things seem to have changed a little.
I have three top-level category groups:
- Home
- About
- Funding
Each of these has multiple categories, and some of these categories are nested up to three levels deep.
My problem: the nested category URIs don't include the category group (which I appreciate doesn't have its own slug). Instead I get stuff like this:
/cat-A/subcat-1/
/cat-B/subcat-2/subcat-6/
... when what I want is:
about/cat-A/subcat-1/
funding/cat-B/subcat-2/subcat-6/
If I manually add funding/ or about/ as part of those categories' URI formats (eg. funding/{parent.uri}/{slug}) then it appends funding/ at each level, eg: funding/funding/funding/cat-B/subcat-2/subcat-6.
I've managed to achieve what I want for entries, by setting their URI format like so:
{category.first().group.handle}/{category.last().uri}/{parent.uri}/{slug}
... which gives me stuff like:
funding/cat-B/subcat-2/subcat-6/entry-title-slug
I only really need this feature to work because I envision users browsing the categories and potentially clicking the URI/links and being taken to the wrong place.
In my earlier post I created a top-level category group called "Navigation" which contained all my categories – this achieved the correct URIs. This feels messy/hacky though and means my users have to see a redundant "Navigation" group when editing categories.
It's likely I'm misunderstanding some aspect of Craft here – can anyone help me achieve what I'm trying to do here?