Hi Community,
we use Hydrogen as our Shop storefront. We have build a multi-language shop using four languages. The Products and Collections may have localized handles, e.g. “watches”, “montres”, etc.
For the Sitemap generation we would like also to output the correct alternate hreflang links using also the localized handles.
As far as we understand the Storefront API docs, it is currently not possible with the “sitemap” query to get easily localized versions of the items. Our current approach is to load the products or colletions via the “products” or “collections” APIs and do a custom paging and rendering. But this is currently an expensive operation, because we need to execute the requests for each language (of course we can use caching strategy, etc.) for each entity (product or collection).
Would there be a better approach? is there a possibility to get a product or collection with their localized representations in one query/request? Maybe this needs a feature request or does this request already exist? Till now we haven’t found anything.
There is a getSitemap function in the Hydrogen framework with the possibility to have some custom getLink generation, but this is intentionally synchronous and does not help if you need to fetch a localized variant of your product or collection handle.
Thanks for your help.
Thanks for the detailed explanation — this is a really well-described use case.
From what we’ve seen, you’re interpreting the current Storefront API and Hydrogen behavior correctly. At the moment, localized handles are resolved based on the language context of the request, which means that retrieving all localized representations of a product or collection does require separate queries per language. There doesn’t appear to be a supported way today to fetch all localized handles for a resource in a single request, including via the sitemap query.
The getSitemap utility in Hydrogen is intentionally designed to be synchronous and lightweight, which makes it difficult to introduce locale-specific fetching logic within that flow. Because of that, many teams with multi-language setups end up taking a similar approach to yours: querying products or collections per locale and relying on caching or scheduled generation to reduce overhead.
One possible way to optimize is to generate the sitemap on a schedule (rather than at request time) and persist a mapping of resource IDs to localized handles per language. That way, you only pay the cost of the per-locale queries when content actually changes, not on every sitemap generation.
At this time, it does seem like a native solution would require additional platform support, such as locale-aware sitemap generation or an API field that exposes localized URL mappings. Submitting this as a feature request could be valuable, as this is a common requirement for international storefronts.
1 Like
Thank you @Godspeed001 for your response and confirmation.
So we keep our approach so far and will use some kind of cache mechanism. Maybe the Oxygen Full-Page Cache option could be a simple solution if we don’t need the full control of the invalidation part.
And we will open a feature request to Shopify 
Happy Coding 
1 Like
Okay no problem
I’m available for any help
ahh also important to mention:
With the approach above you may run into the issue “Too many subrequests….”
Therefore you also need to adjust the page size depending on how many languages you have to resolve the localized handles/slugs.