veliovgroup / Meteor-flow-router-title

Change document.title on the fly within flow-router
https://atmospherejs.com/ostrio/flow-router-title
BSD 3-Clause "New" or "Revised" License
25 stars 4 forks source link

[request] recursively search ancestor groups #5

Closed jdmswong closed 7 years ago

jdmswong commented 7 years ago

a titlePrefix and default title will affect all routes in a group, but not routes in a child groups group. It would be great to set these properties for the whole app through a single global group. Thanks!

dr-dimitru commented 7 years ago

Could you please give a little example of how you would like to use it?

jdmswong commented 7 years ago

I have a series of routes in groups:

ancestorGroup: {
  memberSection: {
    profilePage,
    createPost
  },
  freeContent: {
    freeItem1,
    freeItem2
  }
}

I would like to set ancestorGroup.titlePrefix = "Sitename: " to prefix all the titles of routes under it. So that the title of the profile page would be something like: "Sitename: profile page"; and item1: "Sitename: item1"

dr-dimitru commented 7 years ago

Not sure if root routeGroup is accessible in subChild route, I'll check it. What about global prefix?

jdmswong commented 7 years ago

in kadira's flow router you have to recursively travel up the ancestry tree

FlowRouter.globals.push({
    titlePrefix: "SiteName - "
});

didn't work

dr-dimitru commented 7 years ago

Hello @jdmswong ,

Implemented in v1.2.5