From 8e8b59182ad9ea5314b2c9e1384e7c300fbd065f Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 8 Jan 2022 18:33:05 -0800 Subject: [PATCH] Update for new goldsmith --- basic/content/layouts/basic.gohtml | 6 +- basic/main.go | 18 ++-- bootstrap/content/layouts/breadcrumbs.gohtml | 14 +-- bootstrap/content/layouts/cloud.gohtml | 4 +- bootstrap/content/layouts/collection.gohtml | 6 +- bootstrap/content/layouts/content.gohtml | 18 ++-- bootstrap/content/layouts/github.gohtml | 4 +- bootstrap/content/layouts/outer.gohtml | 12 +-- bootstrap/main.go | 4 +- go.mod | 8 +- go.sum | 98 ++++++++++---------- 11 files changed, 98 insertions(+), 94 deletions(-) diff --git a/basic/content/layouts/basic.gohtml b/basic/content/layouts/basic.gohtml index ae3aaf3..bba98de 100644 --- a/basic/content/layouts/basic.gohtml +++ b/basic/content/layouts/basic.gohtml @@ -3,7 +3,7 @@ - {{.Meta.Title}} + {{.Props.Title}} {{end}} @@ -15,7 +15,7 @@ {{define "page"}} {{template "header" .}} -

{{.Meta.Title}}

- {{.Meta.Content}} +

{{.Props.Title}}

+ {{.Props.Content}} {{template "footer" .}} {{end}} diff --git a/basic/main.go b/basic/main.go index d636ca7..37f07c2 100644 --- a/basic/main.go +++ b/basic/main.go @@ -17,16 +17,16 @@ type builder struct { dist bool } -func (b *builder) Build(srcDir, dstDir, cacheDir string) { +func (self *builder) Build(srcDir, dstDir, cacheDir string) { errs := goldsmith. - Begin(srcDir). // read files from srcDir - Chain(frontmatter.New()). // extract frontmatter and store it as metadata - Chain(markdown.New()). // convert *.md files to *.html files - Chain(layout.New()). // apply *.gohtml templates to *.html files - FilterPush(condition.New(b.dist)). // push a dist-only conditional filter onto the stack - Chain(minify.New()). // minify *.html, *.css, *.js, etc. files - FilterPop(). // pop off the last filter pushed onto the stack - End(dstDir) // write files to dstDir + Begin(srcDir). // read files from srcDir + Chain(frontmatter.New()). // extract frontmatter and store it as metadata + Chain(markdown.New()). // convert *.md files to *.html files + Chain(layout.New()). // apply *.gohtml templates to *.html files + FilterPush(condition.New(self.dist)). // push a dist-only conditional filter onto the stack + Chain(minify.New()). // minify *.html, *.css, *.js, etc. files + FilterPop(). // pop off the last filter pushed onto the stack + End(dstDir) // write files to dstDir for _, err := range errs { log.Print(err) diff --git a/bootstrap/content/layouts/breadcrumbs.gohtml b/bootstrap/content/layouts/breadcrumbs.gohtml index 61e183c..a149031 100644 --- a/bootstrap/content/layouts/breadcrumbs.gohtml +++ b/bootstrap/content/layouts/breadcrumbs.gohtml @@ -1,14 +1,14 @@ {{define "breadcrumbs"}} -{{if and .Meta.CrumbParent .Meta.Crumbs}} +{{if and .Props.CrumbParent .Props.Crumbs}}
diff --git a/bootstrap/content/layouts/cloud.gohtml b/bootstrap/content/layouts/cloud.gohtml index 517f584..a0a4558 100644 --- a/bootstrap/content/layouts/cloud.gohtml +++ b/bootstrap/content/layouts/cloud.gohtml @@ -1,7 +1,7 @@ {{define "cloud"}} -{{if .Meta.TagState.CurrentTags}} +{{if .Props.TagState.CurrentTags}}
- {{range .Meta.TagState.CurrentTags}} + {{range .Props.TagState.CurrentTags}} {{.RawName}} {{end}}
diff --git a/bootstrap/content/layouts/collection.gohtml b/bootstrap/content/layouts/collection.gohtml index 33db243..9b106e6 100644 --- a/bootstrap/content/layouts/collection.gohtml +++ b/bootstrap/content/layouts/collection.gohtml @@ -2,11 +2,11 @@ {{template "header" .}} {{template "navbar" .}}
- {{range .Meta.Groups.Blog}} + {{range .Props.Groups.Blog}}
-

{{.Meta.Title}}

+

{{.Props.Title}}

- {{.Meta.Summary}} + {{.Props.Summary}}

diff --git a/bootstrap/content/layouts/content.gohtml b/bootstrap/content/layouts/content.gohtml index 9a0ecbc..657e817 100644 --- a/bootstrap/content/layouts/content.gohtml +++ b/bootstrap/content/layouts/content.gohtml @@ -4,14 +4,14 @@ {{template "github" .}}

- {{.Meta.Title}} - {{if .Meta.SubTitle}} - {{.Meta.SubTitle}} + {{.Props.Title}} + {{if .Props.SubTitle}} + {{.Props.SubTitle}} {{end}}

{{template "cloud" .}}
- {{.Meta.Content}} + {{.Props.Content}} {{template "breadcrumbs" .}}
{{template "footer" .}} @@ -21,11 +21,11 @@ {{template "header" .}} {{template "navbar" .}}
-

Tagged “{{.Meta.TagState.CurrentTag.RawName}}”

+

Tagged “{{.Props.TagState.CurrentTag.RawName}}”


{{template "breadcrumbs" .}} @@ -40,7 +40,7 @@

Tags


    - {{range .Meta.TagState.TagsByCount}} + {{range .Props.TagState.TagsByCount}}
  • {{.RawName}} ({{len .TaggedFiles}})
  • {{end}}
@@ -55,7 +55,7 @@

Index of /{{.Dir}}

    - {{range .Meta.Files}} + {{range .Props.Files}} {{if .IsDir}}{{end}}
  • {{.Name}}
  • {{if .IsDir}}
    {{end}} diff --git a/bootstrap/content/layouts/github.gohtml b/bootstrap/content/layouts/github.gohtml index 805d725..3a75ff8 100644 --- a/bootstrap/content/layouts/github.gohtml +++ b/bootstrap/content/layouts/github.gohtml @@ -1,7 +1,7 @@ {{define "github"}} -{{if .Meta.GitHub}} +{{if .Props.GitHub}}
    - + diff --git a/bootstrap/content/layouts/outer.gohtml b/bootstrap/content/layouts/outer.gohtml index 46ce2c3..cf292c9 100644 --- a/bootstrap/content/layouts/outer.gohtml +++ b/bootstrap/content/layouts/outer.gohtml @@ -9,11 +9,11 @@ - {{if .Meta.Title}} - Goldsmith Sample - {{.Meta.Title}} - {{else if eq .Meta.Layout "tag"}} - Goldsmith Sample - Tagged "{{.Meta.TagState.CurrentTag.RawName}}" - {{else if eq .Meta.Layout "index"}} + {{if .Props.Title}} + Goldsmith Sample - {{.Props.Title}} + {{else if eq .Props.Layout "tag"}} + Goldsmith Sample - Tagged "{{.Props.TagState.CurrentTag.RawName}}" + {{else if eq .Props.Layout "index"}} Goldsmith Sample - Index of /{{.Dir}} {{end}} @@ -25,7 +25,7 @@ Goldsmith Sample