Hi Everyone.
Pagination is working and displaying the blog-posts on all language versions of Blog-list page.
But, the Pager (Previous,1,2,3…,Next) is not working on translated versions of Blog-list page.
It’s working on only Default-language Blog-list page.
Multi-lingual content structure = file-based (file.en.md, file.es.md)
Is this a Hugo-bug?
Any solution?
I’m using Pager-code via a Partial. Partial’s code:
{{ $pag := $.Paginator }}
{{ if gt $pag.TotalPages 1 }}
<nav class="flex" aria-label="pagination">
<ul class="pagination pagination-alt !mb-0">
{{ range $pag.Pagers }}
{{ if eq . $pag }}
<li class="page-item active page-link">{{ .PageNumber }}</li>
{{ else }}
<li class="page-item"><a class="page-link" href="{{ absURL .URL }}">{{ .PageNumber }}</a></li>
{{ end }}
{{ end }}
</ul>
<!-- /.pagination -->
</nav>
<!-- /nav -->
{{ end }}
irkode
July 17, 2024, 4:52pm
2
I have updated my original post with source-code. Is it sufficient?
If I’m missing something then kindly let me know.
Regards
irkode
July 17, 2024, 5:40pm
4
You use a paginator but I cannot see the call to the paginating template.
If that does not help:
you said
Not working on translated list page but an all others
Multilingual setup
A set of pages templates and partials involved …
How should we recreate your setup?
Best share your repo or a downstripped version wher we can reproduce the problem.
irkode
July 17, 2024, 6:38pm
7
Rather this one
{{ template "_internal/pagination.html" . }}
And the complete repo.
At least me won’t dig in that by trying to rewrite what you already have written.
I don’t have this one:
{{ template "_internal/pagination.html" . }}
I’ll update you with a downstripped version later.
irkode
July 17, 2024, 7:04pm
9
It’s mentioned in the docs I sent
I don’t have this _internal folder in my hugo directory. Shall I create this and put a pagination.html file there? If yes, then what should be the content of this file? Please clarify.
irkode
July 17, 2024, 8:04pm
11
Thats the internal template. It creates the pagination links as written in the doc
Just call it as is. If the rest of your stuff fits it should work
Somewher in the docs if i remember the code or at least a how to get is listed.
I don’ know it by heart.
I already tried it.
After putting this template-code after the {{ end }}, the Blog-list page generates as an empty page.
Zero HTML code inside it.