mirror of
https://github.com/gohugoio/hugo.git
synced 2024-05-11 05:54:58 +00:00
Move alias logic to target module
I want to move all logic to writing aliases to target so I can pave the way for writing aliases specific to other runtimes (like .htaccess for apache or a script for updating AWS or symlinking on a filesystem).
This commit is contained in:
@@ -116,7 +116,6 @@ func NewTemplate() Template {
|
||||
}
|
||||
|
||||
templates.Funcs(funcMap)
|
||||
templates.primeTemplates()
|
||||
return templates
|
||||
}
|
||||
|
||||
@@ -145,14 +144,6 @@ func (t *GoHtmlTemplate) generateTemplateNameFrom(base, path string) string {
|
||||
return filepath.ToSlash(path[len(base)+1:])
|
||||
}
|
||||
|
||||
func (t *GoHtmlTemplate) 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.AddTemplate("alias", alias)
|
||||
t.AddTemplate("alias-xhtml", alias_xhtml)
|
||||
}
|
||||
|
||||
func ignoreDotFile(path string) bool {
|
||||
return filepath.Base(path)[0] == '.'
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user