Skip to main content

A Sphinx extension for adding related links to documentation pages.

Project description

sphinx-related-links

sphinx-related-links adds functionality to Sphinx that allows adding related links on a per-page basis, supporting both Discourse topic links and custom related URLs.

Basic usage

Adding Discourse links

Configure the Discourse prefix in your conf.py:

html_context = {
    "discourse_prefix": "https://discuss.linuxcontainers.org/t/"
}

Add the desired Discourse topic IDs to the page's metadata. For MyST files, this is done with frontmatter.

---
discourse: 12033,13128
---

For rST sources, metadata content can be added with the following syntax:

:discourse: 12033, 13128

Adding custom related links

Add URLs to page metadata:

---
relatedlinks: https://www.example.com, https://www.google.com
---

Project setup

sphinx-related-links is published on PyPI and can be installed with:

pip install sphinx-related-links

After adding sphinx-related-links to your Python project, update your Sphinx's conf.py file to include sphinx-related-links as one of its extensions:

extensions = [
    "related_links"
]

Lastly, update your Sphinx project's templates to include the metadata content in the right-hand sidebar. This will depend on your project's theme. An example template can be seen in this project's integration tests.

Community and support

You can report any issues or bugs on the project's GitHub repository.

sphinx-related-links is covered by the Ubuntu Code of Conduct.

License and copyright

sphinx-related-links is released under the GPL-3.0 license.

© 2025 Canonical Ltd.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_related_links-0.0.8.tar.gz (84.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_related_links-0.0.8-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page