mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-10-30 01:13:08 +00:00
Add FilePath and Weight field to pages
This commit is contained in:
parent
bd19f7da83
commit
2a9691f947
18
dir.go
18
dir.go
|
@ -27,13 +27,15 @@ type Dir struct {
|
||||||
|
|
||||||
// Page represents a page.
|
// Page represents a page.
|
||||||
type Page struct {
|
type Page struct {
|
||||||
Title string
|
Title string
|
||||||
Date time.Time
|
Date time.Time
|
||||||
Path string `yaml:"-"`
|
Weight int
|
||||||
Content string `yaml:"-"`
|
Path string `yaml:"-"`
|
||||||
Params map[string]string
|
FilePath string `yaml:"-"`
|
||||||
Prev *Page `yaml:"-"`
|
Content string `yaml:"-"`
|
||||||
Next *Page `yaml:"-"`
|
Params map[string]string
|
||||||
|
Prev *Page `yaml:"-"`
|
||||||
|
Next *Page `yaml:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDir returns a new Dir with the given path.
|
// 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.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
|
||||||
|
|
Loading…
Reference in a new issue