Ad

Setting Page Title With Useraccounts:flow-router

I'm just beginning to really dive into Meteor and start some personal projects but I've stumbled across something that I haven't yet found an answer for. I'm trying to set the title of my pages that are used for logging in, signing up, etc. Is there a solution for this? I don't see anywhere in the docs where I can add an option in these configuration statements.

This is my routes.jsx file:

AccountsTemplates.configureRoute("changePwd");
AccountsTemplates.configureRoute("forgotPwd");
AccountsTemplates.configureRoute("resetPwd");
AccountsTemplates.configureRoute("signIn");
AccountsTemplates.configureRoute("signUp");
AccountsTemplates.configureRoute("verifyEmail");

Thanks!

Ad

Answer

You should be able to pull this off with:

FlowRouter.triggers.enter([function(){
  document.title = FlowRouter.current().path;
]);

This would set the page title = the route path for all routes. If you want route-specific titles then you can add triggers on each route individually. (docs)

Ad
source: stackoverflow.com
Ad