Blog sitemap

Shopify

Serve /blog.xml through a Shopify app proxy or your edge/CDN layer.

Setup steps

  1. 1Create an app proxy, worker, or CDN route that responds to /blog.xml on the storefront domain.
  2. 2Fetch the Rootscript project sitemap URL shown in your dashboard popup.
  3. 3Return the XML response with Content-Type application/xml.
  4. 4Deploy the proxy and run Check solution in Rootscript.

Worker-style proxy example

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

export default {
  async fetch(request) {
    const url = new URL(request.url);

    if (url.pathname !== "/blog.xml") {
      return fetch(request);
    }

    const sitemap = await fetch("https://rootscript.io/api/site/YOUR_SITE_ID/sitemap.xml", {
      cache: "no-store",
    });

    if (!sitemap.ok) {
      return new Response("Sitemap unavailable", { status: 502 });
    }

    return new Response(await sitemap.text(), {
      headers: {
        "Content-Type": "application/xml; charset=utf-8",
        "Cache-Control": "no-store, max-age=0",
      },
    });
  },
};