Error in building after adding new post due to pagination

Hi, I am trying to build a blog with the Poison theme. I have some basic single About/Publication pages (as seen on the live version here) set up but am struggling to add blog posts under content/posts. This is what the content folder looks like currently:

content
├── _index.md
├── about
│   └── _index.md
├── landing
│   └── _index.md
├── posts
│   ├── _index.md
│   └── pii-kaggle.md
└── publications
    └── _index.md

pii-kaggle.md is the post I am trying to write, the front-matter looks like the following:

+++
title = 'Classifying personally identifiable information (PII) in essays: a Kaggle debrief'
date = 2024-06-22T19:32:50-04:00
draft = false
+++

On building, this is the error I get:

Error: error building site: render: failed to render pages: render of "page" failed: "/Users/muhammadali/blog/hugo/layouts/_default/baseof.html:1:3": execute of template failed: template: _default/single.html:1:3: executing "_default/single.html" at <partial "head/head.html" .>: error calling partial: "/Users/muhammadali/blog/hugo/layouts/partials/head/head.html:16:7": execute of template failed: template: partials/head/head.html:16:7: executing "partials/head/head.html" at <partial "head/meta.html" .>: error calling partial: "/Users/muhammadali/blog/hugo/layouts/partials/head/meta.html:96:17": execute of template failed: template: partials/head/meta.html:96:17: executing "partials/head/meta.html" at <.Paginate>: error calling Paginate: pagination not supported for this page: kind: "page", path: "/posts/pii-kaggle", file: "/Users/muhammadali/blog/hugo/content/posts/pii-kaggle.md"

It seems to be an issue with pagination on kind: "page", I do not know where this kind is set for my markdown file and what needs to be fixed with my pagination configuration to make this work. To help debug, I am providing the directory structure of the layouts directory and line 97 from partials/head/meta.html below.

layouts
├── 404.html
├── _default
│   ├── _markup
│   │   └── render-link.html
│   ├── baseof.html
│   ├── list.html
│   └── single.html
├── about
│   └── about.html
├── index.html
├── partials
│   ├── head
│   │   ├── css.html
│   │   ├── favicon.html
│   │   ├── head.html
│   │   ├── meta.html
│   │   ├── scripts.html
│   │   └── stylesheets.html
│   ├── light_dark.html
│   ├── pagination.html
│   ├── post
│   │   ├── comments.html
│   │   ├── info.html
│   │   ├── listmonk_email_newsletters.html
│   │   └── navigation.html
│   ├── sidebar
│   │   ├── menu.html
│   │   ├── sidebar.html
│   │   ├── socials.html
│   │   └── title.html
│   └── table_of_contents.html
├── projects
│   └── projects.html
└── shortcodes
    ├── mermaid.html
    ├── plantuml.html
    ├── tab.html
    └── tabs.html
--- inside partials/head/meta.html ---
{{ if eq .Section "posts" }}
<!-- Pagination meta tags for list pages only -->
{{ $paginator := .Paginate (where .Pages "Type" "posts") }}
{{ if $paginator }}
  <link rel="first" href="{{ $paginator.First.URL }}" />
  <link rel="last" href="{{ $paginator.Last.URL }}" />
  {{ if $paginator.HasPrev }}
    <link rel="prev" href="{{ $paginator.Prev.URL }}" />
  {{end }}
  {{ if $paginator.HasNext }}
    <link rel="next" href="{{ $paginator.Next.URL }}" />
  {{end }}
{{end }}

Happy to provide more code snippets if anything is unclear. Appreciate the help debugging this!

Okay, it seems that the theme’s repo has a fix that I copy-pasted and it works. That first line in meta.html needs to change from {{ if eq .Section "posts" }} to {{ if and (eq .Section "posts") (.Page.IsNode) }}.

Even though the specific error is fixed, I’d appreciate anyone here gently teaching me why this got fixed.

the change skips all normal pages (your blog posts) because you cannot paginate on a normal page

with a bare setup and without the fix it will try to paginate:

Page(/posts)
Page(/posts/pii-kaggle)     <- isNode := false

with the patch

Page(/posts)

Thank you! Where can I read more about page types? I’d like that pages within content/posts should be of type post and not a normal page (e.g. About). I believe such pages are called lists in Hugo? Appreciate any pointers on what the right way to configure these is.

Start with:

In section Content Management | Hugo

Follow the links. Make sure you get the difference between type and kind

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.