about summary refs log tree commit diff stats
path: root/internal/builder/builder.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/builder/builder.go')
-rw-r--r--internal/builder/builder.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/builder/builder.go b/internal/builder/builder.go
index 0d4b1fc..b6da17d 100644
--- a/internal/builder/builder.go
+++ b/internal/builder/builder.go
@@ -93,7 +93,7 @@ func joinSourcePath(src string) func(string) string {
 	}
 }
 
-func build(ioConfig *IOConfig, config *config.Config) (*Result, error) {
+func build(ioConfig *IOConfig, config *config.Config, log *log.Logger) (*Result, error) {
 	outDir := ioConfig.Destination
 	joinSource := joinSourcePath(ioConfig.Source)
 	log.Debug("output", "dir", outDir)
@@ -110,7 +110,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("content"),
+		InputDir:  "post",
+		OutputDir: outDir,
+	}, log.Named("content"))
 	if err != nil {
 		return nil, err
 	}
@@ -254,13 +258,9 @@ func build(ioConfig *IOConfig, config *config.Config) (*Result, error) {
 	return r, nil
 }
 
-func BuildSite(ioConfig *IOConfig, cfg *config.Config) (*Result, error) {
+func BuildSite(ioConfig *IOConfig, cfg *config.Config, log *log.Logger) (*Result, error) {
 	if cfg == nil {
-		var err error
-		cfg, err = config.GetConfig(ioConfig.Source)
-		if err != nil {
-			return nil, errors.WithMessage(err, "could not get config")
-		}
+		return nil, errors.New("config is nil")
 	}
 	cfg.InjectLiveReload = ioConfig.Development
 	compressFiles = !ioConfig.Development
@@ -268,5 +268,5 @@ func BuildSite(ioConfig *IOConfig, cfg *config.Config) (*Result, error) {
 	templates.Setup()
 	loadCSS(ioConfig.Source)
 
-	return build(ioConfig, cfg)
+	return build(ioConfig, cfg, log)
 }