about summary refs log tree commit diff stats
path: root/internal/builder
diff options
context:
space:
mode:
Diffstat (limited to 'internal/builder')
-rw-r--r--internal/builder/builder.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/internal/builder/builder.go b/internal/builder/builder.go
index a4e44c6..928e4df 100644
--- a/internal/builder/builder.go
+++ b/internal/builder/builder.go
@@ -14,6 +14,7 @@ import (
 	"website/internal/content"
 	"website/internal/log"
 	"website/internal/sitemap"
+	"website/internal/vcs"
 	"website/templates"
 
 	"github.com/a-h/templ"
@@ -22,15 +23,18 @@ import (
 )
 
 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
 
 func mkdirp(dirs ...string) error {
@@ -110,7 +114,11 @@ func build(ioConfig *IOConfig, config *config.Config) (*Result, error) {
 		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 @@ func build(ioConfig *IOConfig, config *config.Config) (*Result, error) {
 	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
 	}