From 28d241980a2e7ec37e5e946724820c217eb89915 Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Mon, 10 May 2021 11:31:32 -0400 Subject: [PATCH] Expose path functions to permalinks --- config.go | 3 ++- config.toml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/config.go b/config.go index 518d990..c93860b 100644 --- a/config.go +++ b/config.go @@ -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 } diff --git a/config.toml b/config.toml index 13e468c..d71604a 100644 --- a/config.toml +++ b/config.toml @@ -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]]