mirror of
https://git.sr.ht/~adnano/kiln
synced 2024-10-30 01:13:08 +00:00
dir: Pass Date to templates
This commit is contained in:
parent
0a6d61eb5c
commit
5be3306c6d
16
dir.go
16
dir.go
|
@ -16,13 +16,14 @@ import (
|
|||
|
||||
// Dir represents a directory.
|
||||
type Dir struct {
|
||||
Title string // Directory title.
|
||||
Content string // Directory index content.
|
||||
Path string // Directory path.
|
||||
Pages []*Page // Pages in this directory.
|
||||
Dirs []*Dir // Subdirectories.
|
||||
index *Page // The index page.
|
||||
feed []byte // Atom feed.
|
||||
Title string
|
||||
Date time.Time
|
||||
Content string
|
||||
Path string
|
||||
Pages []*Page
|
||||
Dirs []*Dir
|
||||
index *Page // The index page.
|
||||
feed []byte // Atom feed.
|
||||
}
|
||||
|
||||
// NewDir returns a new Dir with the given path.
|
||||
|
@ -76,6 +77,7 @@ func (d *Dir) read(srcDir, path string, task *Task) error {
|
|||
if strings.TrimSuffix(name, ext) == "index" {
|
||||
d.index = NewPage(d.Path, content)
|
||||
d.Title = d.index.Title
|
||||
d.Date = d.index.Date
|
||||
d.Content = d.index.Content
|
||||
} else {
|
||||
d.Pages = append(d.Pages, NewPage(path, content))
|
||||
|
|
Loading…
Reference in a new issue