Dynamic URI to load entry template This may be asking the impossible, but I'm trying to do the following:
Say I have 3 channels, Country, Region, and Town. Town has an entry field to select a Region, a Region entry has a field to select a Country.
I want the URL for a Town entry to look like https://website.something/uk/west/torquay, or https://website.something/portugal/south/faro. Both of these URLs would load the template specified for the town. A URL of https://website.something/france/south would load a Region template.
I'm guessing I'll have to do some advanced routing?
Completely possible without any extra routing!
First you would need to make sure the relation fields are required to prevent any errors.
For the Country section, you would simply set up your section with the URI format { slug }
For Region you would set up the URI Format to grab the related Country's slug for the first segment, like this: { yourCountryFieldHandle.one().slug }/{ slug }
And for Town it would be { yourRegionFieldHandle.one().yourCountryFieldHandle.one().slug }/{ yourRegionFieldHandle.one().slug }/{ slug } which gets the related Region's Country for the first segment, then the related Region for the second.
You can then specify a different template for each section.