HOW TO CREATE A SHOPIFY HTML SITEMAP.

The first thing you need to do is create a new template where you will add some custom lines of code. To create a new template in Shopify, follow these steps:HOW TO CREATE A SHOPIFY HTML SITEMAP.

HOW TO CREATE A SHOPIFY HTML SITEMAP.

  1. From your Shopify admin panel, navigate to Online Store > Themes
  2. In the first section (Live theme) click Actions > Edit Code
  3. Under the Templates folder, click Add a new template
  4. Select page from the dropdown and name it sitemap
  5. Click the Create template button
This is the template where you are going to add some custom code. It’s very important to add the code directly below the line with {{ page. content }}, which will ensure you don’t lose any styling from a normal page.
To list out all of your products and collections, add the following code to your new template page:
<div class="row">
<div class="col-md-6">
<h2>Collections</h2>
<ul>
{% for c in collections %}
<li>
<a href="{{ c.url }}">{{ c.title }}</a>
</li>
{% endfor %}
</ul>
</div>
<div class="col-md-6">
<h2>Products</h2>
<ul>
{% for product in collections.all.products %}
<li>
<a href="{{ product.url }}">{{ product.title }}</a>
</li>
{% endfor %}
</ul>
</div>
</div>    
  

Note: this code is wrapped with some bootstrap code so you’ll have to edit the div classes if you’d like to show this in two separate columns.

Now that the template has been created, you need to add a new page to host the sitemap. To create a new page in Shopify, follow these steps:

  1. From your Shopify admin panel, navigate to Online Store Pages and click the Add page button in the top right corner
  2. Add the page title Sitemap but leave the content section empty
  3. From the Template section on the right-hand side of the page, select page.sitemap
At last! Your sitemap page has been created, so the first thing you should do is check it out. You can do this by clicking the View page.

If you have any problems please leave your queries in the comment box.

Thank you.