yogiben / meteor-pretty-email

Pretty emails for meteor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hashbang in urls

yjarrar opened this issue · comments

Meteor accounts package currently adds a hashbang to the urls it generates, this means that, for example, Accounts.sendResetPasswordEmail generates a url in the email that looks like this:
/#/reset-password/
This doesn't play super nice with iron-router (iron-meteor/iron-router#3).

Changing the url in the html/by creating a custom template doesn't register with Meteor's account methods properly (e.g. onResetPasswordLink). Simple solution on fork @ https://github.com/gliesesoftware/meteor-pretty-email.

Might be worth adding an option to remove hashbang or set it to remove it by default?

It's possible to edit the content of the default emails.

I'm not sure how you'd do that, but it's not in the scope of this package to interfere with the accounts system.

Editing the contents of the default email detracts from the lovely abstraction/autonomy of the package and shouldn't be necessary since this is the default/general scenario (i.e. as I understand it this issue should apply to all apps using the latest iron router).

The suggestion wasn't so much to interfere with the accounts system as it was to remove the hashbang from the generated route (at the package level i.e. without touching the accounts system). But as you have insinuated this is still a very quick hack.

Iron router now supports a much better solution 👍

     Iron.Location.configure({useHashPaths: true});

This will enable your app to use hashbangs properly while at the same time letting your grab parameters/query paths as usual (refer to documentation @ http://eventedmind.github.io/iron-router/#legacy-browser-support)

This is probably good practice anyways regardless of emails since it approves browser compatibility (if that gets your dopamine bubbling) without having to make any other changes (as far as I am aware).

Issue closed - although it may be worthwhile to add a note about hashbangs to the package documentation since this issue has been referenced on other forums as being quite prevalent.

I'm having this same issue and for the life of me can't figure out where to add that configure declaration??? I get an undefined every time.

I probably should have explained further - you need to install a package called iron-location for this to work.

The full instructions are provided here (read them slowly!) @
https://github.com/iron-meteor/iron-router/blob/devel/Guide.md#legacy-browser-support

This will give your app hashbang urls and legacy support for ie8/ie9 pushstate which is nice if you are into that sort of thing ;)

I am curious as to the implications of hashbangs in routes from an SEO/site indexing perspective or whether there are any other side-effects of doing so, but the meteor.com website uses them so it seems like it's a recommended practice (e.g. http://docs.meteor.com/#/basic/ <- Note the hashbang)

_(If you really don't want to add hashbangs I hacked together a package @ https://atmospherejs.com/gliese/pretty-email which doesn't have hasbangs)_