1

EE 2.9.0

I'm attempting to set up a template route for a new section of the site I'm working on. However when I do I get the error: Template Route Already in use

I've set up a route for the blog/single template which works /blog/{blog-post:alpha_dash}

However when I try to set one of up for about/single /about/news/{news-post:alpha_dash} The CP highlights both the blog and about/single template and says Route Already in use. Also won't let me set segment required on the about route.

When I refresh the page the blog route is there, but the about route is gone. See attached screenshot.

enter image description here

2 Answers 2

4

The problem is having no rule and having alpha_dash are exactly the same thing, so the error message is correct, those are duplicate routes. If you added the :pagination rule to the {pagination} variable, then it should work:

/about/news/{pagination:pagination}

Also, you'll need to have the {pagination:pagination} rule first, since alpha_dash would catch any pagination.

2

Well, Sean. Now, we have a problem. I already had this discussion with EllisLab, but I believe you should too. Their answer was to use something like:

/about/news/{news-post:alpha_dash}/{pagination}

And to set required segments to no. This way, the route will match:

/about/news/{news-post:alpha_dash}/{pagination}
/about/news/{news-post:alpha_dash}
/about/news/{pagination}

For me, this makes no sense. In my opinion, the previous segment should always be required because we don't use URLs like /about/news//something.

I prefer to be able to use something like:

/about/news/{news-post:alpha_dash}|{pagination}

By the way, alpha_dash will match pagination too.

2
  • 2
    > By the way, alpha_dash will match pagination too. That's the key, when compiled to regex, you have conflicting rules. The | option is intriguing, but for now, not requiring segments should work. > because we don't use URLs like /about/news//something The chances of a user or even a crawler trying that URL when you aren't linking to it are minuscule—so much that it's probably not worth the time to trap, but if that's a particular concern, you can always use segment conditionals to check for an empty segment and redirect to a 404. Commented Oct 28, 2014 at 15:00
  • 1
    Oh, SE, why don't you support multi-line comments... Commented Oct 28, 2014 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.