DEV Community

Just a Side Project
Just a Side Project

Posted on • Originally published at justasideproject.blogspot.com

How I Wired Up Fully-Automated Cross-Posting Between Blogger and dev.to (With Working Code)

The last two posts on this blog went out through a pipeline I built specifically so I wouldn't have to manually copy-paste content between platforms. Here's the actual setup, in case you're trying to do the same thing.

The goal

One command, two platforms: publish to Blogger (where this blog actually lives) and have it show up on dev.to at the same time, without dev.to's copy counting against the original for search ranking purposes.

Piece 1: Blogger, via its own API

Blogger still has a working API (v3), authenticated through standard OAuth — no service-account keys needed, which matters if your Google Cloud project has an org policy blocking those (mine did). A one-time browser login gets you a refresh token; after that, a script can call posts().insert() or posts().update() and posts().publish() without touching a browser again.

Piece 2: dev.to, via its API

dev.to exposes a simple REST API gated by a personal API key (generate one under Settings → Extensions). A POST to /api/articles with a title, body, tags, and a canonical_url field creates the post. That last field is the important one.

Why canonical_url matters

Posting the same article on two platforms verbatim is exactly the setup that can cause one copy to get buried by search engines as duplicate content — something I ran into thinking about cross-posting between other platforms for this same blog, before settling on this approach. Setting canonical_url on the dev.to copy to point back at the Blogger original tells search engines "this is a copy, the real one lives here," which keeps SEO credit flowing to one place instead of splitting or confusing it.

Wiring it together

The actual glue is small: a publish script that (1) pushes content to Blogger, (2) grabs the resulting live URL, (3) immediately POSTs the same content to dev.to with that URL set as canonical. Two API calls, one command, no manual copy-paste, no risk of forgetting to update one platform after editing the other.

What I'd do differently next time

Right now the script assumes a clean HTML post every time. If you're writing in Markdown instead, dev.to wants Markdown natively (it renders raw HTML inline reasonably well, but it's not the primary format) — something to normalize if you're pulling from a Markdown-first source instead of an HTML editor like Blogger's.

Top comments (0)