Open awwx opened 10 years ago
Oh interesting thanks @awwx. I'll look for your PR.
EDIT: Sorry, I see you meant a PR to mdg. I'm actually a bit confused here. I think Iron Router is only auto converting urls for IE. What about the appcache converts the url? Was this a PR that we pulled in previously?
@cmather Support for the appcache was added by @tmeasday in https://github.com/EventedMind/iron-location/commit/ea5085d461dad22fb482c5fc144e3d1fee2b6932
Whether as a result of that commit or some other change (I haven't looked at the code), iron-router is now converting urls for the appcache.
I presume iron-router has always used /#/path
for IE, and that's why it's now doing it for the appcache.
My suggestion to use /#!path
is actually just as valid for IE as it is for the appcache. Imagine someone is using IE and so gets a hash path, and then copy and pastes that URL into Facebook or whatever. Now Facebook or whoever attempts to fetch that URL to fill in the title and image and description and so on, but it can only do that with a /#!path
so that it can use the AJAX search engine crawling specification.
So independent of whether you're using the appcache or not, if you are using hash paths (whether for IE or the appcache or something else), it's better to use /#!path
paths because then they'll work with external services.
Thanks @awwx for the extra explanation. That makes sense. I don't see any reason why we shouldn't make this change. I'll come back to it shortly (have to switch to EM stuff for a bit). If someone has time to do a PR, or @awwx, I'm happy to add you to the projects. It's in iron:location.
https://github.com/EventedMind/iron-location/blob/master/lib/utils.js#L11. The two functions are there. I'll add this to next release tasks for myself but posting here in case someone wants to do it :).
@tmeasday do you have some time to make this change and update the tests?
I'll take a look.
But in this way it kill the hash navigation for site.... Is there a solution to it?
When using the appcache [edit: or older versions of IE], Iron Router converts a route like
/one
to/#/one
.Using
#!
would support the AJAX search engine crawling specification: https://developers.google.com/webmasters/ajax-crawling/docs/specificationSee my PR for supporting AJAX search engine crawling in spiderable: https://github.com/meteor/meteor/pull/2938
I'd suggest converting
/one
to/#!one
instead of/#!/one
to keep the character count down, as the second/
is unnecessary.