Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pelican-plugins/related-posts
Related Posts is a Pelican plugin that adds a list of related posts to an article.
https://github.com/pelican-plugins/related-posts
Last synced: 3 months ago
JSON representation
Related Posts is a Pelican plugin that adds a list of related posts to an article.
- Host: GitHub
- URL: https://github.com/pelican-plugins/related-posts
- Owner: pelican-plugins
- Created: 2020-08-29T08:28:56.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-07-07T18:47:55.000Z (7 months ago)
- Last Synced: 2024-10-02T21:16:21.356Z (4 months ago)
- Language: Python
- Homepage:
- Size: 15.6 KB
- Stars: 6
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
- awesome-pelican - related-posts - related-posts)](https://pypi.org/project/pelican-related-posts) | [pelican-plugins](https://github.com/pelican-plugins) | Related Posts is a Pelican plugin that adds a list of related posts to an article (Plugins / Migrated to new architecture)
README
Related Posts: A Plugin for Pelican
===================================[![Build Status](https://img.shields.io/github/actions/workflow/status/pelican-plugins/related-posts/main.yml?branch=main)](https://github.com/pelican-plugins/related-posts/actions) [![PyPI Version](https://img.shields.io/pypi/v/pelican-related-posts)](https://pypi.org/project/pelican-related-posts/)
Related Posts is a Pelican plugin that adds a list of related posts to an article by adding a `related_posts` variable to the article’s context.
Installation
------------This plugin can be installed via:
python -m pip install pelican-related-posts
Usage
-----By default, up to five related articles are listed. You can customize this value by defining `RELATED_POSTS_MAX` in your settings file:
RELATED_POSTS_MAX = 10
You can then use the `article.related_posts` variable in your templates. For example:
{% if article.related_posts %}
- {{ related_post.title }}
{% for related_post in article.related_posts %}
{% endfor %}
{% endif %}
Your related posts should share a common tag. You can also use `related_posts:` in your post’s meta-data. The `related_posts:` meta-data works together with your existing slugs:
related_posts: slug1, slug2, slug3, ... slugN
`N` represents the `RELATED_POSTS_MAX` value.
Additionally, you can specify the following in your settings file:
RELATED_POSTS_SKIP_SAME_CATEGORY = True
With this setting, `article.related_posts` will contain only related posts from categories other than the original article's.
Contributing
------------
Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on [existing issues][].
To start contributing to this plugin, review the [Contributing to Pelican][] documentation, beginning with the **Contributing Code** section.
[existing issues]: https://github.com/pelican-plugins/related-posts/issues
[Contributing to Pelican]: https://docs.getpelican.com/en/latest/contribute.html