
Notes on My Blog's 'Self-Publishing' Pipeline
I've always liked static site generators because they're fast and I don't have to worry about a database exploding at 3 AM. But for a long time, my blog felt like a "manual transmission" car. If I wanted to publish a post, I had to be at my desk, merge a PR, and wait for a build. If I wanted to schedule a post for next Tuesday? I had to remember to click "Merge" on Tuesday morning. The Build-Time Filter The heart of the system is Vite's import.meta.glob . Since I'm using MDsveX, my posts are basically Svelte components that get pulled in at build time. I added a filter in src/lib/posts.ts that checks the metadata date against new Date() . If the post is in the future, it just doesn't get included in the production array. const now = new Date (). getTime (); // ... inside the loop ... const isVisible = ! post . metadata . hidden && postDate <= now ; if ( showDrafts || isVisible ) { // include the post } ...And this works fine, but it means the post technically exists in the repository,
Continue reading on Dev.to
Opens in a new tab



