-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Builtin pagination template doesn´t work with sub root in BaseURL and CanonifyUrls = "false" #1252
Comments
I'm pretty sure the Next.URL etc. are relative to |
@bep Actually, I mean the final URL in the generated pages. Fixed my description. |
And how do you construct the "full URL"? |
For testing, I'm just using the default internal template and nothing special:
The full URLs are constructed by the browser. To be exact, the links to the pages in generated HTML looks like:
It should be:
|
OK, now I understand it. The current workaround is to either set
https://github.com/spf13/hugo/blob/master/hugolib/pagination.go#L367 |
@bep Using |
Hmm, that sound a little bit strange. I guess this should be a safe bet, too: https://github.com/spf13/hugo/blob/master/hugolib/pagination.go#L273 |
Note/Update: This issue is marked as stale, and I may have said something earlier about "opening a thread on the discussion forum". Please don't. If this is a bug and you can still reproduce this error on the latest If this is a feature request, and you feel that it is still relevant and valuable, please tell us why. |
This is a pretty fundamental change in Hugo, but absolutely needed if we should have any hope of getting "multiple outputs" done. This commit's goal is to say: * Every file target path is created by `createTargetPath`, i.e. one function for all. * That function takes every page and site parameter into account, to avoid fragile string parsing to uglify etc. later on. * The path creation logic has full test coverage. * All permalinks, paginator URLs etc. are then built on top of that same logic. Fixes gohugoio#1252 Fixes gohugoio#2110 Closes gohugoio#2374 Fixes gohugoio#1885 Fixes gohugoio#3102 Fixes gohugoio#3179 Fixes gohugoio#1641 Fixes gohugoio#1989
I still have the same issue in 0.20-DEV with the default paginator. |
Yes, it's fixed been since the 0.20 release. Update your Hugo version. The latest is 0.25.1. |
Sorry! I thought I had the latest version... |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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:
modified as:
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?
The text was updated successfully, but these errors were encountered: