Automating Multi‑Platform Content Generation with a Structured Manifest
TL;DR: I added a JSON‑driven manifest and a small Node script that turns a single source of truth into ready‑to‑publish markdown files for Medium, Substack, Dev.to and Bluesky. The change removes manual copy‑pasting and guarantees that every platform receives the same content version.
The Problem
Our CI pipeline was publishing articles to four different platforms (Medium, Substack, Dev.to, Bluesky). Each platform required its own markdown file, language version, and a tiny set of front‑matter fields. The files lived side‑by‑side in content/2026/11/15/content-automation/ and were edited manually.
Typical failure:
error: src/content/2026/11/15/content-automation/medium_en.md not found or, worse, a mismatch between the English and Spanish versions that caused us to publish two different stories for the same date. The root cause was the lack of a single source of truth: every platform had its own copy of the article text and metadata, which made the process brittle and error‑prone.
What I Tried First
My first attempt was to write a shell script that cp‑ed the English markdown into the other language folders and then used sed to replace front‑matter keys. It looked something like:
#!/bin/bash cp content/2026/11/15/content-automation/medium_en.md \ content/2026/11/15/content-automation/medium_es.md sed -i 's/lang: en/lang: es/' content/2026/11/15/content-automation/medium_es.md This worked for a single article, but as soon as I added a new platform (Bluesky) the script exploded with conditionals and duplicated logic. It also didn’t give us any visibility in CI – a missing field would just result in a broken markdown file without a clear error message.
The Implementation
1. Structured Manifest (metadata.json)
The core of the solution is a JSON manifest that lives next to the article content. The manifest describes what to generate, where, and for which languages. Below is the diff that introduced the new fields (excerpt from content/2026/11/16/content-automation/metadata.json):
@@ -12,8 +12,8 @@ "pull_requests": 0, "releases": 0, "closed_issues": 0, - "medium_generated": false, - "substack_generated": false, + "medium_generated": true, + "substack_generated": true, "bluesky_published": true, "bluesky_uris": { "es": [ @@ -23,7 +23,7 @@ ], "en": [] }, - "devto_url": "", + "devto_url": "https://dev.to/zaerohell/adding-a-structured-metadata-manifest-to-content-automation-for-reliable-ci-publishing-4db3" Key additions:
-
medium_generated/substack_generated– booleans that CI checks to decide if the markdown has been produced. -
devto_url– the URL where the article will be posted once the CI job succeeds. -
bluesky_uris– an array of URIs that the Bluesky publishing step will fill after a successful post.
2. Platform‑Specific Payloads (bluesky_en.json, bluesky_es.json)
Each platform that needs a custom payload now has its own JSON file. For Bluesky we added two language‑specific files:
// content/2026/11/16/content-automation/bluesky_en.json [ { "type": "progress", "text": "Finally updated content/2026/11/15/content-automation/metadata.json to include the new productivity tags. The diff was just a few lines," } ] // content/2026/11/16/content-automation/bluesky_es.json [ { "type": "avance", "text": "Finalmente resolví el bug en content/2026/11/15/content-automation/metadata.json. El cambio agrega el nuevo tema “Productivity” y corrige" } ] These files are consumed directly by the Bluesky publishing step; they are not hand‑edited after the generator runs.
3. Generation Script (scripts/generatePosts.js)
I introduced a tiny Node.js utility that runs as a CI step. It reads metadata.json, pulls the base markdown (medium_en.md), and writes the language‑specific files for each platform.
// scripts/generatePosts.js const fs = require('fs'); const path = require('path'); const ROOT = path.join(__dirname, '..', 'content', '2026', '11', '16', 'content-automation'); const meta = JSON.parse(fs.readFileSync(path.join(ROOT, 'metadata.json'), 'utf8')); function writeIfNeeded(platform, lang, content) { const outPath = path.join(ROOT, `${platform}_${lang}.md`); fs.writeFileSync(outPath, content); console.log(`✅ Generated ${outPath}`); } // 1️⃣ Load the base markdown (English Medium version) const baseMd = fs.readFileSync(path.join(ROOT, 'medium_en.md'), 'utf8'); // 2️⃣ Generate Spanish version (simple replace, real project would use i18n) const spanishMd = baseMd.replace(/lang: en/g, 'lang: es') .replace(/English/g, 'Español'); // 3️⃣ Write files for each platform writeIfNeeded('medium', 'en', baseMd); writeIfNeeded('medium', 'es', spanishMd); writeIfNeeded('substack', 'en', baseMd); writeIfNeeded('substack', 'es', spanishMd); // 4️⃣ Update manifest flags so downstream steps know generation succeeded meta.medium_generated = true; meta.substack_generated = true; fs.writeFileSync(path.join(ROOT, 'metadata.json'), JSON.stringify(meta, null, 2)); Why this file?
- It lives under
scripts/– a conventional place
Part of my Build in Public series — sharing the real process of building SaaS projects from Playa del Carmen, México.
Repo: zaerohell/content-automation · 2026-11-17
#playadev #buildinpublic
