2

Currently i'm rewriteting my titles to slug. But when i make a slug from a sentence with a dash in it. The dash is included in the slug.

So this Awesome Title - 2017 get's converted to the slug awesome-title---2017

I know it's a quick fix, but i was wondering why it's not a valid URL as it throws a 404 page.

Maybe it's related to the backbone history routing implementation,. which is implemented in the single-page-app.

The thing I can't explain, is that I use the slugs for the routing config, so it's feed with the url with the three dashes (http://website.com/fake-url---with-extra-dashes), but when going to the url it gives and 404 error, while the one without dashes (http://website.com/fake-url-with-extra-dashes) is working.

Are there some kind of automatic rewriting going on behind the scene in Backbone? or is the browser rewriting the url, because multiple dashes is invalid?

  • Don't you think you need to escape the actual dash (`Awesome Title - 2017`) somehow to not be interpreted as a space regardless of the routing mechanism you're using? – T J Jan 05 '17 at 15:49
  • 1
    Yes. i think so. But i'm still wondering why it isn't a valid URL. – Bjarke Brask Rubeksen Jan 06 '17 at 10:56

0 Answers0