@post-cards/core
v1.0.0
Published
@post-cards/core is a small node library for generating OpenGraph images for social media sharing.
Downloads
2
Maintainers
Readme
post-cards 📬
@post-cards/core
is a small node library for generating OpenGraph images for social media sharing. 📬
What is OpenGraph?
Simply as opengraph.xyz describes:
Social networks and messaging apps use the Open Graph meta tags to display your website.
Getting Started
npm i @post-cards/core -D
import generate from '@post-cards/core'
import BasicTemplate from '@post-cards/basic-template'
await generate(
new BasicTemplate({
text: '#fff',
background: '#000',
accent: 'orange',
}),
[
{
output: 'media/home-page.png',
data: {
title: 'My great Home Page',
},
},
{
output: 'media/about-page.png',
data: {
title: 'My great About Page',
},
},
],
{
concurrency: 10,
...options,
}
)
Template override
Sometimes you might not want the same template for each item but still want to batch them together.
await generate(Template, [
{ output: 'media/first-image.jpg', data: {} },
{
output: 'media/second-image.jpg',
data: {},
options: { templateOveride: FancyTemplate },
},
])
Creating Templates
Creating template is an easy process, if you've ever worked with html canvas, creating templates should be a breeze, and we provide some utils to smooth out the process.
For more information: Templates
Contributting Guide
Some resources:
Our CONTRIBUTING.md to get started with setting up the repo.
Our CODE_OF_CONDUCT.md if you contribute i'd appreciate sticking to our code of conduct.