prerender_rails 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/README.md +11 -20
  4. data/prerender_rails.gemspec +2 -2
  5. metadata +6 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53e17774838aa1eb957522326025564eeb839987e34a30e5858b0bc64ee12416
4
- data.tar.gz: 6cae04ac35e08c3264fda5ccc9b03fc2249b3f787310cbff378f04e7475d4d7c
3
+ metadata.gz: 9ad51a96d32341a8c7e1a16bab77e25d12496ba62f4106d50b4eedaec7463459
4
+ data.tar.gz: 15a604ab01e06b512ca7a8f8d1bd2454eca2e74f618efb8bca2aa50bb1c062c8
5
5
  SHA512:
6
- metadata.gz: 35a129687b232592ada21a8537de27cf6410446f73b010747af3e3c077bbacecccd8e00770ec8228037cba80208e9afc3b495a359355a27e503d7d99c63fa7c3
7
- data.tar.gz: f4920348ac35227b67a0c3f2a1c8478fa34af8590df1cbf39e9eb1ddaf87b064e4a7562b1d807388d9e79ffea772d18c6abd1190312732fdadd14d82a8254f91
6
+ metadata.gz: 5724c737f2d5ca3577cc68c3a4a614c7cc3a133c4cbb427f9cc987d0cdc62ecf49c867d9373a45e1cb06c3055ed26c58ccca6cf7433833946d92eda839a28d65
7
+ data.tar.gz: fb6fa687514f28dba267cacf50422fa0e4ef82ab6e769ffd288b2b8ef966c33aea489078ffb490d1554bbd1800f2b76f9634f84c7e88ca491cae1bd0bc3a5141
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .DS_Store
data/README.md CHANGED
@@ -1,14 +1,11 @@
1
- Prerender Rails [![Stories in Ready](https://badge.waffle.io/prerender/prerender_rails.png?label=ready&title=Ready)](https://waffle.io/prerender/prerender_rails) [![Build Status](https://travis-ci.org/prerender/prerender_rails.png)](https://travis-ci.org/prerender/prerender_rails) [![Gem Version](https://badge.fury.io/rb/prerender_rails.png)](http://badge.fury.io/rb/prerender_rails)
1
+ Prerender Rails [![Build Status](https://travis-ci.org/prerender/prerender_rails.png)](https://travis-ci.org/prerender/prerender_rails) [![Gem Version](https://badge.fury.io/rb/prerender_rails.png)](http://badge.fury.io/rb/prerender_rails)
2
2
  ===========================
3
3
 
4
- Google, Facebook, Twitter, Yahoo, and Bing are constantly trying to view your website... but they don't execute javascript. That's why we built Prerender. Prerender is perfect for AngularJS SEO, BackboneJS SEO, EmberJS SEO, and any other javascript framework.
4
+ Google, Facebook, Twitter, and Bing are constantly trying to view your website... but Google is the only crawler that executes a meaningful amount of JavaScript and Google even admits that they can execute JavaScript weeks after actually crawling. Prerender allows you to serve the full HTML of your website back to Google and other crawlers so that they don't have to execute any JavaScript. [Google recommends using Prerender.io](https://developers.google.com/search/docs/guides/dynamic-rendering) to prevent indexation issues on sites with large amounts of JavaScript.
5
5
 
6
- This middleware intercepts requests to your Rails website from crawlers, and then makes a call to the (external) Prerender Service to get the static HTML instead of the javascript for that page.
6
+ Prerender is perfect for Angular SEO, React SEO, Vue SEO, and any other JavaScript framework.
7
7
 
8
- Prerender adheres to google's `_escaped_fragment_` proposal, which we recommend you use. It's easy:
9
- - Just add <meta name="fragment" content="!"> to the <head> of all of your pages
10
- - If you use hash urls (#), change them to the hash-bang (#!)
11
- - That's it! Perfect SEO on javascript pages.
8
+ This middleware intercepts requests to your Node.js website from crawlers, and then makes a call to the (external) Prerender Service to get the static HTML instead of the JavaScript for that page. That HTML is then returned to the crawler.
12
9
 
13
10
  `Note` Make sure you have more than one webserver thread/process running because the prerender service will make a request to your server to render the HTML.
14
11
 
@@ -22,7 +19,7 @@ And in `config/environment/production.rb`, add this line:
22
19
  config.middleware.use Rack::Prerender
23
20
  ```
24
21
 
25
- or if you have an account on [prerender.io](http://prerender.io) and want to use your token:
22
+ or if you have an account on [prerender.io](https://prerender.io/) and want to use your token:
26
23
 
27
24
  ```ruby
28
25
  config.middleware.use Rack::Prerender, prerender_token: 'YOUR_TOKEN'
@@ -32,21 +29,15 @@ or if you have an account on [prerender.io](http://prerender.io) and want to use
32
29
 
33
30
  ## Testing
34
31
 
35
- When testing make sure you're not using a single threaded application server like default WEBrick one, use Puma or Unicorn.
32
+ When testing make sure you're not using a single threaded application server like default WEBrick one, use Puma or Unicorn to prevent a deadlock when the Prerender Service needs to render your HTML on the fly.
36
33
 
37
- If your URLs use a hash-bang:
34
+ The best way to test the prerendered page is to [set the User Agent of your browser to Googlebot's user agent](https://developers.google.com/web/tools/chrome-devtools/device-mode/override-user-agent) and visit your URL directly. If you View Source on that URL, you should see the static HTML version of the page with the `<script>` tags removed from the page. If you still see `<script>` tags then that means the middleware isn't set up properly yet.
38
35
 
39
- If you want to see `http://localhost:5000/#!/profiles/1234`
40
- Then go to `http://localhost:5000/?_escaped_fragment_=/profiles/1234`
41
-
42
- If your URLs use push-state:
43
-
44
- If you want to see `http://localhost:5000/profiles/1234`
45
- Then go to `http://localhost:5000/profiles/1234?_escaped_fragment_=`
36
+ `Note` If you're testing locally, you'll need to run the [prerender server](https://github.com/prerender/prerender) locally so that it has access to your server.
46
37
 
47
38
  ## How it works
48
39
  1. The middleware checks to make sure we should show a prerendered page
49
- 1. The middleware checks if the request is from a crawler (`_escaped_fragment_` or agent string)
40
+ 1. The middleware checks if the request is from a crawler by checking the user agent string against a default list of crawler user agents
50
41
  2. The middleware checks to make sure we aren't requesting a resource (js, css, etc...)
51
42
  3. (optional) The middleware checks to make sure the url is in the whitelist
52
43
  4. (optional) The middleware checks to make sure the url isn't in the blacklist
@@ -137,7 +128,7 @@ config.middleware.use Rack::Prerender,
137
128
 
138
129
  ## Using your own prerender service
139
130
 
140
- We host a Prerender server at [prerender.io](http://prerender.io) so that you can work on more important things, but if you've deployed the prerender service on your own... set the `PRERENDER_SERVICE_URL` environment variable so that this middleware points there instead. Otherwise, it will default to the service already deployed by [prerender.io](http://prerender.io).
131
+ We host a Prerender server at [prerender.io](https://prerender.io/) so that you can work on more important things, but if you've deployed the prerender service on your own... set the `PRERENDER_SERVICE_URL` environment variable so that this middleware points there instead. Otherwise, it will default to the service already deployed by [prerender.io](https://prerender.io/).
141
132
 
142
133
  $ export PRERENDER_SERVICE_URL=<new url>
143
134
 
@@ -148,7 +139,7 @@ Or on heroku:
148
139
  As an alternative, you can pass `prerender_service_url` in the options object during initialization of the middleware
149
140
 
150
141
  ``` ruby
151
- config.middleware.use Rack::Prerender, prerender_service_url: '&lt;new url>'
142
+ config.middleware.use Rack::Prerender, prerender_service_url: '<new url>'
152
143
  ```
153
144
 
154
145
  ## License
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "prerender_rails"
5
- spec.version = "1.6.1"
5
+ spec.version = "1.6.2 "
6
6
  spec.authors = ["Todd Hooper"]
7
7
  spec.email = ["todd@prerender.io"]
8
8
  spec.description = %q{Rails middleware to prerender your javascript heavy pages on the fly by a phantomjs service}
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
15
15
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
16
  spec.require_paths = ["lib"]
17
17
 
18
- spec.add_dependency 'rack', '>= 0'
18
+ spec.add_dependency 'rack', '~> 2.0.6'
19
19
  spec.add_dependency 'activesupport', '>= 0'
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prerender_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Hooper
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-28 00:00:00.000000000 Z
11
+ date: 2020-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 2.0.6
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 2.0.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement