Splitting an article into multiple pages with a menu

I’m trying to implement almost the same thing that this topic. The solution for this topic is excellent! But if instead of “paginator, next/previous links,” on the bottom, I wanted a list of links (like a menu) for each page?

While answering questions here on the forum, I came up with a couple of approaches for multipage articles:

1) Topic 29161 (October 2020)

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

2) Topic 41042 (October 2022)

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

The first, which you reference in your post, uses Hugo’s pagination feature, and gives you the option to display a pager nav, or prev/next buttons.

I encourage you to look at the second example, which does not use pagination. Why? If you paginate other sections of your site, you may want to control all pagination from your base template. And if you do that, it will break the first example above.

Why would you want to control all pagination from your base template? To have access to paginator properties for meta elements within the head element of your template.

It’s complicated.

Discussion of challenge:
https://discourse.gohugo.io/t/determine-if-current-page-is-result-of-pagination/37494/4

One approach to address it:
https://discourse.gohugo.io/t/control-pagination-and-page-collections-from-baseof-html/37643/8

I’m sure we can up with something, but please decide which approach you will use first.

1 Like

Ok! First, I would like to say that I’m a newbie to Hugo. I cloned both repositories, and I’m testing them. Maybe by the bias of your message :-), I’m inclined to try the second solution.

Take this for a spin.

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