mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-07 20:30:36 -05:00
18 lines
359 B
Go
18 lines
359 B
Go
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
|
|
}
|