I have a static route for
/public/slides/lecture1.html#!3
which displays the third div element (other div HTMLelements will have display:none;) of lecture1.html.
I use Express app.use(express.static(WEBROOT)); and everything works fine. But I want to be able to make that slide AJAX Crawable so I want to react on request which looks like this:
/public/slides/lecture1.html?_escaped_fragment_=3
and return single page with only that one div element - so that Google would index texts from slide 3 in lecture1.html properly.
How do I do that using Express?
Is it possible to add GET request handler on link which is already served by express.static?
Thanks
Check out https://github.com/OptimalBits/Crawlme. It is an express middleware that handles this automatically. Just do this and you're ajax-crawlable:
var
express = require('express'),
http = require('http'),
crawlme = require('crawlme');
var app = express()
.use(crawlme())
.use(express.static(__dirname + '/webroot'));
http.createServer(app).listen(80);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With