Ghost: Dynamic Routing: prev/next helper should take collections into account

Created on 25 Oct 2018  ·  5Comments  ·  Source: TryGhost/Ghost

Reported here: https://forum.ghost.org/t/hiding-content-collection-in-suggested-posts/3716

Summary

If you define more than one collection, the prev/next helper shows posts from another collection.
The helper should take the collection configuration into account. That basically means, it has to use the filter from the target collection.

Steps to reproduce

  1. Add two collections.
  2. Filter by a tag.
  3. Use the prev/next helper.
  4. Serve a post from a collection. The helper shows posts from the other collection too.

I have not looked into a solution yet.

Ghost: master

bug later routing server / core

All 5 comments

I 👍 this issue. Here's my use case. I use a #newsletter collection with the RSS feed to power my mailing list. Since I'm the only author on my site, #newsletter stuff shows up in the next/previous posts.

Why was this closed? Will it be fixed?

// Adam

On Jan 24, 2019, at 03:50, Hannah Wolfe notifications@github.com wrote:

Closed #10059.


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

All issues tagged with routing have been tagged with later and closed until we prioritise working on the Routing feature again.

Any updates on this? Anything we can help on?

This issue is not something easily fixable and we'd need time to properly design where the "filter" piece of data would fit in template rendering process/state.

TLDR

Root of the problem has to do with how routing layer passes data to helpers like prev/next - during render stage helpers don't have enough information to know about collection route's filter.

Longer version

When the template is rendered in routing rendered here, it's the last place where res maintains state about collection route's filter.

To provide additional data all the way to prev/next helper (and other helpers if needed) we could use root property available in root state, similar to how context and apiVersion are passed around.

Note on reproduction steps

To reproduce 2 collection state:

  1. Use default Casper theme
  2. Upload following routes.yaml:
routes:
  /signup/: members/signup
  /signin/: members/signin
  /account/: members/account

collections:
  /one/:
    permalink: /one/{slug}/
    template: index
    filter: 'tag:one'
  /two/:
    permalink: /two/{slug}/
    template: index
    filter: 'tag:two'

taxonomies:
  tag: /tag/{slug}/
  author: /author/{slug}/
  1. Create multiple posts with tags "one" and "two"
  2. Navigate to http://localhost:2368/one/
  3. Navigate to any of the posts available in the collection
  4. Observe a bug on the bottom "prev/next" section
Was this page helpful?
0 / 5 - 0 ratings