Bagisto Hosting

Per-Channel Sitemaps in a Multi-Store Bagisto

Updated 3 August 2026

Overview

In Bagisto, Per-Channel Sitemaps answer the same question for every storefront: which pages belong to this host, and this host alone?

A channel is a storefront with its own hostname, currency and category tree. Our multi-vendor marketplace runs several of them from one admin.

So the queued job processes each storefront on its own — separate files, separate links, never mixed.

One global sitemap cannot serve many storefronts

First, a sitemap serves one host. It can only list the URLs of the domain that serves it.

Generate every link with url(), and the whole file inherits one hostname — usually the admin’s own.

Instead, the easy fix flattens every storefront into one file:

That file, however, mixes the US store, the UK store and a third host under one domain.

Google ignores any URL that does not belong to the host serving the sitemap; consequently, the extra storefronts quietly starve.

For example, Google’s sitemap rules make this host rule explicit: a file may only list URLs from its own host.

Generate Per-Channel Sitemaps with a pivot and a loop

The fix starts in the data model; equally, a pivot table ties each sitemap record to the storefronts it must cover.

Next, the queued job loops those channels and processes each storefront in isolation, each on its own hostname.

Per-Channel Sitemaps fan out from one record to many storefronts

To make every link carry the right domain, we pin the URL generator to that hostname.

Likewise, queries scope products and pages by channel, so a US item never leaks into the UK file.

Meanwhile, categories come from the nested set: the branches between the channel’s root category boundaries.

As a result, the job writes every file under the channel’s own folder, so the disk mirrors the storefronts.

Overall, Per-Channel Sitemaps hand Google exactly what it expects — one hostname, one sitemaps/{channel_code}/ folder, one file set.

Keeping Per-Channel Sitemaps honest

A channel with no hostname, for instance, falls back to the app root URL, so a blank field never breaks the job.

The job also deletes old files before writing new ones, so a retired storefront leaves no stale index.

Finally, the loop restores the root URL at the end, so sibling jobs still generate links for the admin’s own domain.

Moreover, each channel reports its hostname and files into the sitemap record, so the admin listing stays a single source of truth.

The record, notably, resolves through a proxy, exactly as in our note on swapping Eloquent models.

Final Thought

In short, Per-Channel Sitemaps are a mapping problem, not a generation problem. The URL maths was never hard.

So tie a sitemap to its storefronts, scope each query to the channel, write into its own folder. Google gets what it can use.

. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


Be the first to comment.

Start a Project




    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home