diff options
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 +} |