Using DropBox, Gatsby & Netlify for Scheduled Posts

Status: ideation
Share: Twitter

This was originally going to be a post on how to use file name magic and a daily Zapier scheduled task to setup content to be published on a specific day. I'm no longer pursuing a "publishing schedule", so this post isn't high priority, but if you're interested in me elaborating, let me know on Twitter at chaseadamsio.

#Development

  • setup Dropbox locally
  • create a task to link Dropbox

#Deployment

  • call Dropbox API to get content
  • Use Zapier scheduled zap to trigger a daily Netlify job
/**
* utility I used to rename all of my files based on the date
* so that I can use netlify+dropbox to "schedule" posts
*/
const fs = require("fs");
const path = require("path");
const root = "./Apps/chaseadams.io/articles";
walkTree(root);
function walkTree(prevPath) {
fs.readdir(prevPath, (err, files) => {
if (err) {
console.error(err);
process.exit(1);
}
files.forEach(filepath => {
const newPath = path.join(prevPath, filepath);
fs.stat(newPath, (err, stats) => {
if (err) {
console.error(err);
process.exit(1);
}
if (stats.isDirectory()) {
walkTree(newPath);
} else {
if (!newPath.match(/\\d{4}-\\d{2}-\\d{2}/)) {
fs.readFile(newPath, "utf8", (err, contents) => {
const frontmatter = contents
.split("
Did you enjoy this article? Share it on Twitter!
chaseadams.io is powered by GatsbyJS, GitHub & Netlify.
Deployed commit of chaseadams.io is f1a4e1
👋 Say Hi!