Odd behaviour with multiple collection pagination

I’m aiming to use 3 collections, talks, teaching and projects, and have set up talks and teaching so far, where the pagination itself works and calls different collections. I have _teaching and _talks folders with all the collection md files.

I’m getting an odd behaviour where the first index that jekyll generates it then uses for both collections. See screenshots below from localhost build. In the case shown below, the Teaching page shows the Talks page header and lead text. This isnt browser cache, its in the generated html index for teaching.

  • Initially I had html files in the root calling the collection pages: teaching.html and talks.html. This seemed to work well, its based on the Daniel Sieger tutorial.
  • Then I tried using includes for the collection calls, it made no difference.
  • Then I tried the recommended method of folders without the leading underscore and index.html inside (with nothing in those files). It made no difference.
  • I have also tried messing about with the pagination setting for name of index file - but this isnt relevant to this issue (its for the generated pages only afaik.)
  • I have tried different ways of adding a paginate path to front matter pagination attributes - paginate_path: "/teaching/page:num" and permalink: /:num/ in the teaching.html and talks.html files. It makes no difference.
  • I have added empty index.md files to the underscore folder collections folders, but again, I don’t think this is relevant to this problem.

It’s exactly the same problem as this entry on SO from 2020:
https://stackoverflow.com/questions/64977602/how-to-paginate-multiple-collections-in-jekyll

One of the later comments on that thread refers to page.content being overwritten -

Running into the same issue, but looking into details I find that paginator updates, but page.content of the respective page is always overwritten with the first one. So different paginators on each of the pages, but the same page.content - very strange. – squarespiral
CommentedJun 11, 2021 at 14:12

Screenshots:


  1. The TALKS page, with header and lead text.


  1. The TEACHING page - includes the Talks header and lead text.


Tech info:

Including the Gemlock to show the build:

PATH
  remote: .
  specs:
    minima (3.0.0.dev)
      jekyll (>= 3.5, < 5.0)
      jekyll-feed (~> 0.9)
      jekyll-seo-tag (~> 2.1)

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.8.7)
      public_suffix (>= 2.0.2, < 7.0)
    colorator (1.1.0)
    concurrent-ruby (1.3.4)
    em-websocket (0.5.3)
      eventmachine (>= 0.12.9)
      http_parser.rb (~> 0)
    eventmachine (1.2.7)
    ffi (1.17.0-x64-mingw-ucrt)
    forwardable-extended (2.6.0)
    http_parser.rb (0.8.0)
    i18n (1.14.6)
      concurrent-ruby (~> 1.0)
    jekyll (4.3.4)
      addressable (~> 2.4)
      colorator (~> 1.0)
      em-websocket (~> 0.5)
      i18n (~> 1.0)
      jekyll-sass-converter (>= 2.0, < 4.0)
      jekyll-watch (~> 2.0)
      kramdown (~> 2.3, >= 2.3.1)
      kramdown-parser-gfm (~> 1.0)
      liquid (~> 4.0)
      mercenary (>= 0.3.6, < 0.5)
      pathutil (~> 0.9)
      rouge (>= 3.0, < 5.0)
      safe_yaml (~> 1.0)
      terminal-table (>= 1.8, < 4.0)
      webrick (~> 1.7)
    jekyll-feed (0.17.0)
      jekyll (>= 3.7, < 5.0)
    jekyll-paginate-v2 (3.0.0)
      jekyll (>= 3.0, < 5.0)
    jekyll-sass-converter (2.2.0)
      sassc (> 2.0.1, < 3.0)
    jekyll-seo-tag (2.8.0)
      jekyll (>= 3.8, < 5.0)
    jekyll-watch (2.2.1)
      listen (~> 3.0)
    kramdown (2.4.0)
      rexml
    kramdown-parser-gfm (1.1.0)
      kramdown (~> 2.0)
    liquid (4.0.4)
    listen (3.9.0)
      rb-fsevent (~> 0.10, >= 0.10.3)
      rb-inotify (~> 0.9, >= 0.9.10)
    mercenary (0.3.6)
    pathutil (0.16.2)
      forwardable-extended (~> 2.6)
    public_suffix (5.1.1)
    rb-fsevent (0.11.2)
    rb-inotify (0.11.1)
      ffi (~> 1.0)
    rexml (3.3.9)
    rouge (3.30.0)
    safe_yaml (1.0.5)
    sassc (2.4.0)
      ffi (~> 1.9)
    terminal-table (3.0.2)
      unicode-display_width (>= 1.1.1, < 3)
    unicode-display_width (2.6.0)
    wdm (0.2.0)
    webrick (1.9.1)

PLATFORMS
  x64-mingw-ucrt

DEPENDENCIES
  bundler
  jekyll-paginate-v2
  jekyll-sass-converter (~> 2.0)
  minima!
  wdm (>= 0.1.0)

BUNDLED WITH
   3.4.9
```![2024-12-15 10_01_18-localhost_4000_pen-oer_talks_ - Brave|642x500](upload://9eSDCBrWZqTVLR1b1TlLsiKTCG.png)

Just updating to note progress for benefit of other readers. I note the following:

Calling front matter page title and adding lead text as a front matter description and removing all ‘hard coded’ headings and text from each layout template means each is generated accurately to html index files.

Front matter:

---
layout: base
title: Talks and Conferences
description: "Some leader text here"
pagination:
    enabled: true
    collection: talks
    permalink: /:num/
---

html / liquid:

<div class="">
  {%- if page.title -%}
    <h2 class="page-header">{{ page.title }}</h2>
  {%- endif -%}

  {%- if page.description -%}
    <p class="">{{ page.description}}</p>
  {%- endif -%}
</div>

If you shared your code it would be easier to help you. It seems you already sorted it out.

Tx for replying.

Im posting in case of benefit to others as the SO post has 1000 views. My solution will sort my own problem atm but the next thing Ill do when I next have time is test different ways of doing the template layout. If that fails to refresh for each index then my current solution isnt really a help.

This is the ‘old’ Talks template original code, the Teaching template just had different text in the h1 and p. The pagination works fine in each collection (getting that from the FM), and uses the same paginator.posts call:


<h1>Talks, conferences and seminars</h1>
<h4>Presentations about Education and Technology</h4>
<p>A collection of slide presentations for conferences, seminars and workshop events.</p>

<div class="grid-box"> 
    {% for pub in paginator.posts %}
    <!-- grid one -->
    <div class="grid-item">
        <a href="{{pub.url | prepend: site.baseurl }}">
            <img src="{{ site.imagesurl | prepend: site.baseurl }}{{ pub.slug }}.png" alt="{{pub.slug}} publication teaser" />
        </a>        
        <div class="pubmeta-short">
            <strong>Author:</strong> {{ pub.authors }}
            <br />
            <strong>Source:</strong> {{ pub.publication }}
            <br />
            <strong>Year:</strong> {{ pub.year}}
        </div>

        <h5> {{ pub.title }}</h5>

        <div class="publinks">
            <strong>
            {% if pub.slides %}
            <a href="{{ site.slidesurl | prepend: site.baseurl }}{{ pub.slug }}_slides.pdf"><i class="far fa-file-pdf"></i> Slides</a>&nbsp;&nbsp;
            {% endif %}
            <a href="{{pub.url | prepend: site.baseurl }}"><i class="fas fa-arrow-right"></i> Project Page</a>
            </strong>
        </div>
    </div>
    {% endfor %} 
</div>


  <div>
<!-- Showing buttons to move to the next and to the previous list of posts (pager buttons) -->
  {% if paginator.total_pages > 1 %}
  <ul class="pagination">

      {% if paginator.page_trail %}
        {% for trail in paginator.page_trail %}
          <li {% if page.url == trail.path %}class="selected"{% endif %}>
              <a href="{{ trail.path | prepend: site.baseurl | replace: '//', '/' }}" title="{{trail.title}}">{{ trail.num }}</a>
          </li>
        {% endfor %}
      {% endif %}
  </ul>
  {% endif %}
</div>