Dynamic sitemaps, robots.txt and canonical URL management
Module 43: Wix Headless SEO | Lesson 494 of 687 | 46 min read
By Michael Andrews, Wix SEO Expert UK
When you go headless, Wix no longer generates your sitemap or manages your robots.txt. You must build these yourself using data from the Wix APIs. This lesson shows you how to create dynamic sitemaps, configure robots.txt and manage canonical URLs correctly.
Generating Dynamic XML Sitemaps from Wix Data
Your sitemap must include every indexable page on your headless frontend. This means querying the Wix CMS API, eCommerce API and Blog API to get all published URLs, then generating a valid XML sitemap that includes lastmod dates, changefreq hints and priority values.

Building a dynamic sitemap with Next.js and Wix
- Create a sitemap.xml route in your Next.js app (app/sitemap.xml/route.ts)
- Query the Wix CMS API for all published blog posts, pages and dynamic content
- Query the Wix eCommerce API for all published products and categories
- Combine all URLs with your custom domain prefix
- Include lastmod using the Wix lastUpdated field from each content item
- Generate valid XML using a sitemap library or template literal
- Submit the sitemap URL to Google Search Console
- Set up a cron job or webhook to regenerate the sitemap when content changes
Robots.txt Configuration for Headless Sites
Your robots.txt must allow Googlebot to access all public pages while blocking internal routes like API endpoints, preview pages and member-only areas. Place the robots.txt at your domain root and include a Sitemap directive pointing to your dynamic sitemap.
Canonical URL Management
With headless Wix, you must ensure canonical URLs point to your custom frontend domain, not to the Wix backend. Every page needs a self-referencing canonical tag. Paginated pages need proper rel="next" and rel="prev" hints. Product variants need canonicals pointing to the main product URL unless they have unique search intent.
Sitemap Index for Large Sites
If your headless Wix site has more than 50,000 URLs, split your sitemap into multiple files using a sitemap index. Create separate sitemaps for products, blog posts, categories and static pages. The sitemap index file references each sub-sitemap, making it easier for Google to process your full URL inventory.
This lesson on Dynamic sitemaps, robots.txt and canonical URL management is part of Module 43: Wix Headless SEO in The Most Comprehensive Complete Wix SEO Course in the World (2026 Edition). Created by Michael Andrews, the UK's No.1 Wix SEO Expert with 14 years of hands-on experience, 750+ completed Wix SEO projects and 425+ verified five-star reviews.