How to Create a Sitemap: Step-by-Step Guide
WordPress
Install the Yoast SEO or Rank Math plugin. Both automatically generate a sitemap at yoursite.com/sitemap_index.xml and keep it updated as you publish content. In Yoast: go to SEO then General then Features and enable XML sitemaps. In Rank Math: go to Rank Math then Sitemap settings. Submit the sitemap URL to Google Search Console after setup.
Shopify
Shopify generates your sitemap automatically at yourstore.com/sitemap.xml. No setup required. The sitemap updates when you add products, pages, blog posts, or collections. Submit the sitemap URL directly to Google Search Console. If you need to exclude certain URLs, use the Shopify sitemap apps from the App Store.
Next.js
In Next.js 13+ with App Router, create src/app/sitemap.ts that exports a default function returning an array of sitemap entries. Each entry needs a url and optionally lastModified, changeFrequency, and priority. Next.js serves this at /sitemap.xml automatically. For large sites, use generateSitemaps to create multiple sitemap files.
Static or custom sites
For static sites or frameworks without built-in sitemap support, use the free online XML Sitemap Generator or SitemapFixer to crawl your site and generate a sitemap automatically. Download the generated sitemap.xml and place it in your site root directory. Update it manually when you add significant new pages, or automate generation in your deployment pipeline.
After creating your sitemap
Submit your sitemap to Google Search Console by going to Indexing then Sitemaps, entering your sitemap URL, and clicking Submit. Also declare your sitemap in your robots.txt file by adding Sitemap: https://yoursite.com/sitemap.xml at the bottom. Verify the sitemap was processed without errors in Search Console within 24-48 hours.
Related Guides
- What Is an XML Sitemap?
- XML Sitemap Format: Complete Reference with Examples
- XML Sitemap Generator: Create Your Sitemap Free
- XML Sitemap Best Practices
- Sitemap Checker: Validate and Fix Your XML Sitemap
- Sitemap Index File: What It Is and When You Need One
- Dynamic Sitemap: Generate and Maintain One Automatically
- What Is a Sitemap? XML vs HTML Sitemap Explained
- Sitemap SEO: How Your XML Sitemap Affects Google Rankings