Code Monkey home page Code Monkey logo

ajax-seo's Introduction

AJAX-SEO Bower Version

A simple server to provide rendered html to crawlers, for ajax sites.

How to use

  1. Install PhantomJS, on Mac, you can: $ brew install phantomjs

    $ sudo apt-get install phantomjs  
    
  2. Start SEO Server

    $ phantomjs seo.js
    
  3. Setup nginx, add codes below into site configuration:

    if ($args ~ _escaped_fragment_) {
      rewrite ^ /snapshot$uri;
    }
    
    location ~ ^/snapshot(.*) {
      rewrite ^/snapshot(.*)$ $1 break;
      proxy_pass http://localhost:8888;
      proxy_set_header Host $scheme://$host;
      proxy_connect_timeout 60s;
    }
    
    

How to verify

$ curl http://yoursite.domain/page#!/id/12
$ ## verify it's fully rendered HTML

How to test your local app w/o nginx

$ ## if your app is running at http://localhost:3000
$ curl http://localhost:8888/page#!/id/12 --header Host:localhost:3000
$ ## verify it's fully rendered HTML

Notes

For index page of your site, you need to add this in HTML if you haven't:

<meta name="fragment" content="!" />

if you have trouble for https URLs, try this:

$ # phantomjs --ssl-protocol=any seo.js 

see phantomjs options documentation

ajax-seo's People

Contributors

gabrieldelepine avatar liuwenchao avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.