diff --git a/CHANGELOG.md b/CHANGELOG.md index 862c24a..d56cf20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * cmd/root: add go version and last commit sha to the --version build information * cmd/render: support opengraph tags for rich link preview * metadata: pretty render initial metadata + * cmd/render, config: add chill-files list containing arbitrary files that just get copied to the root of the output dir *Not released yet* diff --git a/cmd/render.go b/cmd/render.go index 8f83851..cef8bf9 100644 --- a/cmd/render.go +++ b/cmd/render.go @@ -285,6 +285,19 @@ var renderCmd = &cobra.Command{ return fmt.Errorf("Error writing rss.xml: %w", err) } + /* copy chill-files to output dir */ + for _, chillFile := range cfg.ChillFiles { + src := chillFile + if !filepath.IsAbs(src) { + src = filepath.Join(BlogPath, src) + } + dst := filepath.Join(OutPath, filepath.Base(src)) + if err := copyFile(src, dst); err != nil { + return fmt.Errorf("copy chill-file %s to %s failed: %w", src, dst, err) + } + fmt.Printf("copied chill-file %s to %s\n", src, dst) + } + return nil }, } diff --git a/internal/config/config.go b/internal/config/config.go index 505976f..3132d12 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -12,12 +12,13 @@ const ( ) type Config struct { - Version int `json:"version"` - Domain string `json:"domain"` - Author string `json:"author"` - Title string `json:"title"` - Description string `json:"description"` - Footer string `json:"footer"` + Version int `json:"version"` + Domain string `json:"domain"` + Author string `json:"author"` + Title string `json:"title"` + Description string `json:"description"` + ChillFiles []string `json:"chill-files"` + Footer string `json:"footer"` } func ConfigPath(postPath string) string {