For loop getting limited to the first 50 results

Highlighted
New Member
2 0 0

```{% for article in blog.articles %}
  {% capture length %}{{ forloop.length  }}{% endcapture %}
  {% if article.tags contains "featured" %}
     // Content
  {% endif %}
{% endfor %}```

`forloop.length` is showing 50 and `{{ blog.articles_count }}` shows 154. Any article outside of the first 50 that has a tag 'featured' isn't shown here.

0 Likes
Highlighted
Shopify Expert
9852 98 1617

Getting 50 items is the normal behaviour, since it's the max items you can grab with paginiation. If you need to filter by a tag you'd be better off just using the .../tagged/foo url and gett the tagged items directly.

★ Winning Partner of the Build a Business competition. ★ http://freakdesign.com.au
0 Likes
Highlighted
Shopify Staff
Shopify Staff
368 0 33

Hello Kyle, Ben here - your Shopify Guru!

 Jason is right! There is an API limit when retreiving Products/Pages/Articles of 50 this is normal. You might want to look at adding some paging code to let your users see the next 50 posts. 

Our documentation on how to use this feature can be found here:
https://docs.shopify.com/themes/liquid-documentation/tags/theme-tags#paginate
https://docs.shopify.com/themes/liquid-documentation/objects/paginate

I hope this helps! Feel free to reach out if you have any further questions :)

Cheers,
Ben C - Shopify Guru
Support@Shopify.com

0 Likes
Highlighted
Shopify Partner
1 0 0

Hello, is this "50 items" the way in which you would display multiple blog posts on the same page? i basically have a blog page but there is only one blog post visable with a read more section. I would like the page to have the blogs listed underneith each other with the most recent one at the top??

0 Likes
Highlighted
New Member
2 0 0

Hey Benjamin & Jason,

Thanks! I think I didn't describe what was happening very well. I want to display all of the articles tagged featured above the other posts. There are only and will only ever be 3 posts that are tagged featured but unless they are within the first 50 articles they wont show up in that list.

How can I get that loop to go through all articles to return all 3 articles no matter the date?

Is there a better way to grab the 3 tagged items that I'm not thinking of that isn't going to a new URL?

Thanks,
Kyle

0 Likes
Highlighted
Shopify Partner
40 0 5

For anyone coming here from Google, here is the exact url:

 

https://www.shopname.com/blogs/news/tagged/example-tag?page=1&limit=250

 

"News" is whatever your blog is called. 

0 Likes