Splitting an article into multiple pages

I am breaking my head over this right now. I am writing a really long article about some technical stuff and I just want to have multiple pages. Sure, I could use multiple articles basically, but my front page shows the latest articles and I don’t want 5 entries of 1 topic in a category.

I have tried to use a leaf bundle for that with this structure:

my-post
--- index.md (first page)
--- page-2.md

However, linking to page 2 proves difficult as the page somehow does not exist:

[next part]({{< relref "/blog/my-post/page-2.md" >}})

ERROR [en] REF_NOT_FOUND:

If I rename index.md to page-1.md it builds, but only page-2.md gets shown on the front page as the latest article.

Is there a better solution to this?

1 Like

If you name it index.md then this becomes a page bundle. page-2.md will be treated as a Page-type resource, and will not have a Permalink. See: Page bundles | Hugo and Page resources | Hugo

You may want to turn this into a _index.md instead, so that the child pages are published and navigable, but you may have to modify your layout listing templates.

Here’s a working minimal example. See the README for details.

git clone --single-branch -b hugo-forum-topic-29161 https://github.com/jmooring/hugo-testing hugo-forum-topic-29161
cd hugo-forum-topic-29161
hugo server
7 Likes

Thanks for doing this Joe. I really appreciate that.

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