Prerendered marketing pages on the edge
How Makerkit serves its public pages from Cloudflare's cache while signed-in visitors keep a strict CSP.
- By Makerkit Team
- 1 min read
Marketing pages are the first thing your visitors see, so they should be fast everywhere. Makerkit prerenders every page under pages/(marketing)/ when you deploy and serves it from the edge cache.
One export per page
A marketing page opts into prerendering from its companion server file:
// pages/(marketing)/faq.server.ts
export const prerender = true;
Pages with URL params, like the posts on this blog, also list the params to prerender:
export const getPrerenderPaths = () => blog.entryParams();
Cached for visitors, live for users
Requests without cookies get the cached copy. As soon as someone signs in, their requests render live with a fresh nonce for the Content Security Policy.
NOTE
Cached pages carry no CSP, because one nonce can't be shared by every visitor. That's why they render only content from your repository, never request data.
What it costs
Nothing extra: prerendering is part of Void's ISR, and a deploy clears the cache so new content shows up right away.