README.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. Neighbor Articles Plugin for Pelican
  2. ====================================
  3. This plugin adds ``next_article`` (newer) and ``prev_article`` (older)
  4. variables to the article's context
  5. Installation
  6. ------------
  7. To enable, ensure that ``neighbors.py`` is in somewhere you can ``import``.
  8. Then use the following in your `settings`::
  9. PLUGINS = ["neighbors"]
  10. Or you can put the plugin in ``plugins`` folder in pelican installation. You
  11. can find the location by typing::
  12. python -c 'import pelican.plugins as p, os; print os.path.dirname(p.__file__)'
  13. Once you get the folder, copy the ``neighbors.py`` there and use the following
  14. in your settings::
  15. PLUGINS = ["pelican.plugins.neighbors"]
  16. Usage
  17. -----
  18. .. code-block:: html+jinja
  19. <ul>
  20. {% if article.prev_article %}
  21. <li>
  22. <a href="{{ SITEURL }}/{{ article.prev_article.url}}">
  23. {{ article.prev_article.title }}
  24. </a>
  25. </li>
  26. {% endif %}
  27. {% if article.next_article %}
  28. <li>
  29. <a href="{{ SITEURL }}/{{ article.next_article.url}}">
  30. {{ article.next_article.title }}
  31. </a>
  32. </li>
  33. {% endif %}
  34. </ul>