The Social Preview Problem
Every time you publish a blog post, you need:
- An Open Graph image (1200×630px) for Twitter, Facebook, LinkedIn
- A link to share that's short and trackable
- A QR code for print or presentations
Doing this manually for every post wastes hours. Here's how to automate all three with free APIs.
Step 1: Auto-Generate OG Images
Instead of designing images in Canva, use a dynamic URL that generates them from your post title:
<meta property="og:image"
content="https://og.pandan.is/v1/og?title={{post.title}}&subtitle={{post.date}}&color=%230070f3" />Every post gets a unique, professionally styled preview image. Zero design work.
Step 2: Auto-Shorten Links
Before sharing on social media, create a short link that tracks clicks:
const response = await fetch('https://s.pandan.is/v1/shorten', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
url: `https://myblog.com/posts/${post.slug}`,
alias: post.slug
})
});
const { short_url } = await response.json();
// Share short_url on social mediaStep 3: Auto-Generate QR Codes
For presentations, print materials, or conference talks, generate a QR code linking to each post:
const qrUrl = `https://qr.pandan.is/v1/qr?data=${encodeURIComponent(shortUrl)}&size=400&format=png`;
// Use in print layout or slidesPutting It All Together: A GitHub Action
Here's a GitHub Action that runs after every blog deploy:
name: Social Media Automation
on:
push:
paths: ['content/posts/**']
jobs:
social:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate social assets
run: |
# For each new post, create short link + QR code
for post in $(git diff --name-only HEAD~1 content/posts/); do
TITLE=$(grep '^title:' "$post" | cut -d'"' -f2)
SLUG=$(basename "$post" .md)
# Shorten
curl -s -X POST https://s.pandan.is/v1/shorten \
-H 'Content-Type: application/json' \
-d "{\"url\":\"https://myblog.com/$SLUG\"}" \
> "social/${SLUG}-link.json"
# QR code
curl -s "https://qr.pandan.is/v1/qr?data=https://myblog.com/$SLUG&size=400" \
-o "social/${SLUG}-qr.png"
echo "Generated assets for: $TITLE"
doneCost: $0
All three APIs (OG Image, Link Shortener, QR Code) have generous free tiers:
- OG Images: Unlimited — no API key needed
- Short Links: 50/month free, $5/mo for 1,000
- QR Codes: 200/month free, no API key needed
For a blog publishing 4 posts per week, the free tier covers everything.
Get Started
Visit dev.pandan.is for interactive documentation and live demos of all APIs. Start automating your social media workflow today.