rack-canonical-header 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +26 -1
- data/lib/rack-canonical-header/middleware.rb +2 -0
- data/lib/rack-canonical-header/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 327b53d961290667f3ef172e3a520eecdef838b1e2823aeff10523c916703935
|
4
|
+
data.tar.gz: 9b1b4bc6cfe2ab6b3651f0bf9e8e2b45e784fc4e5ffbcfc8a8648e7996b647ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
+
```
|
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.
|
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
|
125
|
+
homepage: https://github.com/renuo/rack-canonical-header
|
126
126
|
licenses:
|
127
127
|
- MIT
|
128
128
|
metadata: {}
|