Open AttilaSATAN opened 10 years ago
I also just spend few hours trying to solve that. Is there any way to get update on instruction? is it even working with new express version?
I would highly appreciate some help.
Same problem here, I'd love to know where to put the app.use() line. Thanks!
I too am struggling to work out where to put mean-seo in express.js post the upgrade to express 4.0. I have added in here:
// Setting the app router and static folder
app.use(express.static(path.resolve('./public')));
//See https://github.com/meanjs/mean-seo
app.use(seo({
cacheClient: 'disk', // Can be 'disk' or 'redis'
cacheDuration: 2 * 60 * 60 * 24 * 1000, // In milliseconds for disk cache
}));
// Globbing routing files
config.getGlobbedFiles('./app/routes/**/*.js').forEach(function(routePath) {
require(path.resolve(routePath))(app);
});
However, mean-seo does not seem to be working as Google is still not caching my page - a search for Polinode and checking cached shows a blank page.
@apitts, that is the correct place to add it. It's working for me. It took a while before google updated the search results.
If you sign up for the google webmaster tools, you can append the escaped fragment to the end of your website url and see if you are getting results. If so, it is working and will just take time for your ranking to improve in my experience.
Thanks @wesleyfsmith - appreciate it! Yep - I think my issue was actually SSL related, which is fixed now. It's still not rendering all my content so have another issue to solve yet...but certainly getting closer.
This is what I did and it seems to be working.... when I do curl http://localhost:9000/users/1?_escaped_fragment_=
// Setup server var app = express(); var server = require('http').createServer(app); var socketio = require('socket.io')(server, { serveClient: (config.env === 'production') ? false : true, path: '/socket.io' }); require('./config/socketio')(socketio); require('./config/express')(app);
app.use(seo({ cacheClient: 'disk', // Can be 'disk' or 'redis' cacheDuration: 2 * 60 * 60 * 24 * 1000, // In milliseconds for disk cache }));
require('./routes')(app); require('./config/conference')(app,socketio);
/config/lib/express.js
Before module.exports.init = function (db) {
~ line 220
/**
* Configure seo See https://yandex.ru/support/webmaster/robot-workings/ajax-indexing.xml
*/
module.exports.initModulesSeo = function (app) {
app.use(seo({
cacheClient: 'disk', // Can be 'disk' or 'redis'
cacheDuration: 0 // In milliseconds for disk cache
}));
};
Then before this.initModulesServerRoutes(app);
this.initModulesSeo(app);
If I'm mistaken please correct me but isn't
app.use(app.router)
removed from Express 4.https://github.com/visionmedia/express/wiki/Migrating-from-3.x-to-4.x
And if I'm not mistaken again, MEAN is using Exp. 4 Therefore there is no line of
app.use(app.router)
then where should I put
app.use(seo...)
?