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}
http://example.com/cat1/subcat1/entry & http://example.com/cat1/entry
Is this correct?
Probably you will need to use custom routes, and a bit of template logic to determine if a request segment is a category url or an entry url.
I've not run into a need for segment 1 as a category url, it has always been something like /catalog/cat/entry or news/cat/entry/ Is there a specific reason you are not doing this way?
– Steve Adams Jun 20 '14 at 20:01example.com/category/<category-name>/The category slugs in the entry URL are just for contextual tips for the user & for SEO purposes... Anyways the question is how, not why :) – Seán O'Grady Jun 20 '14 at 21:03