summaryrefslogtreecommitdiffstats
path: root/target/htmlredirect.go
blob: 3305e2921c8a28425a1aec71dfe53c67edffe1a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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
}