all repos — website @ 6c4a3268bc4c528ecff45f50ed5ca6aa1d48500c

My website

wip

Alan Pearce
commit

6c4a3268bc4c528ecff45f50ed5ca6aa1d48500c

parent

b4095d108a2646bcf9e7fff64788b10d9bce8da3

1 file changed, 13 insertions(+), 5 deletions(-)

changed files
M internal/builder/builder.gointernal/builder/builder.go
@@ -14,6 +14,7 @@ "website/internal/config"
"website/internal/content" "website/internal/log" "website/internal/sitemap" + "website/internal/vcs" "website/templates" "github.com/a-h/templ"
@@ -22,14 +23,17 @@ "github.com/pkg/errors"
) type IOConfig struct { - Source string `conf:"default:.,short:s,flag:src"` - Destination string `conf:"default:public,short:d,flag:dest"` - Development bool `conf:"default:false,flag:dev"` + Source string `conf:"default:.,short:s,flag:src"` + Destination string `conf:"default:public,short:d,flag:dest"` + Development bool `conf:"default:false,flag:dev"` + Repository *vcs.Repository `conf:"-"` } type Result struct { Hashes []string } + +const ContentRoot = "content" var compressFiles = false
@@ -110,7 +114,11 @@ if err := mkdirp(outDir, "post"); err != nil {
return nil, errors.WithMessage(err, "could not create post output directory") } log.Debug("reading posts") - posts, tags, err := content.ReadPosts(joinSource("content"), "post", outDir) + posts, tags, err := content.ReadPosts(&content.Config{ + Root: joinSource(ContentRoot), + InputDir: "post", + OutputDir: outDir, + }) if err != nil { return nil, err }
@@ -219,7 +227,7 @@ }
r.Hashes = append(r.Hashes, h) log.Debug("rendering homepage") - _, text, err := content.GetPost(joinSource(filepath.Join("content", "index.md"))) + _, text, err := content.GetPost(joinSource(filepath.Join(ContentRoot, "index.md"))) if err != nil { return nil, err }