Short answer: Cross-posting Markdown to developer platforms should be boring and reversible. Validate front matter first, preview payloads with a dry-run, publish through official APIs, and record publish IDs so you never double-post. These patterns come from building local-first workflows like Article Pulse Crossposter—without inventing traffic metrics or “set and forget” marketing claims.
The real pain of multi-platform publishing
If you keep canonical articles in Git, hand-copying into Hashnode, dev.to, and a company blog is how typos and stale canonical URLs happen. Teams usually want:
- One Markdown source of truth
- The same title/description/tags mapped per platform
- A canonical URL that search engines understand
- A history of what was published where
- A way to not publish while testing
That is an automation problem, not a writing problem.
Architecture that stays local-first
A durable design looks like this:
content/*.md │ ▼ [Validator] front matter + required fields + tag limits │ ▼ [Adapter: Hashnode] [Adapter: dev.to] [Adapter: …] │ │ ▼ ▼ [Dry-run JSON] [Publish + response IDs] │ ▼ [Publication ledger] sqlite/json: slug → platform → remote_id → url Optional UI (Next.js or similar) can sit on top for non-CLI users. The core should still run headlessly for CI.
Front matter contracts beat vibes
Define the fields you actually need and reject posts that do not meet them.
from dataclasses import dataclass import frontmatter from pathlib import Path ALLOWED_TAGS = {"python", "playwright", "fastapi", "automation", "web-scraping", "api", "markdown", "devops"} @dataclass class ArticleMeta: title: str description: str tags: list[str] canonical_url: str | None published: bool = False def load_article(path: Path) -> tuple[ArticleMeta, str]: post = frontmatter.load(path) tags = [t.lower().strip() for t in post.get("tags", [])] meta = ArticleMeta( title=(post.get("title") or "").strip(), description=(post.get("description") or "").strip(), tags=tags, canonical_url=(post.get("canonical_url") or None), published=bool(post.get("published", False)), ) errors = [] if not meta.title: errors.append("title required") if not (50 <= len(meta.description) <= 160): errors.append("description should be ~50–160 characters for snippets") if not (1 <= len(meta.tags) <= 4): errors.append("provide 1–4 tags") if bad := [t for t in meta.tags if t not in ALLOWED_TAGS]: # example policy — swap for your taxonomy errors.append(f"unknown tags: {bad}") if errors: raise ValueError(f"{path}: " + "; ".join(errors)) return meta, post.content Platforms have different tag limits and naming rules (dev.to tags are lowercase and constrained). Normalize early.
Dry-run is not optional
A dry-run should build the exact payload you would send, print or save it, and stop.
import json from typing import Protocol class Publisher(Protocol): name: str def build_payload(self, meta: ArticleMeta, body: str) -> dict: ... def publish(self, payload: dict) -> dict: ... def cross_post(meta: ArticleMeta, body: str, publishers: list[Publisher], dry_run: bool = True) -> None: for pub in publishers: payload = pub.build_payload(meta, body) out = Path("dry-runs") / f"{slugify(meta.title)}.{pub.name}.json" out.parent.mkdir(exist_ok=True) out.write_text(json.dumps(payload, indent=2), encoding="utf-8") if dry_run: print(f"[dry-run] {pub.name} → {out}") continue if already_published(meta.title, pub.name): print(f"[skip] already on {pub.name}") continue result = pub.publish(payload) record_publication( title=meta.title, platform=pub.name, remote_id=str(result["id"]), url=result.get("url"), ) Operators learn to read the JSON before they ever send credentials into CI.
Adapter sketch: dev.to Articles API
Use the official API and a token stored in the environment—not in Git.
import os import requests class DevToPublisher: name = "devto" endpoint = "https://dev.to/api/articles" def build_payload(self, meta: ArticleMeta, body: str) -> dict: article = { "title": meta.title, "body_markdown": body, "published": meta.published, "tags": meta.tags[:4], } if meta.canonical_url: article["canonical_url"] = meta.canonical_url return {"article": article} def publish(self, payload: dict) -> dict: token = os.environ["DEVTO_API_KEY"] r = requests.post( self.endpoint, headers={ "api-key": token, "Content-Type": "application/json", "User-Agent": "ArticlePulse/1.0 (+https://www.induswebagency.com)", }, json=payload, timeout=60, ) r.raise_for_status() data = r.json() return {"id": data["id"], "url": data.get("url")} Hashnode’s GraphQL API differs in shape but not in discipline: build payload → dry-run → publish → store IDs. Keep one adapter per platform so rate-limit and error handling stay readable.
Duplicate protection with a ledger
The most expensive automation bug is publishing twice. Persist a ledger keyed by (canonical_slug or title, platform).
import sqlite3 def init_ledger(db_path: str = "publish_ledger.sqlite") -> sqlite3.Connection: conn = sqlite3.connect(db_path) conn.execute( """ CREATE TABLE IF NOT EXISTS publications ( title TEXT NOT NULL, platform TEXT NOT NULL, remote_id TEXT NOT NULL, url TEXT, published_at TEXT DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (title, platform) ) """ ) conn.commit() return conn def already_published(conn: sqlite3.Connection, title: str, platform: str) -> bool: row = conn.execute( "SELECT 1 FROM publications WHERE title = ? AND platform = ?", (title, platform), ).fetchone() return row is not None If a network timeout hits after the platform accepted the post but before you saved the ID, reconcile by listing recent articles via the API before retrying.
Canonical URLs and AEO-friendly structure
Cross-posting works better for readers and for answer engines when:
- One URL is clearly canonical (often your site or the first publish target)
- Titles stay stable across platforms
- Articles open with a short TL;DR and close with an FAQ of real questions
- You do not stuff keywords or invent benchmarks
Automation should carry those fields, not invent marketing claims.
CI pattern that will not surprise you
A practical GitHub Actions shape:
- On pull request: validate front matter + dry-run payloads (no secrets required)
- On merge to
mainwith apublishlabel or workflow dispatch: run live publish using repository secrets - Commit or upload the ledger artifact so the next run sees prior IDs
Never auto-publish from every push to a feature branch.
Lessons learned (operational, not mythical metrics)
- Validation failures should be loud. A missing description is cheaper to catch in CI than on a live editor.
- Platform quirks belong in adapters. Tag limits, draft vs publish flags, and rate limits differ.
- Human review still matters. Dry-run diffs on PRs catch accidental draft→live flips.
- Credentials are per-platform. Revoke and rotate independently.
- UI is optional; ledger is not. A dashboard is nice. Knowing what you already published is mandatory.
FAQ
Q: Should the canonical URL point at Medium/dev.to or my own site?
A: Prefer a URL you control when you have one. Set canonical_url consistently so syndicated copies point back to the original.
Q: Is scraping the editor UI a good cross-post method?
A: Prefer official APIs. Browser automation for publishing is brittle and easier to get wrong under platform ToS.
Q: How do I update an article after it was published?
A: Store remote_id and call the platform’s update endpoint from an update command. Do not publish a second “new” article for minor edits.
Q: Can one Markdown file feed LinkedIn company posts too?
A: LinkedIn’s APIs and product surfaces differ from Hashnode/dev.to. Treat LinkedIn as a separate adapter with its own length limits and media rules—or schedule those posts in a dedicated workflow.
Building Markdown publishing automation or API integrations for your content ops? INDUS Web Agency ships practical Python and Next.js tooling like Article Pulse Crossposter.