From 23a98ad05cff0c284cf86f9716e202e7c94f4de9 Mon Sep 17 00:00:00 2001 From: Hugo Duncan Date: Fri, 16 Aug 2013 00:29:46 -0400 Subject: [PATCH] Enable aliases from .xhtml paths When redirecting an alias from a .xhtml path, served with default content type, a redirect only works if the html element has a xmlns attribute. This adds the attribute when the alias path ends in .xhtml --- hugolib/site.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hugolib/site.go b/hugolib/site.go index c0bce9f06..7b546f4a1 100644 --- a/hugolib/site.go +++ b/hugolib/site.go @@ -182,9 +182,13 @@ func (s *Site) generateTemplateNameFrom(path string) (name string) { func (s *Site) primeTemplates() { alias := "\n \n \n \n \n \n \n " + alias_xhtml := "\n \n \n \n \n \n \n " 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() { @@ -389,7 +393,11 @@ func (s *Site) BuildSiteMeta() (err error) { 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" }