Note: I updated some names and links in this post. Dev.to's product became Forem when it went open source
So, like all good things, the idea for this post comes from a tweet:
This is something I've been ruminating on for a bit. I've even tried to build it - a few times! I keep starting in on the work and getting lost in the millions of directions I could take it.
- recreate my post verbatim, from its original markdown source
- use the
canonical_urlfrontmatter field to make sure I retain SEO goodness on my post
- happen without my intervention
- be agnostic of where my posts are coming from. At the time of writing this article, I use takeshape.io as a headless CMS for my site, so my individual posts aren't in source control
- only take posts from my
masterbranch, since I use feature branches for draft posts from time to time
- use the dev.to API (update: now called the Forem API), of course
Nice to have:
- maybe posts should be set to
published: falseat first, so I can preview/review/update them as needed for dev.to?
Possible approaches for this:
- Tap into GitHub's webhooks somehow, and fire off a post here
- Come from a job kicked off after CI, maybe? I use CircleCI, but would like this feature to be fairly implementation agnostic.
- Use a GitHub App?
- ...or a GitHub Action?
- Perhaps just a lamba function deployed to AWS or Netlify Functions.
So - here's where I ask for your help. Surely there's a simple approach here I haven't thought of, or maybe it's a matter of collecting a few scenarios and building something based on 80/20.
What else am I missing here? I'd love your help. What use cases would you have for a cross-poster from your gatsby site? How would you implement it? How can we help each other?