2014-12-16 09:24:54 -07:00
|
|
|
Meteor.startup(function() {
|
2015-03-24 10:11:11 -06:00
|
|
|
// Inject SEO tags.
|
|
|
|
Router.onAfterAction(function() {
|
|
|
|
var props = {meta: {}, og: {}};
|
2014-12-16 09:24:54 -07:00
|
|
|
var title = this.getTitle && this.getTitle();
|
2015-03-24 10:11:11 -06:00
|
|
|
var description = this.getDescription && this.getDescription();
|
2015-03-28 18:30:26 +09:00
|
|
|
var image = Settings.get("siteImage");
|
2014-12-16 09:24:54 -07:00
|
|
|
if (title) {
|
|
|
|
props.og.title = title;
|
|
|
|
}
|
|
|
|
if (description) {
|
|
|
|
props.meta.description = description;
|
|
|
|
props.og.description = description;
|
|
|
|
}
|
|
|
|
if (image) {
|
|
|
|
props.og.image = image;
|
|
|
|
}
|
|
|
|
SEO.set(props);
|
2015-03-24 10:11:11 -06:00
|
|
|
});
|
2014-12-16 09:24:54 -07:00
|
|
|
|
2015-03-24 10:11:11 -06:00
|
|
|
// Add canonical URL to post pages
|
2014-12-16 09:24:54 -07:00
|
|
|
Router.onAfterAction(function() {
|
2015-03-24 10:11:11 -06:00
|
|
|
var post = Posts.findOne(this.params._id);
|
|
|
|
if (post) {
|
|
|
|
SEO.set({link: {canonical: getPostPageUrl(post)}});
|
|
|
|
}
|
|
|
|
}, {only: ["post_page", "post_page_with_slug"]});
|
2014-12-16 09:24:54 -07:00
|
|
|
|
|
|
|
});
|