Skip to main content

A Sphinx extension to provide redirection to an entity by its ID.

Project description

Redirect By ID for Sphinx

This extension originated as part of the discussion in https://github.com/sphinx-doc/sphinx/issues/9574.

When building a Sphinx project into HTML, the permalinks on entities still contains the specific page the entity is located on, along with the ID of the entity. If the pages are later restructured and entities are moved to different pages, the old permalinks will be dead.

This extension adds a new page redirect.html which can be given an ID. The page will use the existing search index of the project to redirect to the page where the entity is located. For example, if you have a page api.html where a Python function f is documented, then its permalink may be https://example.com/api.html#f. If you then browse to https://example.api.html?q=f you will be redirected to https://example.com/api.html#f.

Installation

  1. Install the extension:

    python3 -m pip install sphinx-redirect-by-id

  2. Add it to conf.py:

    extensions = [
        'sphinx_redirect_by_id',
    ]
    

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-redirect-by-id-0.1.3.tar.gz (10.1 kB view hashes)

Uploaded Source

Built Distribution

sphinx_redirect_by_id-0.1.3-py3-none-any.whl (9.8 kB view hashes)

Uploaded Python 3

Supported by

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