@bep Not sure if what i’m doing is the best practice, but here is my workaround
add the {{ $.Scratch.Set "type" "index" }} in my layouts/blog/list.html then move {{ $paginator := .Paginate (where .Data.Pages "Type" "blog") 7 }} from the layouts/blog/list.html into partial head `layouts/partials/heads/head.html, where i put the code for checking whether is paginated or not.
here is the complete code from the head
.html
<!-- ROBOTS -->
{{ if $.Scratch.Get "type" }}
{{ $paginator := .Paginate (where .Data.Pages "Type" "blog") 7 }}
{{ if not $paginator.HasPrev }}
<meta name="robots" content="index, follow">
{{ else }}
<meta name="robots" content="noindex, follow">
{{ end }}
{{ if $paginator.HasPrev }}
<link rel="prev" href="{{ .Paginator.Prev.URL }}">
{{ end }}
{{ if $paginator.HasNext }}
<link rel="next" href="{{ .Paginator.Next.URL }}">
{{ end }}
{{ end }}
It works, at least for now, is there better approach?
i’m struggling with similar problem.
I have meta partial where I need to find out whether current page is on paged state.
Down, deeper, in next partial I create paginator for some external data.
Is it even possible to find out in this “reversed” order?