Skip to content

Ignore broken links and allow redirects #1005

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Dec 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 42 additions & 11 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,55 @@
# Set to '' to prevent appending "documentation" to the site title
html_title = ""

linkcheck_allowed_redirects = {
# Edit page
r"https://docs.google.com/document/d/.*/": r"https://docs.google.com/document/d/.*/edit",
# Canonical
r"https://docs.python.org/": r"https://docs.python.org/3/",
# Translations with country codes
r"https://docs.python.org/[a-z-]+/": r"https://docs.python.org/[a-z-]+/3/",
# Personal /my/ links redirect to login page
r"https://discuss.python.org/my/.*": r"https://discuss.python.org/login-preferences",
# Login page
r"https://github.com/python/core-workflow/issues/new.*": r"https://github.com/login.*",
# Archive redirect
r"https://github.com/python/cpython/archive/main.zip": r"https://codeload.github.com/python/cpython/zip/refs/heads/main",
# Blob to tree
r"https://github.com/python/cpython/blob/.*": r"https://github.com/python/cpython/tree/.*",
# HackMD shortcuts
r"https://hackmd.io/s/.*": r"https://hackmd.io/@.*",
# Read the Docs
r"https://virtualenv.pypa.io/": r"https://virtualenv.pypa.io/en/latest/",
r"https://www.sphinx-doc.org/": r"https://www.sphinx-doc.org/en/master/",
# Cookie consent
r"https://www.youtube.com/playlist.*": r"https://consent.youtube.com/ml.*",
}

# ignore linkcheck anchors for /#/$ANCHOR since it is used for
# dynamic pages such as http://buildbot.python.org/all/#/console
# http://www.sphinx-doc.org/en/stable/config.html?highlight=linkcheck#confval-linkcheck_anchors_ignore
linkcheck_anchors_ignore = [
# match any anchor that starts with a '/' since this is an invalid HTML anchor
r'\/.*',
]

linkcheck_ignore = [
# The voters repo is private and appears as a 404
'https://github.com/python/voters/',
# The python-core team link is private, redirects to login
'https://github.com/orgs/python/teams/python-core',
# The Discourse groups are private unless you are logged in
'https://discuss.python.org/groups/staff',
'https://discuss.python.org/groups/moderators',
'https://discuss.python.org/groups/admins',
# The crawler gets "Anchor not found" for GitHub anchors
r'https://github.com.+?#L\d+',
r'https://github.com/cli/cli#installation',
r'https://github.com/github/renaming#renaming-existing-branches',
# Discord doesn't allow robot crawlers: "403 Client Error: Forbidden"
r'https://support.discord.com/hc/en-us/articles/219070107-Server-Nicknames',
]

rediraffe_redirects = {
"clang.rst": "advanced-tools/clang.rst",
"coverity.rst": "advanced-tools/coverity.rst",
Expand Down Expand Up @@ -90,17 +132,6 @@
"triaging.rst": "triage/triaging.rst",
}

linkcheck_ignore = [
# The voters repo is private and appears as a 404
'https://github.com/python/voters/',
# The python-core team link is private, redirects to login
'https://github.com/orgs/python/teams/python-core',
# The Discourse groups are private unless you are logged in
'https://discuss.python.org/groups/staff',
'https://discuss.python.org/groups/moderators',
'https://discuss.python.org/groups/admins',
]

intersphinx_mapping = {
'python': ('https://docs.python.org/3', None),
}
Expand Down
2 changes: 1 addition & 1 deletion getting-started/pull-request-lifecycle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ Here are the steps needed in order to sign the CLA:
.. _PSF license: https://docs.python.org/dev/license.html#terms-and-conditions-for-accessing-or-otherwise-using-python
.. _contributor agreement: https://www.python.org/psf/contrib/
.. _contributor form: https://www.python.org/psf/contrib/contrib-form/
.. _Python Software Foundation: https://www.python.org/psf/
.. _Python Software Foundation: https://www.python.org/psf-landing/


Submitting
Expand Down