canonical-rails 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/app/helpers/canonical_rails/tag_helper.rb +2 -1
- data/lib/canonical-rails.rb +0 -1
- data/lib/canonical-rails/version.rb +1 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6511d92cac533fd032b7224521b2fa01e98cba0b
|
4
|
+
data.tar.gz: cd7f3ca3ebe5966c7a991072d848c202b3542f14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c500d013292a55e102bd77c1d533939ca85061fa154cf6baaa372a428140e8a3a1f7b624762a07dc137bf2a3d9d113c2015ec83853b3b2e1baea2e2876c20de
|
7
|
+
data.tar.gz: f5f34a3b2ec60590f373395494eee62cd8196df87afe0d615068e10e25b6dba98bd3418f5e3603bc8d75acb5196c5eeb48388f48a36fd9994e89ebe3ddee19e3
|
data/README.md
CHANGED
@@ -3,14 +3,16 @@ CanonicalRails
|
|
3
3
|
[![Dependency Status](https://gemnasium.com/jumph4x/canonical-rails.png)](https://gemnasium.com/jumph4x/canonical-rails)
|
4
4
|
[![Build Status](https://travis-ci.org/jumph4x/canonical-rails.svg?branch=master)](https://travis-ci.org/jumph4x/canonical-rails)
|
5
5
|
|
6
|
-
This project rocks and uses MIT-LICENSE, foh sho. Works with rails 3 and 4.
|
7
|
-
|
8
6
|
A number of articles exist explaining the issue concisely and at length:
|
9
7
|
|
10
8
|
* [Google Webmaster Blog Page About Specifying Canonical](http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html)
|
11
9
|
* [Google Support About rel="canonical"](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139394)
|
12
10
|
* [Google Support About Canonicalization](http://support.google.com/webmasters/bin/answer.py?hl=en&answer=139066)
|
13
11
|
|
12
|
+
## Guide
|
13
|
+
|
14
|
+
Take a look at this blog post that can guide you through the idea and the setup: [Easily add canonical URLs to your Rails app](http://blog.planetargon.com/entries/2014/4/4/easily-add-canonical-urls-to-your-rails-app)
|
15
|
+
|
14
16
|
## Challenge
|
15
17
|
|
16
18
|
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.
|
@@ -25,7 +25,8 @@ module CanonicalRails
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def canonical_href(host = canonical_host, port = canonical_port)
|
28
|
-
|
28
|
+
default_ports = { 'https://' => 443, 'http://' => 80 }
|
29
|
+
port = port.present? && port.to_i != default_ports[canonical_protocol] ? ":#{port}" : ''
|
29
30
|
raw "#{canonical_protocol}#{host}#{port}#{path_without_html_extension}#{trailing_slash_if_needed}#{whitelisted_query_string}".downcase
|
30
31
|
end
|
31
32
|
|
data/lib/canonical-rails.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: canonical-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Denis Ivanov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '5.1'
|
@@ -26,10 +26,24 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '4.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '5.1'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: appraisal
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: sqlite3
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -50,14 +64,14 @@ dependencies:
|
|
50
64
|
requirements:
|
51
65
|
- - "~>"
|
52
66
|
- !ruby/object:Gem::Version
|
53
|
-
version: 3.
|
67
|
+
version: 3.5.0.beta3
|
54
68
|
type: :development
|
55
69
|
prerelease: false
|
56
70
|
version_requirements: !ruby/object:Gem::Requirement
|
57
71
|
requirements:
|
58
72
|
- - "~>"
|
59
73
|
- !ruby/object:Gem::Version
|
60
|
-
version: 3.
|
74
|
+
version: 3.5.0.beta3
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: pry
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|