From 2a9691f947439aaaf75b8ea5e4dd4c2bfa7a97fe Mon Sep 17 00:00:00 2001 From: adnano Date: Wed, 12 May 2021 16:21:06 -0400 Subject: [PATCH] Add FilePath and Weight field to pages --- dir.go | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dir.go b/dir.go index 322e6d8..36e83b1 100644 --- a/dir.go +++ b/dir.go @@ -27,13 +27,15 @@ type Dir struct { // Page represents a page. type Page struct { - Title string - Date time.Time - Path string `yaml:"-"` - Content string `yaml:"-"` - Params map[string]string - Prev *Page `yaml:"-"` - Next *Page `yaml:"-"` + Title string + Date time.Time + Weight int + Path string `yaml:"-"` + FilePath string `yaml:"-"` + Content string `yaml:"-"` + Params map[string]string + Prev *Page `yaml:"-"` + Next *Page `yaml:"-"` } // NewDir returns a new Dir with the given path. @@ -128,6 +130,8 @@ func (d *Dir) _read(srcDir, path string, task *Task, cfg *Config) error { } page.Content = string(content) + page.FilePath = path + if namePrefix == "_index" { page.Path = d.Path d.index = page