bridgetown icon indicating copy to clipboard operation
bridgetown copied to clipboard

Pages which `paginate` are excluded from `collections.pages`

Open goulvench opened this issue 2 years ago • 5 comments

I have pages in the src/_pages/ folder which I list in a navigation partial. I fetch each page using collections.pages.resources_by_slug to access its title and URL. This is very practical because Bridgetown automatically gives me the localised title and URL (the website is generated in 2 locales).

However, when I add pagination in the frontmatter of a page, it disappears from collections.pages.

Bridgetown Version: bridgetown 1.3.1 "Kelly Butte"

goulvench avatar Sep 06 '23 15:09 goulvench

Current workaround: add a dummy page which kicks off pagination, but is mapped to the 404 page and not referenced from anywhere.

# Cannot use /404.html because it is already used by the real 404 page
permalink: /404/index.html
pagination:
  collection: <label>

goulvench avatar Sep 07 '23 15:09 goulvench

@goulvench Ah, I believe that's because it gets kicked over to site.generated_pages. I can't think of an immediate fix, but your workaround is definitely curious. How do the paginated page URLs work in this case?

jaredcwhite avatar Sep 07 '23 16:09 jaredcwhite

@jaredcwhite Good point! I was far from having 2 pages' worth of posts, so I hadn't noticed.

In the end I ditched pagination, the list page will list all posts, and individual posts have links to the previous/next post in_locale, which doesn't require pagination.

goulvench avatar Sep 07 '23 20:09 goulvench

Use case for why this is still relevant: https://github.com/bridgetownrb/bridgetown/pull/987#issuecomment-2755789948

jaredcwhite avatar Mar 27 '25 01:03 jaredcwhite

Not sure I can come up with a workaround off the top of my head, but I'll give this some thought.

jaredcwhite avatar Mar 27 '25 01:03 jaredcwhite