@plugdash/socialcard

Pure infrastructure

Every post gets a share image. Automatically.

320 words·2min read

Renders an Open Graph card for every published post - title, author, and date, in one of three templates. Uploads it and writes the URL to metadata.ogImage on publish. No design tool, no third-party image API, no manual export.

npm install @plugdash/socialcard
alphaGitHub
Share card rendered with the default template
default
Share card rendered with the minimal template
minimal
Share card rendered with the bold template
bold

Real output from renderCard, one card per built-in template.

Setup

  1. Install and register

    bash
    npm install @plugdash/socialcard
    js
    import { socialcardPlugin } from "@plugdash/socialcard"
    // in emdash plugins array:
    socialcardPlugin({ template: "bold" })

After this, every published post gets an OG card automatically. Existing posts need a republish to pick it up - socialcard only runs on content:afterSave.

It looks right. But it's yours to change.

Config options

optiontypedefaultdescription
template"default" | "minimal" | "bold""default"Card layout
widthnumber1200Card width in pixels
heightnumber630Card height in pixels
backgroundstring (hex)"#0f172a"Background colour
foregroundstring (hex)"#f8fafc"Text (and, on minimal, paper) colour
logostring (URL)Logo drawn in the top-left corner
fonts.titlestring (CSS font stack)system sansFont stack for the title line
fonts.bodystring (CSS font stack)system sansFont stack for the byline

Pairs well with

a card that actually represents the post makes sharepost's links worth clicking, and autobuild makes sure it's live within a minute of publish.

beta

Readers who want to share your work shouldn't have to work for it.

npm install @plugdash/sharepost
beta

Publish in the admin. Live in 60 seconds.

npm install @plugdash/autobuild
built with plugdash.dev