Deploy Your Locally Edited Site
You watched our video and customized your LocusPilot website on your own computer. Now you want to put it online, and you don't want to re-upload the whole site every time you add a blog post.
This guide shows you how. By the end, you'll push a change in GitHub Desktop and see it live on your domain in about 30 seconds. We'll also cover how to schedule blog posts to publish on a future date.
1The Quickest Way (Manual Upload)
If you just want to test your site online once, you can upload the built files by hand.
- In your project folder, run
npm run build - This creates a
distfolder with your finished site - Go to Cloudflare Pages and pick Direct Upload
- Drag the
distfolder into the page
2Push Your Project to GitHub
GitHub is where your code lives online. The easiest tool for this is GitHub Desktop. No command line needed.
- Install GitHub Desktop and sign in with your GitHub account
- Click File > Add Local Repository and pick your project folder
- If prompted, click create a repository instead
- Click Publish repository at the top
- Tick Keep this code private (recommended for client sites)
- Click Publish repository
3Connect GitHub to Cloudflare Pages
This is the magic step. Once linked, every change you push to GitHub will rebuild your site on Cloudflare in about 30 seconds. You only do this once.
- Log in to your Cloudflare dashboard
- Go to Workers & Pages in the left sidebar
- Click Create application > Pages > Connect to Git
- Authorize Cloudflare to access your GitHub account
- Pick the repository you just published
- Click Begin setup
On the build settings screen, fill in these exact values:
| Field | Value |
|---|---|
| Framework preset | Astro |
| Build command | npm run build |
| Build output directory | dist |
Before clicking deploy, scroll down to Environment variables and add one:
| Variable name | Value |
|---|---|
| NODE_VERSION | 20 |
NODE_VERSION variable, the build often fails on the first try. This is the most common gotcha.Click Save and Deploy. Cloudflare will build your site and give you a free URL like your-project.pages.dev in about a minute.
4Add Your Custom Domain
Your .pages.dev URL works fine, but you probably want your real domain. The DNS steps are the same as our hosted setup.
Follow our Connect Custom Domain guide. The only difference is you add the domain inside your Cloudflare Pages project (under Custom domains) instead of in the LocusPilot dashboard.
/index.md work on any host. Automatic Accept: text/markdown negotiation needs Cloudflare Transform Rules on the domain's Cloudflare zone. If you publish from LocusPilot to your own Cloudflare account, create the API token with Account → Cloudflare Pages → Edit, Zone → Zone → Read, and Zone → Transform Rules → Edit. Set Zone Resources to All zones or the target domain. Enter the domain in the Publish to My Cloudflare modal; don't use the separate LocusPilot-hosted Custom Domain card for this path. Domains that only use Namecheap, GoDaddy, or another DNS provider cannot do this negotiation unless you add equivalent edge rewrite support.5Add a Blog Post (No More Re-Uploading)
Now the fun part. To add a new post, you have two choices.
Option A: Edit on your computer
- Open
src/content/blog/in your code editor - Copy an existing post and rename the file (for example
my-new-post.mdx) - Edit the content and frontmatter
- In GitHub Desktop, write a short summary, click Commit, then Push
Option B: Edit in your browser
- Go to your repo on github.com
- Open
src/content/blog/ - Click any post, then click the pencil icon to edit, or Add file > Create new file
- Click Commit changes at the bottom
No download needed. Good for small fixes from any device.
Either way, Cloudflare picks up the change and your post is live in about 30 seconds.
---
title: "Your Post Title"
description: "A short summary for SEO"
publishDate: 2026-05-15
author: "Your Name"
category: "Tips"
draft: false
---6Schedule Posts for the Future
WordPress lets you pick a future date and walk away. With this setup we can do the same, but it needs a small one-time setup. There are two ways. Pick whichever feels easier.
Easy way: Use the draft flag
This works right out of the box. No extra setup.
- Write your post and set
draft: truein the frontmatter - Commit and push. The post will not show on your site.
- On the day you want it live, edit the post and change to
draft: false - Commit and push. It goes live in 30 seconds.
Good for: small batches, one or two posts at a time. Bad for: setting up posts months ahead and forgetting them.
Auto-publish on a future date
This is the real WordPress-style scheduler. It needs three small pieces, but once they're set up you never touch them again.
Piece 1: Filter future-dated posts
By default, your blog index shows every post no matter the date. Open src/pages/blog/index.astro and find the line that loads posts. Change it to:
const allPosts = await getCollection('blog', ({ data }) =>
!data.draft && new Date(data.publishDate) <= new Date()
);This hides any post whose publishDate is still in the future. Do the same in any other file that lists blog posts (like the homepage).
Piece 2: Get a Cloudflare deploy hook
- In your Cloudflare Pages project, go to Settings > Builds & deployments
- Scroll to Deploy hooks and click Create deploy hook
- Name it
scheduled-rebuildand pick branchmain - Copy the URL it gives you. It looks like
https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/...
Piece 3: Add a daily GitHub Action
- On github.com, go to your repo > Settings > Secrets and variables > Actions
- Click New repository secret
- Name it
CLOUDFLARE_DEPLOY_HOOKand paste the URL from Piece 2 - Save
Now create a new file in your project at .github/workflows/scheduled-rebuild.yml:
name: Scheduled rebuild
on:
schedule:
# Runs every day at 09:00 UTC
- cron: '0 9 * * *'
workflow_dispatch:
jobs:
trigger-build:
runs-on: ubuntu-latest
steps:
- name: Trigger Cloudflare Pages deploy
run: curl -X POST "${{ secrets.CLOUDFLARE_DEPLOY_HOOK }}"Commit and push. GitHub will run this every day at 9am UTC and rebuild your site. Any post whose publishDate has passed will appear automatically.
0 1 * * * (1am UTC).7How to Write a Scheduled Post
Once Step 6 is done, scheduling is easy:
- Write the post like any other
- Set
publishDateto the future date you want - Make sure
draft: false - Commit and push today
The post sits hidden in your repo. On the morning of the publish date, the daily cron rebuilds your site and the post goes live on its own.
Which Setup Should I Use?
| Setup | One-time setup | Per-post effort | Future scheduling |
|---|---|---|---|
| Manual upload | None | Build + drag every time | No |
| Auto-deploy (Steps 2-5) | ~15 minutes | Edit + push | Manual (draft flag) |
| Auto-deploy + scheduling (all steps) | ~30 minutes | Edit + push | Yes, fully automatic |
Troubleshooting
First Cloudflare build fails
- Check that
NODE_VERSION = 20is set in environment variables - Make sure the build command is
npm run buildand output isdist - Open the build log in Cloudflare to see the exact error
Push to GitHub doesn't trigger a build
- Check the branch. Cloudflare only builds the branch you set during setup (usually
main) - Open the Pages project and check the Deployments tab for errors
Future-dated post showed up immediately
- You missed Piece 1 of Step 6. The date filter goes in
src/pages/blog/index.astro - Check any other file that lists blog posts (homepage, category pages) and add the same filter
Scheduled rebuild didn't fire
- GitHub Actions
schedulecan run a few minutes late. That's normal. - Open the Actions tab on your repo to see if the run started
- If the secret is wrong, the run will fail. Check that
CLOUDFLARE_DEPLOY_HOOKmatches the URL from Cloudflare.