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:
18
target/htmlredirect.go
Normal file
18
target/htmlredirect.go
Normal 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
|
||||
}
|
||||
Reference in New Issue
Block a user