Skip to content

Commit 3cb05e8

Browse files
committed
Merge pull request #83 from ndarville/patch-1
Merge pull request 83
2 parents 5ca2ad9 + c5586e0 commit 3cb05e8

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

lib/jekyll-redirect-from/redirect_page.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ def initialize(site, base, dir, name)
1919
def generate_redirect_content(item_url)
2020
self.output = self.content = <<-EOF
2121
<!DOCTYPE html>
22-
<meta charset=utf-8>
22+
<meta charset="utf-8">
2323
<title>Redirecting...</title>
24-
<link rel=canonical href="#{item_url}">
25-
<meta http-equiv=refresh content="0; url=#{item_url}">
24+
<link rel="canonical" href="#{item_url}">
25+
<meta http-equiv="refresh" content="0; url=#{item_url}">
2626
<h1>Redirecting...</h1>
2727
<a href="#{item_url}">Click here if you are not redirected.</a>
28-
<script>location='#{item_url}'</script>
28+
<script>location="#{item_url}"</script>
2929
EOF
3030
end
3131
end

spec/jekyll_redirect_from/redirect_page_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,19 @@
88

99
context "#generate_redirect_content" do
1010
it "sets the #content to the generated refresh page" do
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")
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")
1212
end
1313

1414
it "contains the meta refresh tag" do
15-
expect(page_content).to include("<meta http-equiv=refresh content=\"0; url=#{item_url}\">")
15+
expect(page_content).to include("<meta http-equiv=\"refresh\" content=\"0; url=#{item_url}\">")
1616
end
1717

1818
it "contains JavaScript redirect" do
19-
expect(page_content).to include("location='http://jekyllrb.com/2014/01/03/moving-to-jekyll.md'")
19+
expect(page_content).to include("location=\"http://jekyllrb.com/2014/01/03/moving-to-jekyll.md\"")
2020
end
2121

2222
it "contains canonical link in header" do
23-
expect(page_content).to include("<link rel=canonical href=\"http://jekyllrb.com/2014/01/03/moving-to-jekyll.md\">")
23+
expect(page_content).to include("<link rel=\"canonical\" href=\"http://jekyllrb.com/2014/01/03/moving-to-jekyll.md\">")
2424
end
2525

2626
it "contains a clickable link to redirect" do

spec/jekyll_redirect_from/redirector_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@
6868

6969
it "generates the refresh page for the collection with one redirect_to url" do
7070
expect(@dest.join("articles", "redirect-somewhere-else-plz.html")).to exist
71-
expect(destination_doc_contents("articles", "redirect-somewhere-else-plz.html")).to include(%|<meta http-equiv=refresh content="0; url=http://www.zombo.com">|)
71+
expect(destination_doc_contents("articles", "redirect-somewhere-else-plz.html")).to include(%|<meta http-equiv="refresh" content="0; url=http://www.zombo.com">|)
7272
end
7373

7474
it "generates the refresh page for the page with one redirect_to url" do
7575
expect(destination_file_exists?("one_redirect_to.html")).to be_truthy
76-
expect(destination_file_contents("one_redirect_to.html")).to include(%|<meta http-equiv=refresh content="0; url=https://www.github.com">|)
76+
expect(destination_file_contents("one_redirect_to.html")).to include(%|<meta http-equiv="refresh" content="0; url=https://www.github.com">|)
7777
end
7878

7979
it "generates the refresh page for the page with multiple redirect_to urls" do
8080
expect(destination_file_exists?("multiple_redirect_tos.html")).to be_truthy
81-
expect(destination_file_contents("multiple_redirect_tos.html")).to include(%|<meta http-equiv=refresh content="0; url=https://www.jekyllrb.com">|)
81+
expect(destination_file_contents("multiple_redirect_tos.html")).to include(%|<meta http-equiv="refresh" content="0; url=https://www.jekyllrb.com">|)
8282
end
8383
end
8484

0 commit comments

Comments
 (0)