mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-02 22:52:51 +02: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:
@@ -1,12 +0,0 @@
|
||||
package bundle
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNothing(t *testing.T) {
|
||||
b := NewTemplate()
|
||||
if b.Lookup("alias") == nil {
|
||||
t.Fatalf("Expecting alias to be initialized with new bundle")
|
||||
}
|
||||
}
|
@@ -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