README.md

p2c

Generate cover images from Hugo posts

Usage

  • Clone the repository
  • Create a directory in the repository named fonts
  • Copy four OpenType font files into the directory
    • regular.otf
    • italic.otf
    • bold.otf
    • bold-italic.otf
  • Install the go toolchain
  • Run go install .
    • This bundles your selected fonts into the binary
  • Run the tool from the root of your Hugo site (it also expects the site to be a git repository)
    • Example: p2c -i content/posts/post.md -o public/post/cover.png
❯ p2c -h

Usage: p2c [options]

Options:
  -h, --help                Show the help message
  -i, --input string        Path to input Markdown
  -m, --metasize int        Size of font for meta information (default 40)
  -o, --output string       Path to output PNG
  -p, --posttitlesize int   Size of font for post title (default 60)
  -s, --sitetitlesize int   Size of font for site title (default 50)

example: p2c -i content/posts/post.md -o public/post/cover.png

p2c is meant for use with Hugo.

It looks at...
- Markdown file's frontmatter fields for
  - title
  - date
- Site's config.{toml/yaml/yml} fields for
  - title (site title)
- Git history to determine the date the post was last edited.