Hide Section on pagination pages / Show on Blog page

Solved

Hide Section on pagination pages / Show on Blog page

maslerdanch
Tourist
9 0 0

 

{% if page.url == "/blogs/news" %}
<div class="rows"> {% section 'featured-post' %} </div>
{% endif %}

 

On the front page /blogs/news I want to display a section.

But want to hide it from all following paginated pages /blogs/news?page=1 /blogs/news?page=2 etc. 

Accepted Solution (1)
B2Bridge
Explorer
335 67 82

This is an accepted solution.

Use this instead:

 {% if paginate.current_page == 1 %}
    <div class="rows"> {% section 'featured-post' %} </div>
{% endif %}

B2Bridge: All-in-one B2B wholesale solution, enabling merchants to set up a complete B2B store quickly and without coding.
With features like customizable registration forms, customer segmentation, and tailored price lists, it simplifies wholesale management.
B2Bridge also includes a dedicated Quick Order page and flexible Net Payment Terms, streamlining operations for wholesalers and enhancing the buying experience.

View solution in original post

Replies 6 (6)

FrankyGiap
Shopify Partner
88 15 12

Hi @maslerdanch ,

you can try to using this code:

{% if page.url contains "/blogs/news" %}
<div class="rows"> {% section 'featured-post' %} </div>
{% endif %}
- Solved it? Hit Like and Accept solution or ❤️Buy Me Coffee❤️
- Fusion Workflow: Automate Your Store with Precision and Ease
maslerdanch
Tourist
9 0 0

That hides the section completely on all pages. 

I was thinking the following but that doesn't work either. 

  {% if paginate.pages < 1 %}
    <div class="rows"> {% section 'featured-post' %} </div>
{% endif %}

 

B2Bridge
Explorer
335 67 82

This is an accepted solution.

Use this instead:

 {% if paginate.current_page == 1 %}
    <div class="rows"> {% section 'featured-post' %} </div>
{% endif %}

B2Bridge: All-in-one B2B wholesale solution, enabling merchants to set up a complete B2B store quickly and without coding.
With features like customizable registration forms, customer segmentation, and tailored price lists, it simplifies wholesale management.
B2Bridge also includes a dedicated Quick Order page and flexible Net Payment Terms, streamlining operations for wholesalers and enhancing the buying experience.

maslerdanch
Tourist
9 0 0

Nailed it - thank you!

B2Bridge
Explorer
335 67 82

We're happy to see that our suggestion helped you solve the issue. Can you mark it as a solution?

B2Bridge: All-in-one B2B wholesale solution, enabling merchants to set up a complete B2B store quickly and without coding.
With features like customizable registration forms, customer segmentation, and tailored price lists, it simplifies wholesale management.
B2Bridge also includes a dedicated Quick Order page and flexible Net Payment Terms, streamlining operations for wholesalers and enhancing the buying experience.

maslerdanch
Tourist
9 0 0

Thanks - And subscribed! Gratefully appreciated.