Adding HTML Sitemap to Footer of Website?

Tourist
5 0 0

It's a great solution my friend, and it works for me .... almost!

Actually, I can see only a part of the "all products" say the first 40's - and there are 300. 

Do you have any idea why the others don't appear?

You talked about 2 columns and I m not so good in codes. May you explain me better how to do it?

 

Thank you very much!

0 Likes
New Member
1 0 0

Hi all,

 

I had the same problem, and i've found a guide here: https://answers.squarespace.com/questions/21067/generate-html-sitemap.html

 

You can follow this method to get all of your links properly extracted, but you do need to organize and style it afterwards.

0 Likes
Tourist
4 1 1

Hi - it's because Shopify limits 'for loops' to return a max of 50 results. You can get around this by adding a pagination limit. Here's the section of amended code which will return up to 1000 products:

 

{% paginate collections.all.products by 1000 %}
  {% for product in collections.all.products %}
  	<li>
    <a href="{{ product.url }}">{{ product.title }}</a>
 	 </li>
  {% endfor %}
{% endpaginate %}

You just change the number in {% paginate collections.all.products by 1000 %} to whatever the max number of products you have e.g. {% paginate collections.all.products by 500%} will return up to 500 products.

 

Here's the full code:

<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>
              
{% paginate collections.all.products by 1000 %}
  {% for product in collections.all.products %}
  	<li>
    <a href="{{ product.url }}">{{ product.title }}</a>
 	 </li>
  {% endfor %}
{% endpaginate %}

            </ul> 
          </div>
    </div>
      </div>
    </div>
  </div>
</div>
0 Likes