Redeploy on publish
The loader runs during astro build and nowhere else. Whatever was published at build time is what ships. To make new articles appear without a manual rebuild, point a deploy hook at the signed feed.updated webhook so every publish triggers a fresh build.
The wiring
Section titled “The wiring”Most hosts expose a deploy hook — a URL that triggers a rebuild when something POSTs to it. Ghost Writr fires a feed.updated webhook whenever your feed changes. Connect the two and a publish becomes a rebuild.
-
Create a deploy hook on your host. On Cloudflare Pages: Project → Settings → Builds & deployments → Deploy hooks → add one for your production branch. You get a URL like
https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/<token>. -
Register it as a Ghost Writr webhook for
feed.updated, with the deploy-hook URL as the target. Ghost Writr will POST to it on every publish. -
Publish. Ghost Writr signs and sends
feed.updated; the deploy hook kicks offastro build; the loader re-syncs the feed; your site redeploys with the new article.
Verifying the webhook signature (optional, recommended)
Section titled “Verifying the webhook signature (optional, recommended)”A bare deploy-hook URL rebuilds for anyone who calls it. If you’d rather verify the request is genuinely from Ghost Writr, put a small endpoint in front of the deploy hook and check the signature before forwarding. The shared keyless core exports the verifier:
import { verifyFeedSignature, FEED_SIGNATURE_HEADER } from "@ghostwritr/feed";
// rawBody = the exact request body string; secret = your webhook signing secretconst signature = request.headers.get(FEED_SIGNATURE_HEADER);const ok = await verifyFeedSignature(secret, rawBody, signature);if (!ok) return new Response("bad signature", { status: 401 });
// signature good → call your host's deploy-hook URLawait fetch(DEPLOY_HOOK_URL, { method: "POST" });verifyFeedSignature(secret, rawBody, signature) is positional and returns a boolean. FEED_SIGNATURE_HEADER is the "X-GW-Signature" header name.
This guard is independent of the loader — the loader itself stays keyless and only ever reads the public feed.
What a rebuild does
Section titled “What a rebuild does”Each build is a full, change-detected sync of your static feed: new articles are added, edited articles re-render, unchanged articles keep their cached render (no needless re-render), and unpublished or removed articles drop out. So a rebuild always converges on exactly the current published set — see The content feed.
Related
Section titled “Related”- Instant updates — the
feed.updatedwebhook end to end. - Overview — why the loader is build-time only.