I'm trying to mimic the URL structure exactly how I have it in my old CMS. If I select an entry to have both a category and subcategory I would like to have the subcategory in the URL along with the category and the entry slug.
For Example
http://example.com/cat1/subcat1/entry
Right now I have the Entry URL Format set to be {category.first().slug}/{slug}
, but that only shows the first category. How do I access that optional subcat1
subcategory in that field?
EDIT
I have tried the following but it doesn't work
{category.first.slug }/{ category.first.children.first.slug ? category.first.children.first.slug ~ '/' : '' }{slug}
I have also tried
{category[0].slug}/{ category[1] ? category[1].slug ~ '/': ''}{slug}