Skip to content

markselby/node-angular-seo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Angular JS based SEO on Node.js backend server.

Getting Started

Install phantomjs

Documentation

phantomjs show-rendered.js 'http://writebox.co.uk/#!/kanban'

will show the fully rendered html.

This can be added as child process that is run on your Node.js server and used as output for the crawlers.

Needed Snippets

Nginx config

if ($args ~ "_escaped_fragment_=(.+)") {
  rewrite ^ /bots/$is_args$args;
}

Add an Express route similar to this :

/bots/:optional?*

which points to the Express endpoint for serving bots

var exec = require('child_process').exec;

...

// show-rendered.js lives in "bin/show-rendered.js" under the app
page: function page(req, res) {
  var safe = req.query._escaped_fragment_.match(/[\w\s_-]+/g)[0];
  var cmd = "phantomjs " + process.cwd() + "/bin/show-rendered.js 'http://" + req.host + "/#!/" + safe + "'";
  exec(cmd, function (error, stdout, stderr) {
    res.send(stdout);
  });
}

Contributing

Contact Mark

Release History

(0.0.1)

License

Just nick it and do what you want.

About

Scripts for SEO with Angular and Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published