Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/honzajavorek/rtd-redirects
Manage redirects in the ReadTheDocs admin, programmatically
https://github.com/honzajavorek/rtd-redirects
documentation documentation-tool mkdocs readthedocs sphinx-doc
Last synced: about 1 month ago
JSON representation
Manage redirects in the ReadTheDocs admin, programmatically
- Host: GitHub
- URL: https://github.com/honzajavorek/rtd-redirects
- Owner: honzajavorek
- License: mit
- Created: 2017-06-30T14:23:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-07-14T06:23:44.000Z (over 3 years ago)
- Last Synced: 2024-09-30T22:15:26.391Z (about 2 months ago)
- Topics: documentation, documentation-tool, mkdocs, readthedocs, sphinx-doc
- Language: Python
- Size: 112 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
rtd-redirects
=============Manage redirects in the `ReadTheDocs `__ admin, programmatically. Addressing the `rtfd/readthedocs.org#2904 `__ issue.
Installation
------------Requires **Python 3.6** and higher.
.. code:: sh
$ pip install rtd-redirects
Usage
-----.. code:: sh
$ rtd-redirects project-name ./redirects.yml --username=honzajavorek
Uploads redirects defined in the ``redirects.yml`` file to ReadTheDocs redirects administration of the ``project-name`` project.
The tool uses ReadTheDocs' HTML interface (there's no official API for redirects), so you need to provide your username and password. HTTPS is used to transfer the credentials to ReadTheDocs.
``rtd-redirects`` tries to be idempotent, i.e. you can run it several times in row and it should always end with the same results. If there are any redirects with the same source path, the tool will replace them with whatever is defined in the ``redirects.yml`` file. Existing redirects which do not collide with contents of ``redirects.yml`` won't be affected.
redirects.yml
-------------Only **page redirects** are supported at the moment. The format of the file is as follows:
.. code:: yaml
redirects:
# we've migrated from MkDocs to Sphinx
"/example/": "/example.html"
"/python/": "/python.html"# page removed in favor of section
"/green.html": "/colors.html#green"# only for convenience
"/praha.html": "/prague.html"Why `YAML `__? Because it's easy to read by humans, easy to write by humans, and above all, it has support for comments. Redirects are *corrections* and you should document why they're necessary.
Usage with ReadTheDocs PRO
--------------------------If you are using a commercial edition of the RTD (from ``readthedocs.com`` instead of ``readthedocs.org``), please specify ``--pro`` flag in the command, like this
.. code:: sh
$ rtd-redirects project-name ./redirects.yml --username=honzajavorek --pro
There is also an opposite flag ``--free`` which is added by default, so can be omitted
License: MIT
------------© 2017-? Honza Javorek [email protected]
This work is licensed under `MIT
license `__.