forked from jekyll/jekyll-redirect-from
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Stuart <[email protected]> Co-authored-by: Chris Buckley <[email protected]>
- Loading branch information
1 parent
6a751b2
commit 66e12c5
Showing
2 changed files
with
39 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,40 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-US"> | ||
<meta charset="utf-8"> | ||
<title>Redirecting…</title> | ||
<link rel="canonical" href="{{ page.redirect.to }}"> | ||
<script>location="{{ page.redirect.to }}"</script> | ||
<meta http-equiv="refresh" content="0; url={{ page.redirect.to }}"> | ||
<meta name="robots" content="noindex"> | ||
<h1>Redirecting…</h1> | ||
<a href="{{ page.redirect.to }}">Click here if you are not redirected.</a> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Redirecting…</title> | ||
<link rel="canonical" href="{{ page.redirect.to }}" /> | ||
<script> | ||
const urlSuffix = | ||
"" + | ||
(location.hash ? location.hash : "") + | ||
(location.search ? location.search : ""); | ||
location = "{{ page.redirect.to }}" + urlSuffix; | ||
</script> | ||
<meta | ||
id="refresh-meta" | ||
http-equiv="refresh" | ||
content="0; url={{ page.redirect.to }}" | ||
/> | ||
<meta name="robots" content="noindex" /> | ||
</head> | ||
<body> | ||
<h1>Redirecting…</h1> | ||
<a id="redirect-link" href="{{ page.redirect.to }}" | ||
>Click here if you are not redirected.</a | ||
> | ||
<script> | ||
// Add hash and search to meta redirect and manual link, in case script above did not work | ||
const urlSuffix2 = | ||
"" + | ||
(location.hash ? location.hash : "") + | ||
(location.search ? location.search : ""); | ||
let refreshMeta = document.getElementById("refresh-meta"); | ||
const newContentStr = refreshMeta.getAttribute("content") + urlSuffix2; | ||
refreshMeta.setAttribute("content", newContentStr); | ||
let redirectLink = document.getElementById("redirect-link"); | ||
const newHrefUrl = redirectLink.getAttribute("href") + urlSuffix2; | ||
redirectLink.setAttribute("href", newHrefUrl); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters