No description
  • Go 87.1%
  • Earthly 12.9%
Find a file
2024-07-24 00:46:59 +02:00
vendor refactor: Adjust to my blogging needs 2023-11-08 01:02:02 +01:00
.gitignore refactor: Adjust to my blogging needs 2023-11-08 01:02:02 +01:00
Earthfile ci(earthly): Switch to version 0.8 2024-07-24 00:46:59 +02:00
go.mod feat: og-image-generator 2021-05-03 20:05:03 +05:30
go.sum feat: og-image-generator 2021-05-03 20:05:03 +05:30
main.go refactor: Adjust to my blogging needs 2023-11-08 01:02:02 +01:00
README.md feat: docs update 2021-05-04 19:55:40 +05:30
renovate.json Add renovate.json 2023-11-08 06:05:26 +00:00
Roboto-Bold.ttf refactor: Adjust to my blogging needs 2023-11-08 01:02:02 +01:00
Roboto-Regular.ttf refactor: Adjust to my blogging needs 2023-11-08 01:02:02 +01:00
white.png refactor: Adjust to my blogging needs 2023-11-08 01:02:02 +01:00

og image generator

Generate open graph images for you awesome blogs.

Disclaimer: This is created for my personal use but can be used in other projects with similar requirements.

The Problem

I wanted a solution that will automatically create open graph images for the posts I write in siddhant.codes. The goal was to take the yaml frontmatter from my posts, generate a png format image and store it in a certain directory, preferably ./src/assets/og/{og_output}.png.

The Solution

I created this cli program that does only one job from requirements stated above. It creates a beautiful png image based on the args passed to it.

Installation

The only way to get this program on your computer is by running:

go get github.com/siddhantk232/og-image-generator

This should work on windows computer also but I haven't tested it.

Usage

Run og-image-generator with no args and it will generate a sample png file named out.png in the current directory.

This is intended to be used as a git hook. See the sample-git-hook.sh for an example.

Options

-title

default: "Sample Post Title"

description: "Title text"

desc

default: "Description of the post in about 25 words. This string could be your og description also!"

description: "Description text"

date

default: "30 April 2021"

description: "Date text"

readtime

default: "4 min read"

description: "Reading time text"

out

default: "out.png"

description: "Name of the output file"

dpi

default: 72

description: "screen resolution in dots per inch"

TODO:

  • add font size arg (with max limit)
  • add font arg (currently uses Montsterrat only)
  • add more background patterns