Reputation: 21911
The <head>
section of Meteor cannot be part of a <template>
. Still I would like to set the <title>
tag programmatically.
Meteor - Setting the document title describes how to set the document.title
with JS but I highly doubt Google and other search engines will be very happy with this. Is there a way to properly set the <title>
tag in Meteor?
I'm aware of the spiderable
package. Is merely setting document.title
anywhere enough for it to properly handle <title>
?
Upvotes: 1
Views: 708
Reputation: 5472
The setting document title document kind of works for title's only, but you'd need full control over your whole head section.
There is a good article that walks you through how to implement the third party ms-seo package which is basically a javascript set of tools to properly manage the contents of your document's head section.
Having done this, it is the spiderable package's (built in meteor core package) job to expose your pages to search engines.
When your web site is a big javascript app and your body section is virtually empty, you need to tell the search engine that you are a web app, not a regular web site. When the search engine is informed that you are not a regular web site, it uses specially crafted url's to access your site. As a developer, your job would be to detect the calls to these special url's to present a static version of your site.
Meteor's spiderable package automates this task for you. In the background, it uses a javascript package called PhantomJS that is a server side full stack browser that sees your site just as a normal user would and provides the output to the search engine. And woila!, you get yourself SEO :)
Upvotes: 2
Reputation: 7680
If you haven't already, install the spiderable package. The way Meteor currently works with search engines is the client JS is run on the server in PhantomJS and then the resulting HTML is sent to the search engine. For more info on how this works, watch this video:
https://www.eventedmind.com/tracks/feed-archive/meteor-the-spiderable-package
Upvotes: 1