Shopify博客获得50多篇文章
我有一个shopify博客,里面有150多篇文章Shopify博客获得50多篇文章,shopify,Shopify,我有一个shopify博客,里面有150多篇文章 {% assign countItem = 0 %} {% for article in blogs.recipes.articles %} {% if countItem < 3 %} {% if article.tags contains product.title %} {% assign countItem = countItem | plus: 1 %} <li cla
{% assign countItem = 0 %}
{% for article in blogs.recipes.articles %}
{% if countItem < 3 %}
{% if article.tags contains product.title %}
{% assign countItem = countItem | plus: 1 %}
<li class="article">
<a href="{{ article.url }}">
<img src="{{ article | img_url: 'grande' }}" alt="{{ article.title }}" />
<span class="title">{{ article.title }}</span>
</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{%assign countItem=0%}
{blogs.recipes.articles%中的文章为%s}
{%如果countItem<3%}
{%如果article.tags包含product.title%}
{%assign countItem=countItem | plus:1%}
{%endif%}
{%endif%}
{%endfor%}
但是blogs.recipes.articles
只返回50
有没有办法消除这个限制?Shopify将结果限制为50,以平衡服务器负载。根据shopify文档 不要将一个集合分页超过50页,这是您每页最多应该查询的产品数。尊重Shopify的应用服务器。如果您没有使用任何分页标签,分页确实会在后台启动,您将只收到所述集合中的前50个产品 但是,我尝试使用paginate标签加载50多个产品。但这会降低页面加载速度,而且如果记录数量很大,页面可能会变得无响应。您可以按以下方式进行尝试:-
{% paginate blogs.recipes.articles by 500 %}
{% assign countItem = 0 %}
{% for article in blogs.recipes.articles %}
{% if countItem < 3 %}
{% if article.tags contains product.title %}
{% assign countItem = countItem | plus: 1 %}
<li class="article">
<a href="{{ article.url }}">
<img src="{{ article | img_url: 'grande' }}" alt="{{ article.title }}" />
<span class="title">{{ article.title }}</span>
</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% endpaginate %}
{%paginate blogs.recipes.articles以500%为单位]
{%assign countItem=0%}
{blogs.recipes.articles%中的文章为%s}
{%如果countItem<3%}
{%如果article.tags包含product.title%}
{%assign countItem=countItem | plus:1%}
{%endif%}
{%endif%}
{%endfor%}
{%endpaginate%}
Shopify将结果限制为50,以平衡服务器负载。根据shopify文档
不要将一个集合分页超过50页,这是您每页最多应该查询的产品数。尊重Shopify的应用服务器。如果您没有使用任何分页标签,分页确实会在后台启动,您将只收到所述集合中的前50个产品
但是,我尝试使用paginate标签加载50多个产品。但这会降低页面加载速度,而且如果记录数量很大,页面可能会变得无响应。您可以按以下方式进行尝试:-
{% paginate blogs.recipes.articles by 500 %}
{% assign countItem = 0 %}
{% for article in blogs.recipes.articles %}
{% if countItem < 3 %}
{% if article.tags contains product.title %}
{% assign countItem = countItem | plus: 1 %}
<li class="article">
<a href="{{ article.url }}">
<img src="{{ article | img_url: 'grande' }}" alt="{{ article.title }}" />
<span class="title">{{ article.title }}</span>
</a>
</li>
{% endif %}
{% endif %}
{% endfor %}
{% endpaginate %}
{%paginate blogs.recipes.articles以500%为单位]
{%assign countItem=0%}
{blogs.recipes.articles%中的文章为%s}
{%如果countItem<3%}
{%如果article.tags包含product.title%}
{%assign countItem=countItem | plus:1%}
{%endif%}
{%endif%}
{%endfor%}
{%endpaginate%}
工作,谢谢你的时间工作,谢谢你的时间