Shopify – How to upload a custom XML Sitemap and verify it with Google Search Console

Sitebee

Technical SEO
Staff member
As you become more familiar with Shopify you begin to learn about some of its disadvantages. But with a bit of technical prowess, there are nonconventional workarounds. In today’s post, I am going to show you how to upload custom XML sitemap files.

Due to the technology architecture that is powering the Shopify platform, you cannot upload files to the root domain (or any sub-folders) to the Shopify store. This means should you wish to override the default in-built Shopify XML Sitemap generator to submit your custom XML sitemap or International XML Sitemap you are up-shit creek.


Files are hosted and served by Shopify’s own Content Delivery Network (CDN)​


Any files such as pdf, XML, images, audio, a video that you wish to upload to your Shopify website are hosted and served by Shopify’s own Content Delivery Network (CDN). The files that you embed, share or anchor to are hosted on Shopify’s CDN path. Which I believe is backboned by Cloudflare’s infrastructure.

The question to why Shopify’s tech team chose to serve uploaded files via their CDN path is beyond me, although most likely to be a cost-cutting decision to keep the overheads down. I will demonstrate to you a simple workaround.

So, for example, if you upload a custom XML sitemap to Shopify via the file manager, the output URL path will be something like this: https://cdn.shopify.com/s/files/1/0456/4071/2355/files/custom-sitemap.xml?v=1597220084



Google Search Console (GSC) will reject that XML sitemap should you try to submit it. GSC will reject it on the basis that it not being served from the Shopify store’s root domain (or subfolder).


How to upload custom XML Sitemap files​

Let us assume that you have already created the XML sitemap that you like to submit to Google Search Console (GSC). Head over to the Shopify file manager within your online shop.



In the Shopify administration area head over to Settings > Files and proceed to upload the XML file via the file manager. Take note or copy the Shopify CDN file path for your newly uploaded XML file.


Create a redirect from your Shopify store to the Shopify CDN file location​


Next, whilst still n the Shopify administration area head over to Online Store > Navigation > URL Redirects.
Create a redirect from the root domain path. In this example, I have used redirect from: /custom-sitemap.xml to redirect to: the sitemap XML file hosted on the Shopify CDN. I have stripped out the file upload version number too, which looks like this: ?v=1597220084.




Tip: whenever you update the XML sitemap, there’s no need to update the redirect, just reupload the file. The CDN file path will remain the same, just as long as the naming convention remains the same. The only change is the file version number ?v=1597220084, if you created the redirect with the file version number there should be no need to update/recreate the redirect and no requirement to resubmit the XML sitemap to GSC.


Submit Custom XML Sitemap to Google Search Console​

The last step in this short Shopify tutorial is to submit the sitemap to Google Search Console (GSC). Login to your GSC account, navigate to the domain that you are submitting the sitemap for. Head over to Sitemaps.

Submit the custom-sitemap.xml file using the redirect from: file path. If all goes as planned Google Search Console will follow the redirect path to locate the Shopify CDN version of the custom-sitemap.xml and read it’s contents.




That’s it, hopefully, the custom sitemap is being found and read by GSC. If the new custom XML sitemap that you have created is being used to override the default XML sitemap, it might be a good idea to remove that sitemap from GSC (if it has been previously submitted).

Lastly, I have not tried to submit a Shopify custom XML sitemap via Bing Webmaster Tools. I’ll assume this method should work.

If you get stuck and need a helping hand. Comment below, I’ll do what I can to help you out. Alternatively, you can hire me on an hourly freelance basis. Feel free to get in touch.