From 35e6b7ca72581bd08b2cb1947054c37e9bbee0b7 Mon Sep 17 00:00:00 2001 From: Stuart Date: Sat, 21 Nov 2020 11:18:49 -0500 Subject: [PATCH 1/2] pass along anchors and parameters in URL to redirected page --- lib/jekyll-redirect-from/redirect.html | 15 ++++++++++++--- spec/jekyll_redirect_from/redirect_page_spec.rb | 6 +++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/jekyll-redirect-from/redirect.html b/lib/jekyll-redirect-from/redirect.html index 6640310..da075cc 100644 --- a/lib/jekyll-redirect-from/redirect.html +++ b/lib/jekyll-redirect-from/redirect.html @@ -3,9 +3,18 @@ Redirecting… - - + +

Redirecting…

- Click here if you are not redirected. + Click here if you are not redirected. + diff --git a/spec/jekyll_redirect_from/redirect_page_spec.rb b/spec/jekyll_redirect_from/redirect_page_spec.rb index b5af971..288af7f 100644 --- a/spec/jekyll_redirect_from/redirect_page_spec.rb +++ b/spec/jekyll_redirect_from/redirect_page_spec.rb @@ -49,11 +49,11 @@ end it "contains the meta refresh tag" do - expect(output).to match("") + expect(output).to match("") end it "contains the javascript redirect" do - expect(output).to match("") + expect(output).to match("") end it "contains canonical link in header" do @@ -61,7 +61,7 @@ end it "contains the clickable link" do - expect(output).to match("Click here if you are not redirected.") + expect(output).to match("Click here if you are not redirected.") end end end From d9b32c7beab89766ca7b0cb27dad9a985461cc9c Mon Sep 17 00:00:00 2001 From: Stuart Date: Sat, 21 Nov 2020 12:22:35 -0500 Subject: [PATCH 2/2] protect against possible location.hash or location.search undefined/null --- lib/jekyll-redirect-from/redirect.html | 10 +++++++--- spec/jekyll_redirect_from/redirect_page_spec.rb | 4 ---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/jekyll-redirect-from/redirect.html b/lib/jekyll-redirect-from/redirect.html index da075cc..3e6e148 100644 --- a/lib/jekyll-redirect-from/redirect.html +++ b/lib/jekyll-redirect-from/redirect.html @@ -3,18 +3,22 @@ Redirecting… - +

Redirecting…

Click here if you are not redirected. diff --git a/spec/jekyll_redirect_from/redirect_page_spec.rb b/spec/jekyll_redirect_from/redirect_page_spec.rb index 288af7f..8138fd2 100644 --- a/spec/jekyll_redirect_from/redirect_page_spec.rb +++ b/spec/jekyll_redirect_from/redirect_page_spec.rb @@ -52,10 +52,6 @@ expect(output).to match("") end - it "contains the javascript redirect" do - expect(output).to match("") - end - it "contains canonical link in header" do expect(output).to match("") end