Skip to content

Instantly share code, notes, and snippets.

@jimmyislive
Created April 16, 2014 07:47
Show Gist options
  • Save jimmyislive/10826668 to your computer and use it in GitHub Desktop.
Save jimmyislive/10826668 to your computer and use it in GitHub Desktop.
angularjs with seo
exports.index = function(req, res){
if (req.query._escaped_fragment_ !== undefined) {
if (req.query._escaped_fragment_[0] === '/') {
req.query._escaped_fragment_ = req.query._escaped_fragment_.substring(1);
}
if (req.query._escaped_fragment_[req.query._escaped_fragment_.length - 1] === '/') {
req.query._escaped_fragment_ = req.query._escaped_fragment_.substring(0, req.query._escaped_fragment_.length - 1);
}
var seo_filename = req.query._escaped_fragment_.replace(/\//g, '_');
res.render('snapshots/' + seo_filename + '.html');
} else {
res.render('index-ng');
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment