Skip to content

Builtin pagination template doesn´t work with sub root in BaseURL and CanonifyUrls = "false" #1252

@donlzx

Description

@donlzx

If .Site.BaseURL contain paths (e.g., example.com/en/), pagination doesn't work correctly. The variables URL, Next.URL, Prev.URL, etc. return incorrect values in the pagination templates, resulting in the following behavior:

http://example.com/en/products/page/2/ (correct link) => http://example.com/products/page/2/ (links in generated pages)

I make it working by hacking the source code (hugolib/pagination.go) around line 276:

urlFactory := newPaginationURLFactory(section)

modified as:

urlFactory := newPaginationURLFactory(helpers.RelURL(section))

Since I am new to Hugo and haven't looked at the source codes before, can someone check this issue and fix it in a correct way?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions