From 07d94a4aa79cfb27f30506060853ee1ce7685257 Mon Sep 17 00:00:00 2001 From: Andrea Longo Date: Fri, 6 Oct 2023 10:26:35 -0600 Subject: [PATCH] sphinx-reredirects redirect for mc admin top (#1027) Add `sphinx-reredirects` extension and create a redirect for the former `reference/minio-mc-admin/mc-admin-top.rst`. To install locally: ``` pip3 install sphinx-reredirects ``` To test: - Go to the old URL. - You are redirected to the new deprecated URL. Example: ``` http://192.241.195.202:9000/staging/DOCS-896-redirects/linux/reference/minio-mc-admin/mc-admin-top.html ``` redirects to ``` http://192.241.195.202:9000/staging/DOCS-896-redirects/linux/reference/deprecated/mc-admin-top.html ``` The redirect is server-side, browser without JS still gets the correct redirected page. --- requirements.txt | 3 ++- source/default-conf.py | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 5cc79ce8..c2d6f72a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,8 @@ Sphinx-Substitution-Extensions == 2020.9.30.0 sphinx-sitemap == 2.5.0 sphinx-togglebutton === 0.3.2 sphinxcontrib-images === 0.9.4 +sphinx_reredirect === 0.1.2 myst-parser === 1.0.0 linkify === 1.4 linkify-it-py === 2.0.0 -pyyaml === 6.0 \ No newline at end of file +pyyaml === 6.0 diff --git a/source/default-conf.py b/source/default-conf.py index 4a21eeae..a3344853 100644 --- a/source/default-conf.py +++ b/source/default-conf.py @@ -43,6 +43,7 @@ extensions = [ 'myst_parser', 'sphinx_design', 'sphinx.ext.intersphinx', + 'sphinx_reredirects', ] # -- External Links @@ -195,6 +196,14 @@ images_config = { 'override_image_directive' : True } +# sphinx-reredirects redirect rules +# `.rst` for source assumed in the rules +# `.html` for target must be included +redirects = { + "reference/minio-mc-admin/mc-admin-top": "../deprecated/mc-admin-top.html" +} + + # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for