Blog sitemap

Angular

Add a server endpoint for /blog.xml in your Angular SSR or hosting layer.

Setup steps

  1. 1Handle /blog.xml in your Angular Universal server, edge function, or hosting rewrite.
  2. 2Fetch the Rootscript project sitemap URL from the dashboard popup.
  3. 3Pass the XML response through with an application/xml content type.
  4. 4Deploy and verify with Check solution in Rootscript.

Angular Universal Express example

Replace YOUR_SITE_ID with the site id from the Rootscript sitemap URL shown in your dashboard popup.

server.get("/blog.xml", async (_req, res) => {
  const sitemap = await fetch("https://rootscript.io/api/site/YOUR_SITE_ID/sitemap.xml");

  if (!sitemap.ok) {
    res.status(502).send("Sitemap unavailable");
    return;
  }

  res
    .type("application/xml")
    .setHeader("Cache-Control", "no-store, max-age=0")
    .send(await sitemap.text());
});