Skip to content

Commit

Permalink
cmd/render, config: add chill files
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphaelPour committed Aug 8, 2023
1 parent 9a49bd2 commit c5675c8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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*

Expand Down
13 changes: 13 additions & 0 deletions cmd/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
}
Expand Down
13 changes: 7 additions & 6 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit c5675c8

Please sign in to comment.