-
-
Notifications
You must be signed in to change notification settings - Fork 155
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
Posts paginator error, fails on hugo server --buildDrafts #165
Comments
See: hugo-sid/hugo-blog-awesome#165 For a related bug on another theme, see: AmazingRise/hugo-theme-diary#177
I encountered this error too when previewing the example site. Quickly I realized that this error happens with hugo version v0.123.7 only. With hugo 0.122.0, preview of the example site works fine. |
I had some time left this morning so I looked into the issue and found that since v0.123.0 Hugo no longer allows pages of kind "Page" to create a .Paginate or .Paginator. {{ if ne .Page.Kind "page" }}
{{ $paginator := .Paginate (where .Pages "Section" "posts") }}
{{ if $paginator }}
<link rel="first" href="{{ $paginator.First.URL }}" />
<link rel="last" href="{{ $paginator.Last.URL }}" />
{{ if $paginator.HasPrev }}
<link rel="prev" href="{{ $paginator.Prev.URL }}" />
{{end }}
{{ if $paginator.HasNext }}
<link rel="next" href="{{ $paginator.Next.URL }}" />
{{end }}
{{end }}
{{end }} The only addition is the inclusion of an if-statement to check what kind of page we're on and prevent creation of the paginator on any pages of kind "page". This makes it possible for your posts overview (e.g. /posts) to create a paginator and use that in the post.html instantiaton, resulting in the |
Describe the bug
Seems like there is an error with the paginator, I'm new to using this theme and first time I encountered this issue.
Steps to reproduce
Steps to reproduce the behavior:
hugo new content
commandhugo server --buildDrafts
Expected behavior
Should properly serve with build drafts argument on dev server
Screenshots
The lines that causes the error inside
themes\hugo-blog-awesome\layouts\partials\meta\post.html
:Device information
The text was updated successfully, but these errors were encountered: