Pages from your data

For news, articles, product pages and profiles: your app writes the finished HTML when the content changes, and it is served at a clean URL like a static page. Search engines, link previews and AI assistants read the title, image and text straight from the page. No deploy, no build step.

Publish a page

Call env.PAGES.put from your server code, in the same request that saves the content:

// api/publish.js
export default {
  async fetch(request, env) {
    const a = await request.json(); // or read it from env.DB
    const html = `<!doctype html>
<html><head>
  <title>${esc(a.title)}</title>
  <meta property="og:title" content="${esc(a.title)}">
  <meta property="og:image" content="${esc(a.imageUrl)}">
</head><body><h1>${esc(a.title)}</h1>${a.bodyHtml}</body></html>`;
    await env.PAGES.put(`/news/${a.slug}`, html);
    return Response.json({ ok: true });
  },
};

/news/your-slug now serves that HTML. Escape anything that comes from users before you put it in the page.

The API

  • env.PAGES.put(path, html, { sitemap }) writes a page; sitemap: false leaves it out of sitemap.xml.
  • env.PAGES.get(path) returns { path, html, updated, sitemap } or null.
  • env.PAGES.delete(path) removes a page.
  • env.PAGES.list({ prefix, cursor, limit }) returns { pages, cursor }, 1,000 at a time.

A path starts with / and has no file extension (/news/my-story). /api, /_cr, /files and /.well-known are reserved. A page is at most 5 MB.

How pages are served

  • Your static files come first, then pages, then your app (so client-side routes keep working).
  • Pages are cached for a minute: a change shows everywhere within 60 seconds.
  • sitemap.xml lists every page with its last change, unless your app ships its own sitemap.xml or turns it off in cloudrizz.seo.json.
  • llms.txt lists every page by its title and description, so AI assistants find them too.
  • Pages get what your static pages get: the install tags of an installable app and, with web analytics on, their views are counted.
  • Preview deploys keep their own pages and are never indexed.
Pages are kept apart from env.STORAGE: files your users upload can never become a page. Only your server code writes them. Reading a page counts as a file read, writing one as a file write (see usage prices).