Add redirects to new documentation website
Signed-off-by: James Munnelly <james@munnelly.eu>
This commit is contained in:
parent
a1fa913d48
commit
ff75e6bcbf
73
docs/_ext/externalredirect.py
Normal file
73
docs/_ext/externalredirect.py
Normal file
@ -0,0 +1,73 @@
|
||||
"""
|
||||
externalredirect
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Generate redirects to external files based on a single 'external_redirects' file
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from sphinx.builders import html as builders
|
||||
from sphinx.builders import linkcheck as linkcheckbuilders
|
||||
from sphinx.util import logging
|
||||
|
||||
TEMPLATE = """<html>
|
||||
<head><meta http-equiv="refresh" content="0; url=%s"/></head>
|
||||
</html>
|
||||
"""
|
||||
|
||||
|
||||
def generate_external_redirects(app, exception):
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
path = os.path.join(app.srcdir, app.config.external_redirects_file)
|
||||
if not os.path.exists(path):
|
||||
logger.info("Could not find redirects file at '%s'" % path)
|
||||
return
|
||||
|
||||
in_suffix = app.config.source_suffix
|
||||
if isinstance(in_suffix, list):
|
||||
in_suffix = in_suffix[0]
|
||||
if isinstance(in_suffix, dict):
|
||||
logger.info("app.config.source_suffix is a dictionary type. "
|
||||
"Defaulting source_suffix to '.rst'")
|
||||
in_suffix = ".rst"
|
||||
|
||||
if type(app.builder) == linkcheckbuilders.CheckExternalLinksBuilder:
|
||||
logger.info("Detected 'linkcheck' builder in use so skipping generating redirects")
|
||||
return
|
||||
|
||||
if not (type(app.builder) == builders.StandaloneHTMLBuilder or type(app.builder) == builders.DirectoryHTMLBuilder):
|
||||
logger.warn("The 'sphinxcontib-redirects' plugin is only supported "
|
||||
"by the 'html' and 'dirhtml' builder, but you are using '%s'. Skipping..." % type(app.builder))
|
||||
|
||||
dirhtml = False
|
||||
if type(app.builder) == builders.DirectoryHTMLBuilder:
|
||||
dirhtml = True
|
||||
|
||||
with open(path) as redirects:
|
||||
for line in redirects.readlines():
|
||||
from_path, to_url = line.rstrip().split(' ')
|
||||
|
||||
logger.info("Redirecting '%s' to '%s'" % (from_path, to_url))
|
||||
|
||||
if dirhtml:
|
||||
from_path = from_path.replace(in_suffix, '/index.html')
|
||||
else:
|
||||
from_path = from_path.replace(in_suffix, '.html')
|
||||
|
||||
logger.info("Resolved redirect '%s' to '%s'" % (from_path, to_url))
|
||||
|
||||
redirected_filename = os.path.join(app.builder.outdir, from_path)
|
||||
redirected_directory = os.path.dirname(redirected_filename)
|
||||
if not os.path.exists(redirected_directory):
|
||||
os.makedirs(redirected_directory)
|
||||
|
||||
logger.info("Writing to '%s'" % redirected_filename)
|
||||
with open(redirected_filename, 'w') as f:
|
||||
f.write(TEMPLATE % to_url)
|
||||
|
||||
|
||||
def setup(app):
|
||||
app.add_config_value('external_redirects_file', 'external_redirects', 'env')
|
||||
app.connect('build-finished', generate_external_redirects)
|
||||
@ -26,8 +26,8 @@
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
# import os
|
||||
# import sys
|
||||
import os
|
||||
import sys
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
@ -48,12 +48,15 @@ release = u''
|
||||
#
|
||||
# needs_sphinx = '1.0'
|
||||
|
||||
sys.path.append(os.path.abspath("./_ext"))
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'sphinx.ext.todo',
|
||||
'sphinxcontrib.redirects',
|
||||
"externalredirect",
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
|
||||
64
docs/external_redirects
Normal file
64
docs/external_redirects
Normal file
@ -0,0 +1,64 @@
|
||||
devel/index.rst https://cert-manager.netlify.com/docs/contributing/
|
||||
devel/release-process.rst https://cert-manager.netlify.com/docs/contributing/release-process/
|
||||
devel/generate-docs.rst https://cert-manager.netlify.com/docs/contributing/
|
||||
devel/end-to-end-tests.rst https://cert-manager.netlify.com/docs/contributing/kind/
|
||||
devel/dco-sign-off.rst https://cert-manager.netlify.com/docs/contributing/sign-off/
|
||||
devel/dns01-providers.rst https://cert-manager.netlify.com/docs/contributing/dns-providers/
|
||||
devel/develop-with-minikube.rst https://cert-manager.netlify.com/docs/contributing/kind/
|
||||
index.rst https://cert-manager.netlify.com/docs/
|
||||
design/index.rst https://cert-manager.netlify.com/docs
|
||||
tasks/index.rst https://cert-manager.netlify.com/docs/configuration/
|
||||
tasks/uninstall/kubernetes.rst https://cert-manager.netlify.com/docs/tutorials/uninstall/kubernetes/
|
||||
tasks/uninstall/index.rst https://cert-manager.netlify.com/docs/tutorials/uninstall/
|
||||
tasks/uninstall/openshift.rst https://cert-manager.netlify.com/docs/tutorials/uninstall/openshift/
|
||||
tasks/issuers/index.rst https://cert-manager.netlify.com/docs/configuration/
|
||||
tasks/issuers/setup-ca.rst https://cert-manager.netlify.com/docs/configuration/ca/
|
||||
tasks/issuers/setup-selfsigned.rst https://cert-manager.netlify.com/docs/configuration/selfsigned/
|
||||
tasks/issuers/setup-acme/index.rst https://cert-manager.netlify.com/docs/configuration/acme/
|
||||
tasks/issuers/setup-acme/dns01/azuredns.rst https://cert-manager.netlify.com/docs/configuration/acme/dns01/azuredns/
|
||||
tasks/issuers/setup-acme/dns01/index.rst https://cert-manager.netlify.com/docs/configuration/acme/dns01/
|
||||
tasks/issuers/setup-acme/dns01/cloudflare.rst https://cert-manager.netlify.com/docs/configuration/acme/dns01/cloudflare/
|
||||
tasks/issuers/setup-acme/dns01/rfc2136.rst https://cert-manager.netlify.com/docs/configuration/acme/dns01/rfc2136/
|
||||
tasks/issuers/setup-acme/dns01/acme-dns.rst https://cert-manager.netlify.com/docs/configuration/acme/dns01/acme-dns/
|
||||
tasks/issuers/setup-acme/dns01/route53.rst https://cert-manager.netlify.com/docs/configuration/acme/dns01/route53/
|
||||
tasks/issuers/setup-acme/dns01/akamai.rst https://cert-manager.netlify.com/docs/configuration/acme/dns01/akamai/
|
||||
tasks/issuers/setup-acme/dns01/digitalocean.rst https://cert-manager.netlify.com/docs/configuration/acme/dns01/digitalocean/
|
||||
tasks/issuers/setup-acme/dns01/webhook.rst https://cert-manager.netlify.com/docs/configuration/acme/dns01/webhook/
|
||||
tasks/issuers/setup-acme/dns01/google.rst https://cert-manager.netlify.com/docs/configuration/acme/dns01/google/
|
||||
tasks/issuers/setup-acme/http01/index.rst https://cert-manager.netlify.com/docs/configuration/acme/http01/
|
||||
tasks/issuers/setup-vault.rst https://cert-manager.netlify.com/docs/configuration/vault/
|
||||
tasks/issuers/setup-venafi.rst https://cert-manager.netlify.com/docs/configuration/venafi/
|
||||
tasks/upgrading/index.rst https://cert-manager.netlify.com/docs/TODO
|
||||
tasks/upgrading/upgrading-0.4-0.5.rst https://cert-manager.netlify.com/docs/TODO
|
||||
tasks/upgrading/upgrading-0.8-0.9.rst https://cert-manager.netlify.com/docs/TODO
|
||||
tasks/upgrading/upgrading-0.5-0.6.rst https://cert-manager.netlify.com/docs/TODO
|
||||
tasks/upgrading/upgrading-0.6-0.7.rst https://cert-manager.netlify.com/docs/TODO
|
||||
tasks/upgrading/upgrading-0.2-0.3.rst https://cert-manager.netlify.com/docs/TODO
|
||||
tasks/upgrading/upgrading-0.3-0.4.rst https://cert-manager.netlify.com/docs/TODO
|
||||
tasks/upgrading/upgrading-0.9-0.10.rst https://cert-manager.netlify.com/docs/TODO
|
||||
tasks/upgrading/upgrading-0.7-0.8.rst https://cert-manager.netlify.com/docs/TODO
|
||||
tasks/upgrading/upgrading-0.10-0.11.rst https://cert-manager.netlify.com/docs/TODO
|
||||
tasks/backup-restore-crds.rst https://cert-manager.netlify.com/docs/tutorials/backup/
|
||||
tasks/issuing-certificates/index.rst https://cert-manager.netlify.com/docs/usage/certificate/
|
||||
tasks/issuing-certificates/ingress-shim.rst https://cert-manager.netlify.com/docs/usage/ingress/
|
||||
getting-started/index.rst https://cert-manager.netlify.com/docs/installation/
|
||||
getting-started/install/kubernetes.rst https://cert-manager.netlify.com/docs/installation/kubernetes/
|
||||
getting-started/install/index.rst https://cert-manager.netlify.com/docs/installation/
|
||||
getting-started/install/openshift.rst https://cert-manager.netlify.com/docs/installation/openshift/
|
||||
getting-started/webhook.rst https://cert-manager.netlify.com/docs/faq/webhook/
|
||||
tutorials/index.rst https://cert-manager.netlify.com/docs/tutorials/
|
||||
tutorials/venafi/securing-ingress.rst https://cert-manager.netlify.com/docs/tutorials/venafi/venafi/
|
||||
tutorials/acme/index.rst https://cert-manager.netlify.com/docs/tutorials/acme/ingress/
|
||||
tutorials/acme/dns-validation.rst https://cert-manager.netlify.com/docs/tutorials/acme/dns-validation/
|
||||
tutorials/acme/migrating-from-kube-lego.rst https://cert-manager.netlify.com/docs/tutorials/acme/migrating-from-kube-lego/
|
||||
tutorials/acme/http-validation.rst https://cert-manager.netlify.com/docs/tutorials/acme/http-validation/
|
||||
tutorials/acme/quick-start/index.rst https://cert-manager.netlify.com/docs/tutorials/acme/ingress/
|
||||
reference/index.rst https://cert-manager.netlify.com/docs/concepts/
|
||||
reference/challenges.rst https://cert-manager.netlify.com/docs/concepts/acme-orders-challenges/
|
||||
reference/clusterissuers.rst https://cert-manager.netlify.com/docs/concepts/issuer/
|
||||
reference/cainjector.rst https://cert-manager.netlify.com/docs/concepts/ca-injector/
|
||||
reference/issuers.rst https://cert-manager.netlify.com/docs/concepts/issuer/
|
||||
reference/certificaterequests.rst https://cert-manager.netlify.com/docs/concepts/certificaterequest/
|
||||
reference/certificates.rst https://cert-manager.netlify.com/docs/concepts/certificate/
|
||||
reference/orders.rst https://cert-manager.netlify.com/docs/concepts/acme-orders-challenges/
|
||||
reference/api-docs/index.rst https://cert-manager.netlify.com/docs/reference/api-docs/
|
||||
Loading…
Reference in New Issue
Block a user