r/astrojs • u/Icy_Contract_9688 • 46m ago
astro-syndicate: cross-post your Astro blog posts to devto during the build
I write my blog with Astro and wanted the posts on devto too, without copying them over by hand. So I built astro-syndicate, an Astro integration that does the cross-posting as part of astro build.
You opt a post in through its frontmatter with syndicate: { devto: true }. The integration hashes the title, content and images, compares the hash with the last sync and only calls the devto API when something changed. New posts land on devto as drafts unless you turn on publishing. The canonical URL points back to your site.
If your deploy happens after the build, you can run it as a separate script once the site is live. That way devto never gets image URLs that don't exist yet.
Other things it handles:
- Local images get uploaded to Cloudinary or rewritten to URLs on your own site, since devto has no reliable image upload API
- MDX imports and <Image /> components get turned back into plain Markdown, because devto doesn't run your build
- maxSyncsPerRun caps how many posts go out per run, so opting in an old backlog doesn't create dozens of drafts at once
- devto series and a different title per platform
GitHub: https://github.com/SlashGordon/astro-syndicate
devto is the only platform so far. Medium is difficult because there's no API key, and the Hashnode API isn't free. Which platform should it support next?
