From d90f6522da5b810d024e099dd8a4f1898775be38 Mon Sep 17 00:00:00 2001
From: Chris Markiewicz <markiewicz@stanford.edu>
Date: Tue, 16 Jul 2024 14:37:51 -0400
Subject: [PATCH] DOC: Read html_baseurl from RTD environment, if available
 (#3324)

Following the advice of
https://about.readthedocs.com/blog/2024/07/addons-by-default/.

Starting on the LTS, since there's still a chance a new release would
come out.
---
 .readthedocs.yml | 11 ++++++++++-
 docs/conf.py     |  2 ++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/.readthedocs.yml b/.readthedocs.yml
index be327de63..e0be5db10 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -1,7 +1,16 @@
 version: 2
 
+build:
+  os: ubuntu-22.04
+  tools:
+    python: "3.7"
+  apt_packages:
+    - graphviz
+  jobs:
+    post_checkout:
+      - git fetch --unshallow
+
 python:
-  version: 3.7
   install:
     - requirements: docs/requirements.txt
     - method: pip
diff --git a/docs/conf.py b/docs/conf.py
index 94922aeed..6ed9074f6 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -28,6 +28,8 @@
 
 # -- General configuration ------------------------------------------------
 
+html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "")
+
 # If your documentation needs a minimal Sphinx version, state it here.
 needs_sphinx = "1.5.3"