1
0
mirror of https://github.com/gohugoio/hugo.git synced 2024-05-11 05:54:58 +00:00

Move alias rendering to target

This commit is contained in:
Noah Campbell
2013-09-12 16:17:53 -07:00
parent 74b55fc7c8
commit 2f10da1570
6 changed files with 155 additions and 26 deletions

18
target/htmlredirect.go Normal file
View File

@@ -0,0 +1,18 @@
package target
import (
helpers "github.com/spf13/hugo/template"
"path"
"strings"
)
type HTMLRedirectAlias struct {
PublishDir string
}
func (h *HTMLRedirectAlias) Translate(alias string) (aliasPath string, err error) {
if strings.HasSuffix(alias, "/") {
alias = alias + "index.html"
}
return path.Join(h.PublishDir, helpers.Urlize(alias)), nil
}