Austin Bailey
Austin Bailey

Reputation: 55

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!

Upvotes: 2

Views: 377

Answers (1)

Michel Floyd
Michel Floyd

Reputation: 20226

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)

Upvotes: 2

Related Questions