diff options
author | Noah Campbell <noahcampbell@gmail.com> | 2013-09-13 03:17:53 +0400 |
---|---|---|
committer | Noah Campbell <noahcampbell@gmail.com> | 2013-09-13 03:18:30 +0400 |
commit | 2f10da15707e1db0fab90524a247bc8a2d3ded90 (patch) | |
tree | 0023014b3e3ce84d541afd017e1a3b72a251e4f1 /target/htmlredirect.go | |
parent | 74b55fc7c87f2887c42ce8626cb461fee5d7b907 (diff) |
Move alias rendering to target
Diffstat (limited to 'target/htmlredirect.go')
-rw-r--r-- | target/htmlredirect.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/target/htmlredirect.go b/target/htmlredirect.go new file mode 100644 index 000000000..3305e2921 --- /dev/null +++ b/target/htmlredirect.go @@ -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 +} |