Readme.rst 859 B

12345678910111213141516171819202122232425262728
  1. Related posts
  2. -------------
  3. This plugin adds the ``related_posts`` variable to the article's context.
  4. By default, up to 5 articles are listed. You can customize this value by
  5. defining ``RELATED_POSTS_MAX`` in your settings file::
  6. RELATED_POSTS_MAX = 10
  7. You can then use the ``article.related_posts`` variable in your templates.
  8. For example::
  9. {% if article.related_posts %}
  10. <ul>
  11. {% for related_post in article.related_posts %}
  12. <li><a href="{{ SITEURL }}/{{ related_post.url }}">{{ related_post.title }}</a></li>
  13. {% endfor %}
  14. </ul>
  15. {% endif %}
  16. You can also override related posts by using it as part of your post's meta data 'related_posts:'.
  17. The 'related_posts:' meta data works together with your existing slugs:
  18. related_posts: slug1,slug2,slug3...slugN
  19. N represents the RELATED_POSTS_MAX