Skip to content
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

All collections using layout of first collections index found #209

Closed
samfoley88 opened this issue Nov 23, 2020 · 2 comments
Closed

All collections using layout of first collections index found #209

samfoley88 opened this issue Nov 23, 2020 · 2 comments

Comments

@samfoley88
Copy link

Trying to get multiple collections to paginate I'm getting some odd behaviour where it uses the layout in the first pagination request it finds for all pages.

So for instance I have a number of different collections and for each collection I have a folder with an index that is the same name as the collection but without the underscore.
So my events collection has _events with my markdown files and events with index.html that should display that collection. I have the same for "gallery" and "results" collections.

If I only activate pagination for one collection it works fine. As soon as I activate it for more than one the generated index.html's for every collection appear to use the first one it finds (in alphabetical order).

I've tested this by renaming folders and moving the pagination using index.html's around. Whichever index.html it hits first with pagination enabled becomes the one used for all of my index.html's that have collections enabled. Even if its in the root and called something else the same thing still happens.

My index.html's have similar front matter and pagination logic which is basically:

---
layout: page
title: Results
pagination:
  enabled: true
  collection: results
---
    
{% for result in paginator.posts %}
    <a href="{{ result.url }}">
        <h1 class="title results">
            {{ result.title }}
        </h1>
        <h6 class="date results">
            {{ result.date | date: "%A, %B %e, %Y at %I:%M%P" }}
        </h6>
    </a>
{% endfor %}

Posting in the hope I'm being stupid but happy to add more details and replication steps if nobody can correct me quickly. Also can post original code to an open repo if needed as its an open source project.

samfoley88 added a commit to samfoley88/2000-class-association.github.io that referenced this issue Nov 25, 2020
When other collection is used they trip over each other. Issue created at jekyll-paginate-v2: sverrirs/jekyll-paginate-v2#209
@salomvary
Copy link

@samfoley88 This seems to be a caching problem when using Jekyll 4. Until the maintainers release a fix you can use one of the forks from #182 or #195 as a workaround.

salomvary added a commit to salomvary/jekyll-paginate-v2 that referenced this issue Dec 19, 2020
Because Jekyll caches parsed templates by filename[1], not setting a
correct unique one will result in all generated pages being rendered
with the same template.

Fixes sverrirs#209.

[1] https://github.com/jekyll/jekyll/blob/67380a273888abaef96a1f37239e6a5f9eda8205/lib/jekyll/liquid_renderer/file.rb#L13
@samfoley88
Copy link
Author

@salomvary Looks good to me as a fix and definitely explains the issue, my workaround is working for me but I'll close this issue out as those pull requests will definitely fix it when they get approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants