My static Nuxt blog publishes ... Note

My static Nuxt blog publishes itself: drafts, scheduled "drip", and auto-rebuilds

This article details a solution for scheduling posts on a fully static Nuxt site. Static sites inherently lack server-side rendering capabilities, making direct post scheduling impossible without a rebuilding mechanism. The author, who writes in bursts, developed a system that includes drafts, a scheduled queue, and automatic rebuilds. The setup utilizes Nuxt 4 prerendered as an SSG, Storyblok as the headless CMS, and a Nitro server managed by PM2 to keep the application always-on. GitHub Actions are employed for deployment and rebuilding the site.The core idea is that publishing on an SSG involves two steps: updating content in the CMS and then rebuilding the static site. Scheduling automates these two steps for a future time. Drafts are saved server-side with a status and publish date, not affecting the live site until scheduled. A Nitro scheduled task runs hourly to check for articles with a publish date in the past or present.When articles are due, they are converted to Storyblok's richtext format and pushed to the CMS. Subsequently, a single site rebuild is triggered via the GitHub API, ensuring the new content appears on the live site. The system avoids separate services like cron boxes, leveraging Nitro's built-in scheduled task functionality. A key point is that the Nitro server must be running for the scheduled tasks to execute, so it's hosted on a small VPS and managed by PM2. The author emphasizes optimizing for a single rebuild per batch of scheduled articles to avoid redundant deployments. Lastly, careful attention to timezones is crucial for accurate scheduling. This solution allows the author to write content in advance and have it automatically publish, freeing them from manual intervention.