问题
I would like to use prerenderio with Meteor instead of phantomjs on the server with modulus.
However given the examples they provide, I'm not sure how to integrate it. They only provide a node express middleware which doesn't translate 100%.
回答1:
For SEO purposes? I mean, what else could it be? ;)
Firstly, remove the spiderable package if you haven't already.
Second, drop this at your server-side code (for example server/prerenderio.js
):
// Use Prerender with your token
var prerenderio = Npm.require('prerender-node').set('prerenderToken', 'YOUR_TOKEN');
// Feed it to middleware! (app.use)
WebApp.connectHandlers.use(prerenderio);
If you're wondering about Npm.require (or Meteor.require), See this answer (by me, sorry for shameless plug) for the gist: https://stackoverflow.com/a/16481897/951773
Source: I've used prerenderio successfully for a couple of our clients.
![Good luck!][1]
EDIT:
Since there has been major differences now between express request and response objects to meteor's connect objects, it went to really complicated now. But this has been addressed now and hopefully the PR I put in works:
https://github.com/dfischer/meteor-prerenderio/issues/1
TL;DR Thanks to this question now we have a prerender.io meteor module.
来源:https://stackoverflow.com/questions/26322771/how-to-use-prerenderio-with-meteor