How to Generate XML and HTML Sitemaps in Magento 2

Generating sitemaps is a crucial part of optimising your Magento 2 store for search engines. Sitemaps provide a roadmap of your website’s content, making it easier for search engines to crawl and index your pages. This article will guide you through the steps to create both XML and HTML sitemaps in Magento 2, ensuring your store is fully optimised for search engines.


Importance of Sitemaps

Before we delve into the steps, it’s important to understand why sitemaps are vital for your Magento 2 store:

  • Improved Indexing: Sitemaps help search engines discover and index your web pages more efficiently.
  • Enhanced SEO: A well-structured sitemap can improve your search engine rankings.
  • Better User Experience: HTML sitemaps provide a navigational tool for users, helping them find content easily.

Generating an XML Sitemap in Magento 2

XML sitemaps are specifically designed for search engines. They provide a structured format that makes it easier for search engine bots to understand your site’s architecture.

Step 1: Configure XML Sitemap Settings

  1. Log in to your Magento Admin Panel.
  2. Navigate to Stores > Configuration.
  3. Under the Catalog section, select XML Sitemap.

Here, you’ll find various settings to configure your XML sitemap. These include:

  • Frequency Settings: Define how often different types of content are updated.
  • Priority Settings: Assign priorities to different content types to indicate their importance.
  • File Limits: Set limits for the number of URLs per sitemap file and the maximum file size.

Step 2: Generate the XML Sitemap

  1. Go to Marketing > Site Map.
  2. Click on Add Sitemap.
  3. Enter a Filename and Path. For example, use sitemap.xml and / as the path.
  4. Save the Sitemap.

Step 3: Submit the Sitemap to Search Engines

Once the XML sitemap is generated, it’s crucial to submit it to search engines like Google and Bing.

  1. Google Search Console:

    • Log in to your Google Search Console account.
    • Navigate to the Sitemaps section.
    • Enter the URL of your sitemap and click Submit.
  2. Bing Webmaster Tools:

    • Log in to your Bing Webmaster Tools account.
    • Go to the Sitemaps section.
    • Enter the URL of your sitemap and click Submit.

Generating an HTML Sitemap in Magento 2

HTML sitemaps are user-friendly and help visitors navigate your website more easily. While Magento 2 doesn’t provide a built-in feature for HTML sitemaps, you can use extensions or custom development to create one.

Using an Extension

One of the simplest ways to generate an HTML sitemap is by using a Magento 2 extension. Here’s a general process using an extension:

  1. Choose a Reputable Extension: Look for a reliable HTML sitemap extension in the Magento Marketplace or other trusted sources.
  2. Install the Extension: Follow the extension provider’s instructions to install it on your Magento 2 store.
  3. Configure the Extension: Navigate to the extension settings in your Magento Admin Panel and configure it according to your needs. This usually involves setting up the sitemap layout, including/excluding specific pages, and determining the display format.

Manual Creation

If you prefer a custom solution, you can manually create an HTML sitemap by following these steps:

  1. Create a New CMS Page:

    • Navigate to Content > Pages.
    • Click Add New Page.
    • Enter a title such as HTML Sitemap.
  2. Insert HTML Code:

    • In the Content section, switch to the HTML view.
    • Insert the necessary HTML code to list your website’s pages and categories. Here’s a basic example:

<h1>HTML Sitemap</h1> <ul> <li><a href="/category-1">Category 1</a></li> <li><a href="/category-2">Category 2</a></li> <li><a href="/page-1">Page 1</a></li> <li><a href="/page-2">Page 2</a></li> </ul>
  1. Save and Publish the CMS page.

Maintaining Your Sitemaps

Regularly updating your sitemaps is essential to ensure they reflect the current structure and content of your website. Here are some tips for maintaining your sitemaps:

  • Automate Updates: Configure automatic updates for your XML sitemap in the Magento 2 settings.
  • Regular Checks: Periodically check your sitemaps for any broken links or outdated content.
  • Submit Updated Sitemaps: Whenever significant changes are made to your site, resubmit your sitemaps to search engines.

Conclusion

Generating and maintaining XML and HTML sitemaps in Magento 2 is a crucial aspect of SEO and user experience optimisation. XML sitemaps help search engines crawl and index your site more efficiently, while HTML sitemaps provide a navigational tool for your visitors. By following the steps outlined in this article, you can ensure your Magento 2 store is fully optimised for both search engines and users.

Comments

Popular Posts