You got a template at about/index
.
If should be accessible via about/my-fancy-url
.
You fill out the Template route override
field at Template > Access
.
The page is now accessible via about/my-fancy-url
.
But neither {route="about/index"}
nor {route="about"}
or {path="about/index"}
or {path="about"}
return the correct URL!
Am I holding it wrong?
P.S. I tried with a non-index page and got the same results btw.
P.P.S. The Preview button on this forum does nothing?
Did you try creating a template route at Developer > Templates > Template Routes
?
https://docs.expressionengine.com/latest/control-panel/template-manager.html#template-routes
Hey Zignature,
as far as I can tell, Developer > Templates > Template Routes
does the same as Template > Access > Template route override
. A route you create via one tool will appear in the other.
But the problem remains: I’m not able to link to that template via any {path=xxx}
or {route=xxx}
.
Looking at the (bad) documentation, I cant help but ask what that’s supposed to be. The example is /segment/{variable}/{variable:rule}/{variable:rule0|rule1[arg]}
. What? How about you explain the basics first? How do I link to a template using a custom route? Why does the documentation explain the most complicated route (and only that), but not how to link to it? That makes no sense.
Maybe its just not possible (anymore).
I successfully created a couple of routes after reading this tutorial: Template Routes for Single Entry / Permalink URLs.
By the way, the routes I created through Developer > Templates > Template Routes
do not appear at Template > Access > Template route override
Alright, I think I got it now. This won’t work with EE, but it’s not a bug either.
I wanted to create long and fancy URLs for pages without having to use those long and fancy URLs in path variables or as names of the template groups.
I wanted the template group to be test, link to it via {path="test"}
or {route="test"}
and have EE turn the link into whatever I declare in the CMS, like /very-nice-page-with-lots-of-content.
That’s not how custom routes work in EE. They’re not aliases. They’re invisible template groups that include existing template groups when called.
Thanks @Zignature for your time and effort! <3
You can use the URL Title field for that, unless you want it set dynamically.
And maybe Variable Modifiers would work for your use case: https://docs.expressionengine.com/latest/templates/variable-modifiers.html#url_slug
P.S. I’m running EE 6.0.3 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.