diff options
author | Alan Pearce | 2024-06-29 21:27:35 +0200 |
---|---|---|
committer | Alan Pearce | 2024-06-29 21:27:35 +0200 |
commit | 973fa31b6743a3ea84c86ab7671349cc70a69142 (patch) | |
tree | 4c583c8ef5e7a9117fe997a4f861ae7466fa0864 /internal/builder | |
parent | 7b82d3ef3e93c0c8efe489d6b11b30f092667bf2 (diff) | |
download | website-973fa31b6743a3ea84c86ab7671349cc70a69142.tar.lz website-973fa31b6743a3ea84c86ab7671349cc70a69142.tar.zst website-973fa31b6743a3ea84c86ab7671349cc70a69142.zip |
enable filtered debug logging via DEBUG="component.*"
Diffstat (limited to 'internal/builder')
-rw-r--r-- | internal/builder/builder.go | 18 |
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) } |