Static related contents - Properdocs / MkDocs plugin
A plugin for Properdocs / MkDocs, the static site generator, which computes, for every tagged page, a list of related pages based on shared tags, and exposes it to the Jinja context so your theme can render a "Related content" / "See also" section.
Installation
pip install mkdocs-related-content
Usage
Then in your mkdocs.yml:
plugins:
- related-content
Example
Two pages sharing a tag:
# docs/api-auth.md
---
tags:
- API
- authentication
- Python
---
# docs/api-oauth.md
---
tags:
- API
- oAuth
---
Both pages api-auth.md and api-oauth.md share the api tag: each will list the other as related content (Jaccard similarity score of 0.25), regardless of the order pages are declared in nav.
Development
Once you cloned the repository:
# install project as editable
python -m pip install -e .
# including development dependencies
python -m pip install -e .[dev]
# including documentation dependencies
python -m pip install -e .[docs]
# including testing dependencies
python -m pip install -e .[test]
# all inclusive
python -m pip install -e .[dev,docs,test]
# install git hooks
pre-commit install
Then follow the contribution guidelines.
Run the tests
# install development dependencies
python -m pip install -e .[test]
# run tests
pytest
Build the documentation
# install dependencies for documentation
python -m pip install -e .[docs]
# build the documentation
mkdocs build
Release workflow
- Fill the
CHANGELOG.md - Change the version number in
__about__.py - Apply a git tag with the relevant version:
git tag -a 0.3.0 {git commit hash} -m "New awesome feature" - Push tag to main branch:
git push origin 0.3.0
Metadata
Release files for mkdocs-related-content-plugin 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mkdocs_related_content_plugin-0.2.0.tar.gz | 55.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mkdocs_related_content_plugin-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 76.9 kB