Blogs Pagination Not Working by main-blog.liquid./ページネーションエラー(blogs)

Topic summary

Issue Identified:
A user encountered a Liquid error stating “Array ‘blog.articles’ is not paginateable” after creating a custom section by copying code from main-blog.liquid into a new file named main-blog-slim.

Root Cause:
The pagination code ({%- paginate blog.articles by 6 -%}) only functions correctly within the actual blog page context where blogs are being called. It cannot work in arbitrary custom sections or templates outside this specific context.

Resolution:
The problem was resolved after understanding that the copied code requires the proper blog page environment to access and paginate blog.articles.

Status: Solved ✓

Summarized with AI on November 17. AI used: claude-sonnet-4-5-20250929.

Liquid error (sections/main-blog-slim line 25): Array ‘blog.articles’ is not paginateable.

I am getting this error when I created a custome section and copied code by main-blog.liquid.

(Japanese) 新しいセクションを作成し、main-blog.liquid のコードをコピーした際にこのエラーが表示されました。

{{ 'component-article-card.css' | asset_url | stylesheet_tag }}
{{ 'component-card.css' | asset_url | stylesheet_tag }}
{{ 'section-main-blog.css' | asset_url | stylesheet_tag }}

{%- style -%}
  .section-{{ section.id }}-padding {
    padding-top: {{ section.settings.padding_top | times: 0.75 | round: 0 }}px;
    padding-bottom: {{ section.settings.padding_bottom | times: 0.75 | round: 0 }}px;
  }

  @media screen and (max-width: 749px) {
    .title--primary {
      font-size: 25px;
    }
  }
  
  @media screen and (min-width: 750px) {
    .section-{{ section.id }}-padding {
      padding-top: {{ section.settings.padding_top }}px;
      padding-bottom: {{ section.settings.padding_bottom }}px;
    }
  }
{%- endstyle -%}

{%- paginate blog.articles by 6 -%}
  <div class="main-blog page-width section-{{ section.id }}-padding">
    <h1 class="title--primary{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--fade-in{% endif %}">
      {{ blog.title | escape }}
    </h1>

    <div class="blog-articles {% if section.settings.layout == 'collage' %}blog-articles--collage{% endif %}">
      {%- for article in blog.articles -%}
        <div
          class="blog-articles__article article{% if settings.animations_reveal_on_scroll %} scroll-trigger animate--slide-in{% endif %}"
          {% if settings.animations_reveal_on_scroll %}
            data-cascade
            style="--animation-order: {{ forloop.index }};"
          {% endif %}
        >
          {%- render 'article-card',
            article: article,
            media_height: section.settings.image_height,
            media_aspect_ratio: article.image.aspect_ratio,
            show_image: section.settings.show_image,
            show_date: section.settings.show_date,
            show_author: section.settings.show_author,
            show_excerpt: true
          -%}
        </div>
      {%- endfor -%}
    </div>

    {%- if paginate.pages > 1 -%}
      {%- render 'pagination', paginate: paginate -%}
    {%- endif -%}
  </div>
{%- endpaginate -%}

{% schema %}
{
  "name": "ブログ記事(テキストのみ)",
  "tag": "section",
  "class": "section",
  "settings": [
    {
      "type": "checkbox",
      "id": "show_date",
      "default": true,
      "label": "t:sections.main-blog.settings.show_date.label"
    },
    {
      "type": "checkbox",
      "id": "show_author",
      "default": false,
      "label": "t:sections.main-blog.settings.show_author.label"
    },
    {
      "type": "checkbox",
      "id": "show_dest",
      "default": false,
      "label": "抜粋分を表示する"
    },
    {
      "type": "checkbox",
      "id": "news_list_category",
      "default": false,
      "label": "カテゴリーを表示する"
    },
    {
      "type": "paragraph",
      "content": "t:sections.main-blog.settings.paragraph.content"
    },
    {
      "type": "header",
      "content": "t:sections.all.padding.section_padding_heading"
    },
    {
      "type": "range",
      "id": "padding_top",
      "min": 0,
      "max": 100,
      "step": 4,
      "unit": "px",
      "label": "t:sections.all.padding.padding_top",
      "default": 36
    },
    {
      "type": "range",
      "id": "padding_bottom",
      "min": 0,
      "max": 100,
      "step": 4,
      "unit": "px",
      "label": "t:sections.all.padding.padding_bottom",
      "default": 36
    }
  ],
    "presets": [
      {
        "name": "ブログ記事(テキストのみ)"
      }
    ]
}
{% endschema %}

Line 25 is this code below.

(Japanese) 25行目のコードは下記です。

{%- paginate blog.articles by 6 -%}

Is it not possible to use “blog.articles” in a custom section because it’s not a global object?

If you know there’s an alternatives, please let me know.

(Japanese) blog.articlesはグローバルオブジェクトではないので、自作のセクションには使用できないのでしょうか?

(Japanese) 他に使用方法がありましたら教えてください。

1 Like

Hi @FABEA

It seems like your creating a new main-blog file and name it main-blog-slim? If you do, you cannot expect this code to work in any part of your store. This code only works in the blog page as you are calling the blogs.

If it helps, likes and mark as solution is appreciated :blush:

1 Like

Thank you for your comments. The problem has been solved!