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

Bug: {{author}} & {{tags}} not showing up when using {{#prev_post}} or {{#next_post}} #5150

Closed
ireade opened this issue Apr 16, 2015 · 1 comment · Fixed by #5646
Closed
Labels
affects:api Affects the Ghost API bug [triage] something behaving unexpectedly

Comments

@ireade
Copy link

ireade commented Apr 16, 2015

Issue Summary

In my post.hbs, I wrote -

{{#prev_post}}
<h2>{{title}}</h2>
<h3>Posted on {{date format="D MMMM YYYY"}} by {{author}}</h3>
{{excerpt words="80"}}
{{/prev_post}}

Everything but the {{author}} was outputted.

Technical details

  • Ghost Version: master - latest commit: 9ea2f55
@ErisDS
Copy link
Member

ErisDS commented Apr 16, 2015

Hi @ireade thanks for the bug report. Good find, I'll betcha {{tags}} won't work either 😞

This is because when we fetch the next / prev post over the API, we do so with:

/api/posts/:id?include=prev or /api/posts/:id?include=next

Following this convention, if we want to include tags and authors in the response we'd need to tell the API to do that, something like:

/api/posts/:id?include=prev,prev.tags,prev.author or /api/posts/:id?include=next,next.tags,next.author

However, the API doesn't support this yet and I'm wondering if we ought to actually restructure this to be:

/api/posts/:id/prev?include=tags,author or /api/posts/:id/next?include=tags,author so that it's neater.

The difference between the first and the second version is the first fetches the main post (which we already have) along with it's next/previous post, where the latter would be more efficient and return only the requested post.

@ErisDS ErisDS added bug [triage] something behaving unexpectedly themes labels Apr 16, 2015
@ErisDS ErisDS changed the title Bug: {{author}} not showing up when using {{#prev_post}}{{/prev-post}} (Ghost 0.6.0) Bug: {{author}} & {{tags}} not showing up when using {{#prev_post}} or {{#next_post}} May 26, 2015
@ErisDS ErisDS added the affects:api Affects the Ghost API label Jul 10, 2015
ErisDS added a commit to ErisDS/Ghost that referenced this issue Aug 10, 2015
closes TryGhost#5150

- Post API understands next.author, next.tags, previous.author and previous.tags
- Post Read request filters out those properties and does the right thing with them
- Prev/Next post helpers send extra include properties
- Tests updated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects:api Affects the Ghost API bug [triage] something behaving unexpectedly
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants