Skip to content

Relate posts in a better way #251

Open
@hash-ir

Description

@hash-ir

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions