jekyll-redirect-from 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/History.markdown +14 -0
- data/README.md +28 -7
- data/jekyll-redirect-from.gemspec +1 -1
- data/lib/jekyll-redirect-from/redirect_page.rb +6 -14
- data/lib/jekyll-redirect-from/version.rb +1 -1
- data/spec/jekyll_redirect_from/redirect_page_spec.rb +5 -5
- data/spec/spec_helper.rb +1 -1
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 112381245761df69cddfd8b8c7d67755d6037cd8
|
4
|
+
data.tar.gz: fcd9362806dba6253fa56680db4142b1b401f996
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40503272424d63e5baf7df133bada0382c3cd4478c16d41671b4201a311e74537a0690259d86b30b22bd22a613c7ceda4d4fdce9dd0f38825b2b2e6d07924f38
|
7
|
+
data.tar.gz: 65ed493e7b3a3e34c6c86da859f3626460ae8e4f477de5e984d27b135458e9f5c6a9df9f8a8363fb8ccc276725ad1286a6b2c1a806e3605ccf8b0fb09a2ee1c2
|
data/History.markdown
CHANGED
@@ -8,6 +8,20 @@
|
|
8
8
|
|
9
9
|
### Development Fixes
|
10
10
|
|
11
|
+
## 0.4.0 / 2014-05-06
|
12
|
+
|
13
|
+
### Major Enhancements
|
14
|
+
|
15
|
+
* Upgrade to Jekyll 2.0 (#27)
|
16
|
+
|
17
|
+
### Minor Enhancements
|
18
|
+
|
19
|
+
* Shorten resulting HTML to make redirects quicker (#20)
|
20
|
+
|
21
|
+
### Development Fixes
|
22
|
+
|
23
|
+
* Use SVG Travis badge in README (#21)
|
24
|
+
|
11
25
|
## 0.3.1 / 2014-01-22
|
12
26
|
|
13
27
|
### Bug Fixes
|
data/README.md
CHANGED
@@ -3,13 +3,13 @@
|
|
3
3
|
Give your Jekyll posts and pages multiple URLs.
|
4
4
|
|
5
5
|
When importing your posts and pages from, say, Tumblr, it's annoying and
|
6
|
-
impractical to create new pages in the proper subdirectories so they, e.g.
|
6
|
+
impractical to create new pages in the proper subdirectories so they, e.g.
|
7
7
|
`/post/123456789/my-slug-that-is-often-incompl`, redirect to the new post URL.
|
8
8
|
|
9
9
|
Instead of dealing with maintaining those pages for redirection, let
|
10
10
|
`jekyll-redirect-from` handle it for you.
|
11
11
|
|
12
|
-
[![Build Status](https://travis-ci.org/jekyll/jekyll-redirect-from.
|
12
|
+
[![Build Status](https://travis-ci.org/jekyll/jekyll-redirect-from.svg?branch=master)](https://travis-ci.org/jekyll/jekyll-redirect-from)
|
13
13
|
|
14
14
|
## Installation
|
15
15
|
|
@@ -35,31 +35,52 @@ gems:
|
|
35
35
|
## Usage
|
36
36
|
|
37
37
|
The object of this gem is to allow an author to specify multiple URLs for a
|
38
|
-
page, such that the alternative URLs redirect to the new Jekyll URL. This is
|
38
|
+
page, such that the alternative URLs redirect to the new Jekyll URL. This is
|
39
39
|
|
40
40
|
To use it, simply add the array to the YAML front-matter of your page or post:
|
41
41
|
|
42
42
|
```yaml
|
43
43
|
title: My amazing post
|
44
44
|
redirect_from:
|
45
|
-
- /post/123456789
|
45
|
+
- /post/123456789/
|
46
|
+
- /post/123456789/my-amazing-post/
|
47
|
+
```
|
48
|
+
|
49
|
+
Redirects including a trailing slash will generate a corresponding subdirectory containing an `index.html`, while redirects without a trailing slash will generate a corresponding `filename` without an extension, and without a subdirectory.
|
50
|
+
|
51
|
+
For example...
|
52
|
+
|
53
|
+
```text
|
54
|
+
redirect_from:
|
46
55
|
- /post/123456789/my-amazing-post
|
47
56
|
```
|
48
57
|
|
49
|
-
|
58
|
+
...will generate the following page in the destination:
|
50
59
|
|
51
60
|
```text
|
52
|
-
/post/123456789
|
53
61
|
/post/123456789/my-amazing-post
|
54
62
|
```
|
55
63
|
|
64
|
+
While...
|
65
|
+
|
66
|
+
```text
|
67
|
+
redirect_from:
|
68
|
+
- /post/123456789/my-amazing-post/
|
69
|
+
```
|
70
|
+
|
71
|
+
...will generate the following page in the destination:
|
72
|
+
|
73
|
+
```text
|
74
|
+
/post/123456789/my-amazing-post/index.html
|
75
|
+
```
|
76
|
+
|
56
77
|
These pages will contain an HTTP-REFRESH meta tag which redirect to your URL.
|
57
78
|
|
58
79
|
You can also specify just **one url** like this:
|
59
80
|
|
60
81
|
```text
|
61
82
|
title: My other awesome post
|
62
|
-
redirect_from: /post/123456798
|
83
|
+
redirect_from: /post/123456798/
|
63
84
|
```
|
64
85
|
|
65
86
|
## Contributing
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_runtime_dependency "jekyll", "~>
|
21
|
+
spec.add_runtime_dependency "jekyll", "~> 2.0"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.3"
|
24
24
|
spec.add_development_dependency "rake"
|
@@ -19,21 +19,13 @@ module JekyllRedirectFrom
|
|
19
19
|
def generate_redirect_content(item_url)
|
20
20
|
self.output = self.content = <<-EOF
|
21
21
|
<!DOCTYPE html>
|
22
|
-
<
|
23
|
-
<head>
|
22
|
+
<meta charset=utf-8>
|
24
23
|
<title>Redirecting...</title>
|
25
|
-
<link rel=
|
26
|
-
<meta http-equiv=
|
27
|
-
<
|
28
|
-
|
29
|
-
<
|
30
|
-
<p><strong>Redirecting...</strong></p>
|
31
|
-
<p><a href='#{item_url}'>Click here if you are not redirected.</a></p>
|
32
|
-
<script>
|
33
|
-
document.location.href = "#{item_url}";
|
34
|
-
</script>
|
35
|
-
</body>
|
36
|
-
</html>
|
24
|
+
<link rel=canonical href="#{item_url}">
|
25
|
+
<meta http-equiv=refresh content="0; url=#{item_url}">
|
26
|
+
<h1>Redirecting...</h1>
|
27
|
+
<a href="#{item_url}">Click here if you are not redirected.</a>
|
28
|
+
<script>location='#{item_url}'</script>
|
37
29
|
EOF
|
38
30
|
end
|
39
31
|
end
|
@@ -8,23 +8,23 @@ describe JekyllRedirectFrom::RedirectPage do
|
|
8
8
|
|
9
9
|
context "#generate_redirect_content" do
|
10
10
|
it "sets the #content to the generated refresh page" do
|
11
|
-
expect(page_content).to eq(" <!DOCTYPE html>\n <
|
11
|
+
expect(page_content).to eq(" <!DOCTYPE html>\n <meta charset=utf-8>\n <title>Redirecting...</title>\n <link rel=canonical href=\"#{item_url}\">\n <meta http-equiv=refresh content=\"0; url=#{item_url}\">\n <h1>Redirecting...</h1>\n <a href=\"#{item_url}\">Click here if you are not redirected.</a>\n <script>location='#{item_url}'</script>\n")
|
12
12
|
end
|
13
13
|
|
14
14
|
it "contains the meta refresh tag" do
|
15
|
-
expect(page_content).to include("<meta http-equiv
|
15
|
+
expect(page_content).to include("<meta http-equiv=refresh content=\"0; url=#{item_url}\">")
|
16
16
|
end
|
17
17
|
|
18
18
|
it "contains JavaScript redirect" do
|
19
|
-
expect(page_content).to include("
|
19
|
+
expect(page_content).to include("location='http://jekyllrb.com/2014/01/03/moving-to-jekyll.md'")
|
20
20
|
end
|
21
21
|
|
22
22
|
it "contains canonical link in header" do
|
23
|
-
expect(page_content).to include("<link rel
|
23
|
+
expect(page_content).to include("<link rel=canonical href=\"http://jekyllrb.com/2014/01/03/moving-to-jekyll.md\">")
|
24
24
|
end
|
25
25
|
|
26
26
|
it "contains a clickable link to redirect" do
|
27
|
-
expect(page_content).to include("<a href
|
27
|
+
expect(page_content).to include("<a href=\"http://jekyllrb.com/2014/01/03/moving-to-jekyll.md\">Click here if you are not redirected.</a>")
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
data/spec/spec_helper.rb
CHANGED
@@ -12,7 +12,7 @@ RSpec.configure do |config|
|
|
12
12
|
end
|
13
13
|
|
14
14
|
config.before(:all) do
|
15
|
-
Jekyll.logger.log_level =
|
15
|
+
Jekyll.logger.log_level = :error
|
16
16
|
|
17
17
|
@fixtures_path = Pathname.new(__FILE__).parent.join("fixtures")
|
18
18
|
@dest = @fixtures_path.join("_site")
|
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-redirect-from
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Parker Moore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.0'
|
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: '
|
26
|
+
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
description: Seamlessly specify multiple redirection URLs for your pages and posts
|
@@ -73,9 +73,9 @@ executables: []
|
|
73
73
|
extensions: []
|
74
74
|
extra_rdoc_files: []
|
75
75
|
files:
|
76
|
-
- .gitignore
|
77
|
-
- .rspec
|
78
|
-
- .travis.yml
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- ".travis.yml"
|
79
79
|
- Gemfile
|
80
80
|
- History.markdown
|
81
81
|
- LICENSE.txt
|
@@ -106,17 +106,17 @@ require_paths:
|
|
106
106
|
- lib
|
107
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- -
|
109
|
+
- - ">="
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
|
-
- -
|
114
|
+
- - ">="
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
118
|
rubyforge_project:
|
119
|
-
rubygems_version: 2.
|
119
|
+
rubygems_version: 2.2.2
|
120
120
|
signing_key:
|
121
121
|
specification_version: 4
|
122
122
|
summary: Seamlessly specify multiple redirection URLs for your pages and posts
|