Prerendering of SPA applications

I have an Angular app which need prerendering because of the SEO.

I saw that Netlify has prerendering as feature in their docs, but I couldn’t find anything about prerendering in Cloudflare docs.

Does Cloudflare support prerendering, and how we can enable it?

May you elaborate how you define “prerendering”?
If you define it as “building a static page” (SSG), then this is exactly what Cloudflare Pages does.

So SPA applications like Angular/React/Vue are all static, but because they are JavaScript frameworks they are not SEO optimized out of the box.

Because of that, it’s usual that if some bot requests a page, the page will be prerendered and send to the bot.

There are services that do only that (Prerender for example).

Some of Cloudflare Pages competitors like Netlify have this as a feature. They also host static websites, but if it’s SPA application you can enable prerendering (they use Prerender behind the scene - it’s an open source).

If you prerender stuff on build time you can serve them with Cloudflare Pages.

I define prerendering like described here: Pre-rendering (SSG) | vite-plugin-ssr

When using pre-rendering, we don’t need a Node.js server: our app consists only of static assets (HTML, JS, CSS, images, …) and we can deploy these static assets to a so-called “static host” such as GitHub Pages, Cloudflare Pages, or Netlify.

They even mention compatibility with Cloudflare Pages, so just give it a try :slight_smile:
I guess, in this case “prerendering” and “building” or “generating” is the same.

Yeah, it’s not what I meant. I would update the question to describe it better, but I don’t have that as on option.

So the prerendering from the docs that you quoted is ok only if you don’t have dynamic pages. If you have dynamic pages (like articles for example), if you update any of the articles or create a new one, it will not be reflected since you create prerendered files only during build process.

What I meant is this:

  1. Cloudflare checks who requested the page
  2. If bot requested the page, then prerender the page on headless browser (or somewhere else) and send that file to bot
  3. If normal user requested the page, just send normal files

That can not be done within Cloudflare Pages, but actually with other Cloudflare features.

So if you prerender both: the normal page and the page for bots you can use Workers to serve both, depending on, who requets.

So it’s doable with Cloudflare, but not solely with Cloudflare Pages AFAIK.