crossroads.js icon indicating copy to clipboard operation
crossroads.js copied to clipboard

Optional segments at the beginning of route

Open milutinovici opened this issue 10 years ago • 3 comments

For example this pattern: ':language:/blog/post/{id}' is matched when language is part of url 'en/blog/post/1' but if language is ommited, (which would be equivalent of using the default language) 'blog/post/1' the route isn't matched.

milutinovici avatar Dec 14 '14 22:12 milutinovici

Not sure how this is going to be handled here, but on every other routing framework I've seen out there, any optional path parameters were only allowed in the end of the URL

corintho avatar Apr 10 '15 01:04 corintho

we are using similar doubled route for similar case ':language:/blog/post/{id}' and '/blog/post/{id}' where both triggers same target. But be prepared for shuffled arguments.

Standa666 avatar Jun 11 '15 14:06 Standa666

Each URI should represent a single unique resource; now you duplicate the unique resource and this will hurt your search engine visibility.

The correct philosophy would be to have the route as '/blog/post/{id}?:language: or if you do not like GET parameters, you could have '/blog/post/{id}/:language:'

I believe Google Bot tries to discover get parameters (or path) regarding language, just like it does with paginated contents. If these are easily discoverable, the Google Bot will kind of reward you, since you will get less penalties for having similar looking pages with similar link structures at the content area.

AhtiAhde avatar Jun 18 '15 15:06 AhtiAhde