IsPage check within list pagination loop

Hello All,
I’m trying to check whether a page is a regular content page. Check is handled within a partial template which is then included in both list and single pages, but in list pagination, it showing IsPage as true.

IsPage - {{ .IsPage }}
{{ range .Paginator.Pages.ByPublishDate.Reverse }}
{{ if ne .Type "page" }}       
    <section class="post post-list">
      <h1><a href="{{- .Permalink }}">{{- .Title }}</a></h1>
      IsPage - {{ .IsPage }}   
    </section>                 
{{ end }}
{{ end }}

Without seeing your code, have you tried {{ range site.RegularPages }} ?

.IsPage check will be later included in tags partial just below the h1 tag both in the list and single page for a conditional check.
list.html

IsPage - {{ .IsPage }}
{{ range .Paginator.Pages.ByPublishDate.Reverse }}
{{ if ne .Type "page" }}       
    <section class="post post-list">
      <h1><a href="{{- .Permalink }}">{{- .Title }}</a></h1>
      IsPage - {{ .IsPage }}   
    </section>                 
{{ end }}
{{ end }}

Screenshot_20190508_065940

This is untested, but instead of

{{ if ne .Type "page" }}  

Try

{{ if ne .Kind "page" }}  
1 Like

When you use the paginator: Pagination | Hugo

The simplest way is just to call .Paginator.Pages from a template. It will contain the pages for that page .

… so the Pages you are range-ing over are already only regular content pages (ie .IsPage true).

1 Like

A post was split to a new topic: Share a partial between a single page and a summary view