diff --git a/Doc/conf.py b/Doc/conf.py index f803fb1ff44bef9..084906ac17cf94e 100644 --- a/Doc/conf.py +++ b/Doc/conf.py @@ -78,6 +78,8 @@ # and replace the values accordingly. # See Doc/tools/extensions/patchlevel.py version, release = get_version_info() +v = get_header_version_info() +branch = "main" if v.releaselevel == "alpha" else f"{v.major}.{v.minor}" rst_epilog = f""" .. |python_version_literal| replace:: ``Python {version}`` @@ -298,6 +300,7 @@ "repository_url": repository_url or None, "pr_id": os.getenv("READTHEDOCS_VERSION"), "enable_analytics": os.getenv("PYTHON_DOCS_ENABLE_ANALYTICS"), + "source_branch": branch, } # This 'Last updated on:' timestamp is inserted at the bottom of every page. @@ -307,6 +310,9 @@ # Path to find HTML templates to override theme templates_path = ['tools/templates'] +# We link to sources on GitHub, so don't copy them into the HTML output. +html_copy_source = False + # Custom sidebar templates, filenames relative to this file. html_sidebars = { # Defaults taken from https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-html_sidebars @@ -571,9 +577,6 @@ # Options for sphinx.ext.extlinks # ------------------------------- -v = get_header_version_info() -branch = "main" if v.releaselevel == "alpha" else f"{v.major}.{v.minor}" - # This config is a dictionary of external sites, # mapping unique short aliases to a base URL and a prefix. # https://www.sphinx-doc.org/en/master/usage/extensions/extlinks.html diff --git a/Doc/tools/templates/customsourcelink.html b/Doc/tools/templates/customsourcelink.html index 8feeed2fee3650a..eb194aa038c1bef 100644 --- a/Doc/tools/templates/customsourcelink.html +++ b/Doc/tools/templates/customsourcelink.html @@ -1,4 +1,4 @@ -{%- if show_source and has_source and sourcename %} +{%- if page_source_suffix is defined %}