summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Francia <steve.francia@gmail.com>2013-08-17 21:04:14 -0700
committerSteve Francia <steve.francia@gmail.com>2013-08-17 21:04:14 -0700
commite2744d403c8b81c4d33f6bc54f0905ddb793590a (patch)
tree5c17b451cc66e4b8c1221d779ed1dfe0997702d2
parent2542836bbc8f2595d69b59f6346334213a8781fb (diff)
parent23a98ad05cff0c284cf86f9716e202e7c94f4de9 (diff)
Merge pull request #43 from hugoduncan/feature/allow-xhtml-aliases
Enable aliases from .xhtml paths
-rw-r--r--hugolib/site.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/hugolib/site.go b/hugolib/site.go
index 2f565f8db..517c82dc3 100644
--- a/hugolib/site.go
+++ b/hugolib/site.go
@@ -184,9 +184,13 @@ func (s *Site) generateTemplateNameFrom(path string) (name string) {
func (s *Site) primeTemplates() {
alias := "<!DOCTYPE html>\n <html>\n <head>\n <link rel=\"canonical\" href=\"{{ .Permalink }}\"/>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n <meta http-equiv=\"refresh\" content=\"0;url={{ .Permalink }}\" />\n </head>\n </html>"
+ alias_xhtml := "<!DOCTYPE html>\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <link rel=\"canonical\" href=\"{{ .Permalink }}\"/>\n <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\n <meta http-equiv=\"refresh\" content=\"0;url={{ .Permalink }}\" />\n </head>\n </html>"
t := s.Tmpl.New("alias")
template.Must(t.Parse(alias))
+
+ t = s.Tmpl.New("alias-xhtml")
+ template.Must(t.Parse(alias_xhtml))
}
func (s *Site) initialize() {
@@ -415,7 +419,11 @@ func inStringArray(arr []string, el string) bool {
func (s *Site) RenderAliases() error {
for i, p := range s.Pages {
for _, a := range p.Aliases {
- content, err := s.RenderThing(s.Pages[i], "alias")
+ t := "alias";
+ if strings.HasSuffix(a, ".xhtml") {
+ t = "alias-xhtml"
+ }
+ content, err := s.RenderThing(s.Pages[i], t)
if strings.HasSuffix(a, "/") {
a = a + "index.html"
}