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: site.related_posts not work (0.15.beta) #78

Closed
zealot128 opened this issue Jun 14, 2020 · 3 comments
Closed

Bug: site.related_posts not work (0.15.beta) #78

zealot128 opened this issue Jun 14, 2020 · 3 comments
Labels
bug Something isn't working high priority This should get addressed as soon as possible.

Comments

@zealot128
Copy link
Contributor

Followed the documentation to show related posts below, but the variable {{ site.related_posts }} (as well as {{ page.related_posts }}, {{ related_posts }} is always empty (Output of all {{ site.related_posts | inspect }} is nil).

Bridgetown Version:

bridgetown 0.15.0.beta3 "Overlook"

To Reproduce

  • having couple of posts
<!-- _layouts/post.html -->
---
layout: default
---
   <strong>Related posts</strong>
    <ul>
      {% for post in site.related_posts %}
        <li>
          <a href='{{post.url}}'>{{post.title}}</a>
          <small>{{post.date}} &ndash; {{post.tags}}</small>
        </li>
      {% endfor %}
    </ul>

Fix/Workaround

Add , :related_posts to

def_delegators :@obj, :id, :output, :content, :to_s, :relative_path, :url, :date

Then, the variable {{ page.related_posts }} works (But not the site.related_posts according to the documentation).

@zealot128 zealot128 added the bug Something isn't working label Jun 14, 2020
@jaredcwhite jaredcwhite added the high priority This should get addressed as soon as possible. label Jun 15, 2020
@jaredcwhite jaredcwhite added this to the v0.15.0 "Overlook" milestone Jun 15, 2020
@jaredcwhite
Copy link
Member

Thanks for the report @zealot128. 👍 We'll look into this.

@jaredcwhite
Copy link
Member

Your fix/workaround is exactly what was needed! Also, the documentation was incorrect…it is supposed to be page.related_posts, not site.related_posts. Both are now included in 0.15.0.beta4 release.

@zealot128
Copy link
Contributor Author

Awesome, keep up the good work! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working high priority This should get addressed as soon as possible.
Projects
None yet
Development

No branches or pull requests

2 participants