Expose path functions to permalinks

This commit is contained in:
Adnan Maolood 2021-05-10 11:31:32 -04:00
parent d1ab0d1aae
commit 28d241980a
2 changed files with 3 additions and 2 deletions

View file

@ -50,7 +50,8 @@ func LoadConfig(path string) (*Config, error) {
// Parse permalinks
c.permalinks = map[string]*template.Template{}
for s := range c.Permalinks {
t, err := template.New("permalink " + s).Parse(c.Permalinks[s])
t := template.New(fmt.Sprintf("permalink %q", s)).Funcs(funcs)
_, err := t.Parse(c.Permalinks[s])
if err != nil {
return nil, err
}

View file

@ -9,7 +9,7 @@ urls = []
# Site permalinks
[permalinks]
"/" = '/{{.Date.Format "2006/01/02"}}{{.Path}}'
"/" = '/{{ .Date.Format "2006/01/02" }}/{{ path.Base .Path }}/'
# Site tasks
[[tasks]]