-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Theme API: make {{nextpost}}
{{prevpost}}
available to themes
#529
Comments
Anyone got any clever ideas for how to do this? ATM I'm thinking one of:
In the former, every post page does 2 extra fetches for data, forever. Even though we will have caching, that's a bit bleh. In the latter, content gets loaded in dynamically and only when it's actually requested - but over ajax which will be a slower request I guess. Also makes it harder to know where what came from when, and I don't think it will be as usable. Any other ideas? |
So I decided to go with just loading the 2 extra posts on every post page. This way, it's just data that is available by default and not a handlebars helper. The problem with doing this is building the query as at the moment I can't find a way to pass anything other than straight '=' style where clauses, other operators require 3 args. If we upgrade to bookshelf 0.2.5 we get a function syntax which is useful, but basically, we need to rejig findPage quite a lot, into our own dynamic interface to query builder. That is, create a way we can define complex arguments in JSON and then have findPage call relevant query builder functions with each argument. The JSON -> query builder stuff should probably be a base function so we can use it later for building fancy queries for other objects. This will be a separate issue, which this issue will depend on. Punting to 0.4 for now. |
closes TryGhost#529 makes previous and nextpost available when a post has been selected
I think it should be possible to revisit this now that knex properly supports subqueries. |
Closing in favour of #4262 |
We need to have some way to get hold of all the details of the next and previous post on the post page.
This means providing access to all properties of those two models through something like
{{#nextpost}}
{{title}}
{{/nextpost}}
The text was updated successfully, but these errors were encountered: