我无法让SEO设置以路线为基础。
我尝试过的事情: 1)在客户端或服务器代码上方的seotest.js中全局设置它。
SeoCollection = new Meteor.Collection("SeoCollection");
Router.route('/', function () {
this.render('index');
SeoCollection.update(
{
route_name: 'index'
},
{
$set: {
route_name: 'index',
title: 'indexpagetestl',
meta: {
'description': 'Manuel Schoebel is an experienced web developer and startup founder. He develops but also consults startups about internet topics.'
},
og: {
'title': 'About - Manuel Schoebel',
'image': 'http://manuel-schoebel.com/images/authors/manuel-schoebel.jpg'
}
}
},
{
upsert: true
}
);
Router.route('/notindex', function () {
this.render('notindex');
SeoCollection.update(
{
route_name: 'notindex'
},
{
$set: {
route_name: 'notindex',
title: 'notindexpagetestl',
meta: {
'description': 'Manuel Schoebel is an experienced web developer and startup founder. He develops but also consults startups about internet topics.'
},
og: {
'title': 'About - Manuel Schoebel',
'image': 'http://manuel-schoebel.com/images/authors/manuel-schoebel.jpg'
}
}
},
{
upsert: true
}
);
}
我也试过内部(Meteor.isClient)和(Meteor.isServer)代码中的相同代码,但都不起作用。
我能够获得最初的SEO元标记:
Meteor.startup(function() {
if(Meteor.isClient){
return SEO.config({
title: 'Manuel Schoebel - MVP Development',
meta: {
'description': 'Manuel Schoebel develops Minimal Viable Producs (MVP) for Startups'
},
og: {
'image': 'http://manuel-schoebel.com/images/authors/manuel-schoebel.jpg'
}
});
}
});