Toggle blog view: Grid/Stacked

Highlighted
Shopify Expert
196 0 23

Looks like I forgot some endif tags:

 

<div id="pagination">
    
    {% if paginate.previous %}
      {% assign size = paginate.previous.url | split: '?' | size %}
      {% if size > 1 %}
        {% assign link_url = paginate.previous.url | append: '&blog_view=grid' %}
      {% else %}
        {% assign link_url = paginate.previous.url | append: '?blog_view=grid' %}
      {% endif %}
      {{ '<' | link_to: link_url }}
    {% endif %}
    {% for part in paginate.parts %}
    {% if part.is_link %}
      {% assign size = part.url | split: '?' | size %}
      {% if size > 1 %}
        {% assign link_url = part.url | append: '&blog_view=grid' %}
      {% else %}
        {% assign link_url = part.url | append: '?blog_view=grid' %}
      {% endif %}
      {{ part.title | link_to: link_url }}
    {% else %}
    {% if part.title == '&hellip;' %}
    {{ part.title }}
    {% else %}
    <span class="current">{{ part.title }}</span>
    {% endif %}
    {% endif %}
    {% endfor %}
    {% if paginate.next %}
      {% assign size = paginate.next.url | split: '?' | size %}
      {% if size > 1 %}
        {% assign link_url = paginate.next.url | append: '&blog_view=grid' %}
      {% else %}
        {% assign link_url = paginate.next.url | append: '?blog_view=grid' %}
      {% endif %}
    {{ '>' | link_to: link_url }}
    {% endif %}
  </div>
  
  {% endpaginate %}


</div>

 

Stop Stressing About Shopify You’ve Got Better Things To Do => https://320ny.com/shopify/
0 Likes
Shopify Partner
25 0 0

Hey Ryan,

 

Not getting an error anymore but it looks like the pagination issue is still there : /

 

I've left your most recent code live on my page if that could help you in any way!

 

Thanks,

-Sean

0 Likes
Shopify Expert
196 0 23

Sean,

The code above us being outputted with the stack view. You need to only output this with the grid view.

-Ryan

Stop Stressing About Shopify You’ve Got Better Things To Do => https://320ny.com/shopify/
0 Likes
Shopify Partner
25 0 0

Thanks so much, Ryan! That worked.

 

I ended up solving the issue by creating two separate pagination snippets and outputting them respectively.

 

I appreciate the help!

- Sean

0 Likes
Shopify Expert
196 0 23

Aweome! I'm gald we were about to get it working for you. 

Stop Stressing About Shopify You’ve Got Better Things To Do => https://320ny.com/shopify/
0 Likes