@plugdash/sharepost

sharepost

260 words·2min read

What it does

On every publish, generates share URLs for Twitter/X, LinkedIn, WhatsApp, Bluesky, and email and writes them to post.data.metadata.shareUrls. Ships ShareButtons.astro with four variants. No third-party JavaScript, no tracking.

Install

npm install @plugdash/sharepost

Register

Open astro.config.mjs at the root of your Astro project. Import the plugin at the top, then add it to the plugins array of the emdash() integration - the one that sits inside Astro's top-level integrations array:

// astro.config.mjs
import { defineConfig } from "astro/config"
import emdash from "emdash/astro"
import { sharepostPlugin } from "@plugdash/sharepost"

export default defineConfig({
  integrations: [
    emdash({
      plugins: [
        sharepostPlugin({ via: "abhinavs" }),
      ],
    }),
  ],
})

The via option is your Twitter/X handle (without the @). It appears in the pre-filled tweet text.

Add the component

---
import ShareButtons from "@plugdash/sharepost/ShareButtons.astro"
---
<ShareButtons post={post} />

Live demo

Props

proptypedefaultdescription
postEmDash content itemRequired
variant"circle" | "pill" | "inline" | "minimal""circle"Visual style
platformsarray["twitter","linkedin","bluesky"]Which networks to show

CSS custom properties

tokendescription
--plugdash-share-gapSpace between buttons
--plugdash-share-paddingButton padding
--plugdash-share-radiusButton radius

For agents

After install, publish a post and verify post.data.metadata.shareUrls is an object with one URL per configured platform. The share URLs are pre-filled with the post title and canonical URL - no browser-side share SDK needed.

built with plugdash