shithub: hugo

Download patch

ref: 5d3aabcb32f33715eddb378f12541c7c412ee261
parent: 75deb923d9feb8a2d92b2ed25af7426af6e7cc21
author: Marvin Pinto <[email protected]>
date: Mon Mar 7 10:05:51 EST 2016

Update the alias generated HTML files to conform to the W3C HTML spec

- W3C recommends that there be a [whitespace character][1] between the
`;` and the `url=` portions.

- W3C also recommends that there be a [title][2] child in the `head`
element

[1]: https://www.w3.org/TR/html-markup/meta.http-equiv.refresh.html
[2]: https://www.w3.org/TR/html-markup/head.html

Closes #1933

--- a/docs/content/extras/aliases.md
+++ b/docs/content/extras/aliases.md
@@ -72,9 +72,10 @@
 <!DOCTYPE html>
 <html>
   <head>
+    <title>http://mysite.tld/posts/my-original-url</title>
     <link rel="canonical" href="http://mysite.tld/posts/my-original-url"/>
     <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-    <meta http-equiv="refresh" content="0;url=http://mysite.tld/posts/my-original-url"/>
+    <meta http-equiv="refresh" content="0; url=http://mysite.tld/posts/my-original-url"/>
   </head>
 </html>
 ```
--- a/target/htmlredirect.go
+++ b/target/htmlredirect.go
@@ -26,8 +26,8 @@
 	jww "github.com/spf13/jwalterweatherman"
 )
 
-const alias = "<!DOCTYPE html><html><head><link rel=\"canonical\" href=\"{{ .Permalink }}\"/><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /><meta http-equiv=\"refresh\" content=\"0;url={{ .Permalink }}\" /></head></html>"
-const aliasXHtml = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><link rel=\"canonical\" href=\"{{ .Permalink }}\"/><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /><meta http-equiv=\"refresh\" content=\"0;url={{ .Permalink }}\" /></head></html>"
+const alias = "<!DOCTYPE html><html><head><title>{{ .Permalink }}</title><link rel=\"canonical\" href=\"{{ .Permalink }}\"/><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /><meta http-equiv=\"refresh\" content=\"0; url={{ .Permalink }}\" /></head></html>"
+const aliasXHtml = "<!DOCTYPE html><html xmlns=\"http://www.w3.org/1999/xhtml\"><head><title>{{ .Permalink }}</title><link rel=\"canonical\" href=\"{{ .Permalink }}\"/><meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" /><meta http-equiv=\"refresh\" content=\"0; url={{ .Permalink }}\" /></head></html>"
 
 var defaultAliasTemplates *template.Template