簡體   English   中英

Shopify / Liquid - 計算博客中的文章而無需分頁

[英]Shopify / Liquid - Count articles in blog without pagination

我有一個博客,里面有 28 篇關於 Shopify 的文章。 我為博客分頁了 5 篇文章,即{% paginate blog.articles by 5 %}

我正在嘗試統計博客中的文章數量,並嘗試了以下兩種方法:

方法一:


{% for article in blog.articles %}
  {% assign count = count | plus: 1 %}
{% endfor %}

{{ count }}

方法二:

{{ blog.articles.size }}

我面臨的問題是,在這兩種情況下,output 都是 5。我期望的答案是 28 - 顯然它只是計算頁面中的文章數量。 我也在嘗試按標簽過濾,我想在其中查看標簽搜索的結果數量。 任何解決方案將不勝感激。

當然,您需要檢查默認的 Shopify 液體 object blog及其名為blog.articles_count articles_count文檔鏈接。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM