Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add <html> tag and language #100

Merged
merged 1 commit into from
Jun 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/jekyll-redirect-from/redirect_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ def initialize(site, base, dir, name)
def generate_redirect_content(item_url)
self.output = self.content = <<-EOF
<!DOCTYPE html>
<html lang="en-US">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm ok if we add this. Could we terminate it on line 32?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jszwedko Did you consider using @benbalter's suggestion?

{{ site.lang | default: "en-US" }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@parkr I did, but since the text on the page is English (regardless of what the site language is), it felt like en-US was the best fit. Curious to hear any other thoughts about this though.

<meta charset="utf-8">
<title>Redirecting…</title>
<link rel="canonical" href="#{item_url}">
<meta http-equiv="refresh" content="0; url=#{item_url}">
<h1>Redirecting…</h1>
<a href="#{item_url}">Click here if you are not redirected.</a>
<script>location="#{item_url}"</script>
</html>
EOF
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/jekyll_redirect_from/redirect_page_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

context "#generate_redirect_content" do
it "sets the #content to the generated refresh page" do
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")
expect(page_content).to eq("<!DOCTYPE html>\n<html lang=\"en-US\">\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</html>\n")
end

it "contains the meta refresh tag" do
Expand Down