docs: Add config for redirecting pages.

We want to be able to move pages around and have sphinx automatically
redirect to the now location when that happens.  This will allow us to
re-organize safely as we figure out the best way to layout the
documentation.
This commit is contained in:
Feanil Patel
2023-07-12 17:08:48 -04:00
parent 472104a1a6
commit cee0e75566
4 changed files with 14 additions and 0 deletions

View File

@@ -20,3 +20,11 @@ clean:
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
update_redirects:
# This updates redirects.txt, creating redirects for any files that have moved (relative to master).
sphinx-build -b rediraffewritediff "$(SOURCEDIR)" "$(BUILDDIR)"
check_redirects:
# Check to make sure that any files that got moved have a redirect in redirects.txt
sphinx-build -b rediraffecheckdiff "$(SOURCEDIR)" "$(BUILDDIR)"

View File

@@ -62,11 +62,16 @@ extensions = [
'sphinx.ext.mathjax',
'sphinx.ext.napoleon',
'sphinxcontrib.openapi',
'sphinxext.rediraffe',
'sphinx_design',
'code_annotations.contrib.sphinx.extensions.featuretoggles',
'code_annotations.contrib.sphinx.extensions.settings',
]
# Rediraffe related settings.
rediraffe_redirects = "redirects.txt"
rediraffe_branch = 'origin/master'
# code_annotations.(featuretoggles|settings) related settings.
edxplatform_repo_url = "https://github.com/openedx/edx-platform"
edxplatform_source_path = os.path.abspath(

View File

View File

@@ -7,3 +7,4 @@ gitpython # fetch git repo information
Sphinx # Documentation builder
sphinx-design # provides various responsive web-components
sphinxcontrib-openapi[markdown] # Be able to render openapi schema in a sphinx project
sphinxext-rediraffe # Quickly and easily redirect when we move pages around.