1# p2c
2
3_Generate cover images from Hugo posts_
4
5## Usage
6
7- Clone the repository
8- Create a directory in the repository named `fonts`
9- Copy four OpenType font files into the directory
10 - `regular.otf`
11 - `italic.otf`
12 - `bold.otf`
13 - `bold-italic.otf`
14- Install the [go toolchain](https://go.dev/doc/install)
15- Run `go install .`
16 - This bundles your selected fonts into the binary
17- Run the tool from the root of your Hugo site (it also expects the site to be a
18 git repository)
19 - **Example:** `p2c -i content/posts/post.md -o public/post/cover.png`
20
21```
22❯ p2c -h
23
24Usage: p2c [options]
25
26Options:
27 -h, --help Show the help message
28 -i, --input string Path to input Markdown
29 -m, --metasize int Size of font for meta information (default 40)
30 -o, --output string Path to output PNG
31 -p, --posttitlesize int Size of font for post title (default 60)
32 -s, --sitetitlesize int Size of font for site title (default 50)
33
34example: p2c -i content/posts/post.md -o public/post/cover.png
35
36p2c is meant for use with Hugo.
37
38It looks at...
39- Markdown file's frontmatter fields for
40 - title
41 - date
42- Site's config.{toml/yaml/yml} fields for
43 - title (site title)
44- Git history to determine the date the post was last edited.
45```