canonical-rails 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +14 -6
- data/app/helpers/canonical_rails/tag_helper.rb +4 -4
- data/lib/canonical-rails/version.rb +1 -1
- metadata +24 -32
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: eea720f9f6caad4bc34837f6a2265b4bc0673afe
|
4
|
+
data.tar.gz: d2566cf14a31c3253685eb102358957c7c055d9c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0479b71bbcfc0933ca238027f6d9881e51068c6a6d843a746ac6cbc9f993b2e692c0267da371814bd3ccb4587744bdb7bb9e3179b52dfbe16d11b83821062a39
|
7
|
+
data.tar.gz: b7845f8a3313244ba9692c5dd88966a5883e68d0cbef6ac2efc419b99758a4b6d3328d06abb520b4306619eb2a925a92b78792340caaea38ddd048f06bb9be80
|
data/README.md
CHANGED
@@ -1,24 +1,32 @@
|
|
1
1
|
CanonicalRails
|
2
2
|
==============
|
3
|
+
[![Dependency Status](https://gemnasium.com/jumph4x/canonical-rails.png)](https://gemnasium.com/jumph4x/canonical-rails)
|
3
4
|
|
4
5
|
This project rocks and uses MIT-LICENSE, foh sho. Works with rails 3 and 4.
|
5
6
|
|
6
|
-
|
7
|
+
A number of articles exist explaining the issue concisely and at length:
|
8
|
+
|
9
|
+
* [Google Webmaster Blog Page About Specifying Canonical](http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html)
|
10
|
+
* [Google Support About rel="canonical"](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394)
|
11
|
+
* [Google Support About Canonicalization](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139066)
|
7
12
|
|
8
13
|
## Challenge
|
9
14
|
|
10
|
-
I've seen a lot of folks do more harm by neglecting canonicalization altogether than by applying to narrowly and conservatively, so here is an attempt to let people start
|
15
|
+
I've seen a lot of folks do more harm by neglecting canonicalization altogether than by applying to narrowly and conservatively, so here is an attempt to let people start modestly without spending too much time on it and whitelist parameters as they need to.
|
11
16
|
|
12
17
|
## Install
|
13
18
|
|
14
|
-
gem 'canonical-rails', :
|
15
|
-
|
19
|
+
gem 'canonical-rails', github: 'jumph4x/canonical-rails'
|
20
|
+
|
16
21
|
## Usage
|
17
22
|
|
18
23
|
First, generate the config
|
19
24
|
|
20
25
|
rails g canonical_rails:install
|
21
|
-
|
26
|
+
|
22
27
|
Then find it in config/initializers/ as canonical_rails.rb
|
23
28
|
|
24
|
-
Finally, include the canonical_tag helper in your views
|
29
|
+
Finally, include the canonical_tag helper in your views:
|
30
|
+
```ruby
|
31
|
+
<%= canonical_tag -%>
|
32
|
+
```
|
@@ -17,12 +17,12 @@ module CanonicalRails
|
|
17
17
|
CanonicalRails.host || request.host
|
18
18
|
end
|
19
19
|
|
20
|
-
def canonical_href
|
21
|
-
"#{request.protocol}#{
|
20
|
+
def canonical_href(host=canonical_host)
|
21
|
+
"#{request.protocol}#{host}#{path_without_html_extension}#{trailing_slash_if_needed}#{whitelisted_query_string}"
|
22
22
|
end
|
23
23
|
|
24
|
-
def canonical_tag
|
25
|
-
tag(:link, :href => canonical_href, :rel => 'canonical')
|
24
|
+
def canonical_tag(host=canonical_host)
|
25
|
+
tag(:link, :href => canonical_href(host), :rel => 'canonical')
|
26
26
|
end
|
27
27
|
|
28
28
|
def whitelisted_params
|
metadata
CHANGED
@@ -1,72 +1,65 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canonical-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.4
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Denis Ivanov
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-03-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rails
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.1'
|
22
|
-
- - <
|
20
|
+
- - "<"
|
23
21
|
- !ruby/object:Gem::Version
|
24
22
|
version: '5.0'
|
25
23
|
type: :runtime
|
26
24
|
prerelease: false
|
27
25
|
version_requirements: !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
26
|
requirements:
|
30
|
-
- -
|
27
|
+
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
29
|
version: '3.1'
|
33
|
-
- - <
|
30
|
+
- - "<"
|
34
31
|
- !ruby/object:Gem::Version
|
35
32
|
version: '5.0'
|
36
33
|
- !ruby/object:Gem::Dependency
|
37
34
|
name: sqlite3
|
38
35
|
requirement: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
36
|
requirements:
|
41
|
-
- -
|
37
|
+
- - ">="
|
42
38
|
- !ruby/object:Gem::Version
|
43
39
|
version: '0'
|
44
40
|
type: :development
|
45
41
|
prerelease: false
|
46
42
|
version_requirements: !ruby/object:Gem::Requirement
|
47
|
-
none: false
|
48
43
|
requirements:
|
49
|
-
- -
|
44
|
+
- - ">="
|
50
45
|
- !ruby/object:Gem::Version
|
51
46
|
version: '0'
|
52
47
|
- !ruby/object:Gem::Dependency
|
53
48
|
name: rspec-rails
|
54
49
|
requirement: !ruby/object:Gem::Requirement
|
55
|
-
none: false
|
56
50
|
requirements:
|
57
|
-
- - ~>
|
51
|
+
- - "~>"
|
58
52
|
- !ruby/object:Gem::Version
|
59
53
|
version: '2.9'
|
60
54
|
type: :development
|
61
55
|
prerelease: false
|
62
56
|
version_requirements: !ruby/object:Gem::Requirement
|
63
|
-
none: false
|
64
57
|
requirements:
|
65
|
-
- - ~>
|
58
|
+
- - "~>"
|
66
59
|
- !ruby/object:Gem::Version
|
67
60
|
version: '2.9'
|
68
|
-
description:
|
69
|
-
|
61
|
+
description: 'Configurable, but assumes a conservative strategy by default with a
|
62
|
+
goal to solve many search engine index problems: multiple hostnames, inbound links
|
70
63
|
with arbitrary parameters, trailing slashes. '
|
71
64
|
email:
|
72
65
|
- visible@jumph4x.net
|
@@ -74,39 +67,38 @@ executables: []
|
|
74
67
|
extensions: []
|
75
68
|
extra_rdoc_files: []
|
76
69
|
files:
|
70
|
+
- MIT-LICENSE
|
71
|
+
- README.md
|
72
|
+
- Rakefile
|
77
73
|
- app/helpers/canonical_rails/tag_helper.rb
|
78
74
|
- config/routes.rb
|
79
|
-
- lib/canonical-rails/version.rb
|
80
|
-
- lib/canonical-rails/engine.rb
|
81
75
|
- lib/canonical-rails.rb
|
82
|
-
- lib/
|
76
|
+
- lib/canonical-rails/engine.rb
|
77
|
+
- lib/canonical-rails/version.rb
|
83
78
|
- lib/generators/canonical_rails/install/install_generator.rb
|
84
79
|
- lib/generators/canonical_rails/install/templates/canonical_rails.rb
|
85
|
-
-
|
86
|
-
-
|
87
|
-
- README.md
|
88
|
-
homepage: http://jumph4x.net
|
80
|
+
- lib/tasks/canonical-rails_tasks.rake
|
81
|
+
homepage: https://github.com/jumph4x/canonical-rails
|
89
82
|
licenses: []
|
83
|
+
metadata: {}
|
90
84
|
post_install_message:
|
91
85
|
rdoc_options: []
|
92
86
|
require_paths:
|
93
87
|
- lib
|
94
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
-
none: false
|
96
89
|
requirements:
|
97
|
-
- -
|
90
|
+
- - ">="
|
98
91
|
- !ruby/object:Gem::Version
|
99
92
|
version: '0'
|
100
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
-
none: false
|
102
94
|
requirements:
|
103
|
-
- -
|
95
|
+
- - ">="
|
104
96
|
- !ruby/object:Gem::Version
|
105
97
|
version: '0'
|
106
98
|
requirements: []
|
107
99
|
rubyforge_project:
|
108
|
-
rubygems_version:
|
100
|
+
rubygems_version: 2.2.1
|
109
101
|
signing_key:
|
110
|
-
specification_version:
|
102
|
+
specification_version: 4
|
111
103
|
summary: Simple and configurable Rails canonical ref tag helper
|
112
104
|
test_files: []
|