Skip to main content

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

Configure the Discourse prefix in your conf.py:

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

html_context = {
    "discourse_prefix": {
        "ubuntu": "https://discourse.ubuntu.com/t/",
        "lxc": "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

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 = [
    "sphinx_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.

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

© 2025 Canonical Ltd.

Metadata

Release files for sphinx-related-links 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sphinx-related-links 0.1.2
File Size Uploaded Provenance Actions
sphinx_related_links-0.1.2.tar.gz 84.2 kB With provenance Details for sphinx_related_links-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sphinx-related-links 0.1.2
File Interpreter ABI Platform Actions
sphinx_related_links-0.1.2-py3-none-any.whl Python 3 none any Details for sphinx_related_links-0.1.2-py3-none-any.whl

Total release size: 104.1 kB

Security for sphinx-related-links 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page