Skip to content

Commit 87f639f

Browse files
committed
Use canonicals on ReadTheDocs
If environment variable READTHEDOCS_CANONICAL_URL is definied, set html_baseurl variable so Sphinx can grab it.
1 parent 03fb990 commit 87f639f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ def find_version(*file_paths):
211211
html_static_path = ["_static"]
212212
html_css_files = ["css/custom.css"]
213213

214+
# Canonical link relation
215+
if os.environ.get("READTHEDOCS_CANONICAL_URL"):
216+
html_baseurl = f"{os.environ['READTHEDOCS_CANONICAL_URL']}"
217+
214218
# html_logo = "logo.svg"
215219

216220
# -- Options for HTMLHelp output ------------------------------------------

0 commit comments

Comments
 (0)