Subfolder with Shopify
Give your store a real SEO blog at yourstore.com/blog — a Cloudflare Worker in front of Shopify does the mounting.
- Enable Settings → Subfolder hosting in the blogcms dashboard.
- Route the store's custom domain through Cloudflare (proxied) — checkout and every other path keep hitting Shopify untouched.
- Create this Worker and route yourstore.com/blog* to it:
worker.jsexport default {
async fetch(request) {
const url = new URL(request.url);
if (url.pathname === "/blog/") {
return Response.redirect(url.origin + "/blog", 301);
}
if (url.pathname === "/blog" || url.pathname.startsWith("/blog/")) {
const path = url.pathname === "/blog" ? "/" : url.pathname.slice(5);
return fetch("https://you.blogcms.app/_subfolder" + path + url.search);
}
return fetch(request); // everything else: untouched
},
};
- Publish the blog once, then hit Verify setup.
- Keep Shopify's own /blogs pages noindexed (or redirected) so the two blogs don't compete.