Relationship with FlowRouter
This package is named flow-router-seo, but I wonder how tightly integrated with FR it really needs to be. The docs mainly mention setting properties manually in the onCreated callback, independently from FR.
You do mention querying the db for a route title based on a route name, but I'm a bit skeptic about that approach. If you can hard-code your route title in your database, why not hard-code it in your app's codebase directly and save a subscription?
I guess my point is that I don't see FlowRouter integration as a big feature for this package. Have you considered just making it into a great, stand-alone SEO package (with maybe optional support for FR and even IR)?
Anyway apart from that small question it's a great package. Keep up the good work :)
Hi @SachaG,
I definitely like the idea of a router-agnostic SEO package. I thought about it when I created this but I couldn't quite work out how to handle things without FlowRouter's enter/exit triggers (or IronRouter's equivalents).
As far as I can figure, you'd need to know when a user had left a route to revert back to the default meta tags. You could just require users of the package to have code in every onCreated and onDestroyed function of each template/route but that seemed a little cumbersome.
An alternative might be to watch for URL changes but then a URL change might not signify a route change. Plus I believe there is currently a delay in window.location updating with FlowRouter so if you relied on it within an onCreated method you might get funky results!
The database is only an optional setting that I included as the MS-SEO package for Iron Router had it. I personally don't use it and instead hard code it for static pages as you suggest. So I agree with you there!
If you have any ideas as to how it might work on a high level I'm happy to give it a go :)
Hmm, it's true I hadn't thought about the route-exiting thing. But then again, I think meta-tags are mainly used for crawlers, and I assume they fetch one page at a time? So would it really matter if the SEO tags didn't change every single time?
I actually ended up using https://github.com/kadirahq/meteor-dochead for now, because I feel it gives you a simpler API to add meta tags, and is router-agnostic. I'll see how it works :)