Let users decide how Hugo has to name paginated pages

Maybe introducing a new entry for the configuration file (hugo.toml) ?

Thanks

Here is my problem:

I would like my website pagination URLs to be: http://localhost:1313/ subfolder/page-#

And not: http://localhost:1313/subfolder/page/#

How can I reach this result?

I tried editing the configuration file (hugo.toml), setting ’ paginatePath = “/page-:num” ’ , but whatever I enter in quotes it’s wrapped in slashes.

The paginatePath variable in my hugo.toml is set to “pg”, and it yields the result of putting paginated pages at subfolder/pg/#

I’d suggest trying to remove your leading slash in your variable. It might be confusing it since Hugo creates them as subpages anyway.

Edit: Adding that you may want to think about a new structure if you plan to update your hugo installation. I just did so with mine because I updated using the latest deb file and started getting depreciation notices. My new structure:

...
[pagination]
path = "pg"
pagerSize = 7

Seemed to replicate my preference so far.

just to clarify:

the op wants the change the last part of the path. initially from: folder/pagenum to folder-pagenum

see: How to change Hugo's naming convention of paginated pages?

This can’t be done currently (IMHO) with Hugo internals. You will need some form of rewriting on the server you are using. With Apache 2 this would be relatively easy. Depends on the server type.

You could use aliases, but in the end the users will land on /page/num by redirection.

1 Like

I was wondering. Tried OP’s method and also some random internet suggestions and nothing worked like OP wanted when I tried it.

Maybe sometime in the future Hugo will support it. I think grouping all the pagination functions in the site configs could be a sign that there’s future plans to opening up pagination customization more.