From a842c013b9fa044b720b32ee015fedcde3f24ab1 Mon Sep 17 00:00:00 2001 From: Gustavo Heinz Date: Thu, 31 Mar 2022 20:05:42 -0300 Subject: [PATCH] Expose page filename to templates --- page.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/page.go b/page.go index e02de78..c16ae3e 100644 --- a/page.go +++ b/page.go @@ -18,6 +18,7 @@ type Page struct { rawFilename string rawDirectory string URLPath string + Filename string Permalink string Content string Date time.Time @@ -47,6 +48,7 @@ func parsePage(filename string) *Page { } p.Content = string(b) p.rawDirectory, p.rawFilename = filepath.Split(filename) + p.Filename = p.rawFilename p.URLPath, _ = filepath.Rel(config.SourceDir, filename) p.Permalink = fetchPermalink(p.URLPath) p.Title = fetchTitle(b) -- 2.45.2