hugo/target/htmlredirect.go

19 lines
359 B
Go
Raw Normal View History

2013-09-12 19:17:53 -04:00
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
}