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.
|
// Dir represents a directory.
|
||||||
type Dir struct {
|
type Dir struct {
|
||||||
Title string // Directory title.
|
Title string
|
||||||
Content string // Directory index content.
|
Date time.Time
|
||||||
Path string // Directory path.
|
Content string
|
||||||
Pages []*Page // Pages in this directory.
|
Path string
|
||||||
Dirs []*Dir // Subdirectories.
|
Pages []*Page
|
||||||
index *Page // The index page.
|
Dirs []*Dir
|
||||||
feed []byte // Atom feed.
|
index *Page // The index page.
|
||||||
|
feed []byte // Atom feed.
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDir returns a new Dir with the given path.
|
// 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" {
|
if strings.TrimSuffix(name, ext) == "index" {
|
||||||
d.index = NewPage(d.Path, content)
|
d.index = NewPage(d.Path, content)
|
||||||
d.Title = d.index.Title
|
d.Title = d.index.Title
|
||||||
|
d.Date = d.index.Date
|
||||||
d.Content = d.index.Content
|
d.Content = d.index.Content
|
||||||
} else {
|
} else {
|
||||||
d.Pages = append(d.Pages, NewPage(path, content))
|
d.Pages = append(d.Pages, NewPage(path, content))
|
||||||
|
|
Loading…
Reference in a new issue