rack-canonical-header 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a2d22d823f08b477a257089f36a0847de6d2b2faefae85f203afdc8a98bde02
4
- data.tar.gz: 98381e2a9cb18e50dd9ca3b6408a8e68815877a125be901cb03ab5001abc6a40
3
+ metadata.gz: 327b53d961290667f3ef172e3a520eecdef838b1e2823aeff10523c916703935
4
+ data.tar.gz: 9b1b4bc6cfe2ab6b3651f0bf9e8e2b45e784fc4e5ffbcfc8a8648e7996b647ae
5
5
  SHA512:
6
- metadata.gz: f605ff888c956625e3df737478740c67369330f420e5085cb0d790715deb75e278f98408510afbd7071bcb4db0e278abeafbcee0be5392d632b409665f644dee
7
- data.tar.gz: 70c1577a139d55e5a153fb61402f6edbc3faa18ac3c214b22faa743971bb41425cc6a77c6dbba6f83dfd533f2abe911c9540698c3148c853fcf7ab435f35ad9e
6
+ metadata.gz: 9d8475fbddca0a0e95e485f278a8d5f5adebd84ff367a7f500f6aa1bcf41d01f5f32c5db45ad13178b77eaa0aea1a8b132554506e0066283c94f57df14359bef
7
+ data.tar.gz: 632225ba447529878b0abda0bb7aae0725f790b14c576f343c1a7483071bf5adbabfc23680fb154b47c25043d367bbfd9bded51bd7e7449e7fbc6acd5ce01536
data/README.md CHANGED
@@ -23,10 +23,35 @@ And then execute `bundle install`
23
23
 
24
24
  ## Usage
25
25
 
26
- Set the `CANONICAL_HOST` env variable
26
+ Set the `CANONICAL_HOST` env variable to the desired host
27
+ (i.e. set it to the domain of your website like `CANONICAL_HOST=example.com`)
28
+
29
+ The gem will inject a header of the format
30
+ `Link: <http[s]://CANONICAL_HOST[/path]>; rel=canonical` as soon as the env is present.
31
+ The path and the scheme will be replaced
32
+ with what was requested on the original domain.
33
+
34
+ Note that the gem does *no* redirects.
35
+ Therefore, your non-canonical urls will still work if you access them directly.
36
+ However, search engines will not list them.
27
37
 
28
38
  ### Non-Rails frameworks
29
39
 
30
40
  If you're using a framework which uses Rack (like Hanami)
31
41
  you have to require and insert the middleware
32
42
  `Canonical::Middleware` manually into the rack stack.
43
+
44
+ For example:
45
+
46
+ ```ruby
47
+ require 'rack/auth/basic'
48
+ require 'rack-canonical-header'
49
+
50
+ module Web
51
+ class Application < Hanami::Application
52
+ configure do
53
+ middleware.use Canonical::Middleware
54
+ end
55
+ end
56
+ end
57
+ ```
@@ -20,6 +20,8 @@ module Canonical
20
20
  "<#{canonical}>; rel=\"canonical\""
21
21
  end
22
22
 
23
+ private
24
+
23
25
  def html?
24
26
  @headers['Content-Type'] =~ /html/
25
27
  end
@@ -1,3 +1,3 @@
1
1
  module Canonical
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-canonical-header
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Bischof
@@ -122,7 +122,7 @@ files:
122
122
  - lib/rack-canonical-header/middleware.rb
123
123
  - lib/rack-canonical-header/rails.rb
124
124
  - lib/rack-canonical-header/version.rb
125
- homepage: https://renuo.ch
125
+ homepage: https://github.com/renuo/rack-canonical-header
126
126
  licenses:
127
127
  - MIT
128
128
  metadata: {}