diff options
author | Bjørn Erik Pedersen <[email protected]> | 2016-03-23 00:44:51 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2016-03-23 00:44:51 +0100 |
commit | 672890339efabf5a3f3b28f7d38c4a29277bc791 (patch) | |
tree | 5c18a2d3185bf94daa9dfe88c0ccd65fa3f6894f | |
parent | dc7d8a9eac43760b0cd4599312de9bff072fffd5 (diff) | |
download | hugo-672890339efabf5a3f3b28f7d38c4a29277bc791.tar.gz hugo-672890339efabf5a3f3b28f7d38c4a29277bc791.zip |
target: Fix some Golint warnings
-rw-r--r-- | target/htmlredirect.go | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/target/htmlredirect.go b/target/htmlredirect.go index 34e05cbad..b5b47a889 100644 --- a/target/htmlredirect.go +++ b/target/htmlredirect.go @@ -26,15 +26,15 @@ import ( 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 ALIAS_XHTML = "<!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><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>" -var DefaultAliasTemplates *template.Template +var defaultAliasTemplates *template.Template func init() { - DefaultAliasTemplates = template.New("") - template.Must(DefaultAliasTemplates.New("alias").Parse(ALIAS)) - template.Must(DefaultAliasTemplates.New("alias-xhtml").Parse(ALIAS_XHTML)) + defaultAliasTemplates = template.New("") + template.Must(defaultAliasTemplates.New("alias").Parse(alias)) + template.Must(defaultAliasTemplates.New("alias-xhtml").Parse(aliasXHtml)) } type AliasPublisher interface { @@ -96,10 +96,9 @@ func (h *HTMLRedirectAlias) Translate(alias string) (aliasPath string, err error jww.ERROR.Println(m) } return "", fmt.Errorf("Cannot create \"%s\": Windows filename restriction", originalAlias) - } else { - for _, m := range msgs { - jww.WARN.Println(m) - } + } + for _, m := range msgs { + jww.WARN.Println(m) } } @@ -134,7 +133,7 @@ func (h *HTMLRedirectAlias) Publish(path string, permalink string) (err error) { t = "alias-xhtml" } - template := DefaultAliasTemplates + template := defaultAliasTemplates if h.Templates != nil { template = h.Templates } |