Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hashbang slash or no slash? [closed]

Should we do site.com/#!/blog or site.com/#!blog?

I understand there's no actual difference, however as a community of webdevelopers there should still be a conventional standard so that users can easily remember the url. If there's no already established standard, ideally someone will post an answer in favor of one and someone will post another in favor of another and one will get a lot more votes than the other...

Personally I prefer: site.com/#!blog simply because it's shorter. However I've seen many other sites use the other variant.

By the way, if your first instinct is to instruct us to not use hashbangs, then this question is not for you, please leave us alone.

like image 540
Mark Avatar asked Mar 24 '11 04:03

Mark


1 Answers

You forgot the third option of site.com#!blog.

If you want to get all semantical, the question becomes "what does a '/' represent in a url?"

  • Does it represent a physical directory? [site.com#!blog]

When navigating a file system, folders are separated with slashes. This is the natural behavior on the web as well, but routing has changed this.

  • Does it represent a hierarchy of content? [site.com/#!blog]

outing introduced hierarchy of content. Instead of question marks and ampersands, query vars were separated with slashes creating a deep link structure based on what the developers feel is important.

  • Does it represent a separation of context within your url? [site.com/#!/blog]

Stack Overflow is a good example of what I mean by "separation of context". The URL of this question is [http://stackoverflow.com/questions/5414972/hashbang-slash-or-no-slash/]. The slash between the question ID and the question title isn't there because there is a file inside a folder named 5414972. There is only one question with the ID 5414972 so it isn't necessary for hierarchy either. It was a conscious choice to use a slash to separate the ID and the name rather than using any other delimiter such as a hyphen, underscore, or even no delimiter at all. A delimiter that isn't a slash would probably make the two variables resemble one. By putting slashes on either sides of the hash bang, the url becomes:

url prefix > ajax crawling notation > the specific page

rather than

url prefix > ajax crawling notation and the specific page.

Depending on what you answer yes to (and yes, it's subjective), you will have your answer. I think it's a little silly to try and get the entire world to agree on a standard for this when we still can't decide on how we should format dates.

As for that last little comment about resentment towards the "hash bang", I think you are imagining this. Who wouldn't like "hash bangs" when they sound so similar to "flash bangs"?

like image 63
DingoEatingFuzz Avatar answered Sep 19 '22 05:09

DingoEatingFuzz