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

Relate posts in a better way #251

Open
hash-ir opened this issue Jun 14, 2020 · 1 comment
Open

Relate posts in a better way #251

hash-ir opened this issue Jun 14, 2020 · 1 comment

Comments

@hash-ir
Copy link

hash-ir commented Jun 14, 2020

In v1.1.0, the Related Posts snippet in post.html lists the three posts, not in relation to the opened post. I thought of including a tag in the front matter e.g tag: Computer Science or tag: Fiction and then list the posts accordingly. How do I change the following code to incorporate this?

{% if site.related_posts.size >= 1 %}
<div class="related">
  <h2>Related posts</h2>
  <ul class="related-posts">
    {% for post in site.related_posts limit:3 %}
      <li>
        <h3>
          <a href="{{ site.baseurl }}{{ post.url }}">
            {{ post.title }}
            <small>{{ post.date | date_to_string }}</small>
          </a>
        </h3>
      </li>
    {% endfor %}
  </ul>
</div>
{% endif %}

Apologies if this is something very basic to ask. I don't have any web design experience but I am having my fun modifying the theme.

@JeremyRubin
Copy link

hi @hash-ir -- you most likely want to use the jekyll LSI to get semantically related posts. Look into using it https://frankindev.com/2019/11/21/enable-related-posts-with-lsi/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants