Add FilePath and Weight field to pages

This commit is contained in:
adnano 2021-05-12 16:21:06 -04:00
parent bd19f7da83
commit 2a9691f947

4
dir.go
View file

@ -29,7 +29,9 @@ type Dir struct {
type Page struct { type Page struct {
Title string Title string
Date time.Time Date time.Time
Weight int
Path string `yaml:"-"` Path string `yaml:"-"`
FilePath string `yaml:"-"`
Content string `yaml:"-"` Content string `yaml:"-"`
Params map[string]string Params map[string]string
Prev *Page `yaml:"-"` Prev *Page `yaml:"-"`
@ -128,6 +130,8 @@ func (d *Dir) _read(srcDir, path string, task *Task, cfg *Config) error {
} }
page.Content = string(content) page.Content = string(content)
page.FilePath = path
if namePrefix == "_index" { if namePrefix == "_index" {
page.Path = d.Path page.Path = d.Path
d.index = page d.index = page