From 6249f061120449e70b2db5d8aff5515bfe747938 Mon Sep 17 00:00:00 2001 From: Eric Holscher Date: Wed, 17 Jul 2024 10:55:25 -0700 Subject: [PATCH] Update code snippet for html_context --- content/posts/addons-by-default.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/posts/addons-by-default.md b/content/posts/addons-by-default.md index d249349..e5a796e 100644 --- a/content/posts/addons-by-default.md +++ b/content/posts/addons-by-default.md @@ -90,6 +90,8 @@ html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "") # Tell Jinja2 templates the build is running on Read the Docs if os.environ.get("READTHEDOCS", "") == "True": + if "html_context" not in globals(): + html_context = {} html_context["READTHEDOCS"] = True ``` @@ -122,4 +124,3 @@ If you want to enable Read the Docs Addons in your project, [follow these steps [Let us know](https://docs.readthedocs.io/page/support.html) any feedback you may have about this change or any of the addons. We are happy to work together to keep improving them or fix any issue you may have with the migration. -