diff --git a/docs/.sphinx/_static/overwrite_links.js b/docs/.sphinx/_static/overwrite_links.js
new file mode 100644
index 0000000000..f2cf7cff18
--- /dev/null
+++ b/docs/.sphinx/_static/overwrite_links.js
@@ -0,0 +1,52 @@
+// Replaces rtd-address with new-address in links
+
+const rtd_address = 'canonical-checkbox.readthedocs-hosted.com';
+const new_address = 'ubuntu.com/docs/checkbox';
+
+function escapeRegExp(value) {
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
+}
+
+function overwriteMatchingAnchorUrls(container) {
+ if (!container) return;
+
+ const rtd_addressRegex = new RegExp(escapeRegExp(rtd_address), 'g');
+ container.querySelectorAll('a[href], link[href]').forEach((anchor) => {
+ anchor.href = anchor.href.replace(rtd_addressRegex, new_address);
+ });
+}
+
+function patchFlyout() {
+ const rtdFlyout = document.querySelector('readthedocs-flyout');
+ if (!rtdFlyout) return false;
+
+ overwriteMatchingAnchorUrls(rtdFlyout);
+ overwriteMatchingAnchorUrls(rtdFlyout.shadowRoot);
+
+ rtdFlyout.addEventListener('click', () => {
+ overwriteMatchingAnchorUrls(rtdFlyout);
+ overwriteMatchingAnchorUrls(rtdFlyout.shadowRoot);
+ });
+
+ return true;
+}
+
+function init() {
+ overwriteMatchingAnchorUrls(document.querySelector('header'));
+
+ if (patchFlyout()) return;
+
+ const observer = new MutationObserver(() => {
+ if (patchFlyout()) {
+ observer.disconnect();
+ }
+ });
+
+ observer.observe(document.body, { childList: true, subtree: true });
+}
+
+if (document.body) {
+ init();
+} else {
+ document.addEventListener('DOMContentLoaded', init);
+}
diff --git a/docs/.sphinx/_templates/footer.html b/docs/.sphinx/_templates/footer.html
new file mode 100644
index 0000000000..e1d108891a
--- /dev/null
+++ b/docs/.sphinx/_templates/footer.html
@@ -0,0 +1,103 @@
+
+
+
+ {%- if show_copyright %}
+
+ {%- if hasdoc('copyright') %}
+ {% trans path=pathto('copyright'), copyright=copyright|e -%}
+
© {{ copyright }} {{ author }}
+ {%- endtrans %}
+ {%- else %}
+ {% trans copyright=copyright|e -%}
+ © {{ copyright }} {{ author }}
+ {%- endtrans %}
+ {%- endif %}
+
+ {%- endif %}
+ {%- if license and license.name -%}
+ {%- if license.url -%}
+
+ {%- else -%}
+
+ This page is licensed under {{ license.name }}
+
+ {%- endif -%}
+ {%- endif -%}
+
+ {# mod: removed "Made with" #}
+
+ {%- if last_updated -%}
+
+ {% trans last_updated=last_updated|e -%}
+ Last updated on {{ last_updated }}
+ {%- endtrans -%}
+
+ {%- endif %}
+
+ {%- if show_source and has_source and sourcename %}
+
+ {%- endif %}
+
+
+
+
\ No newline at end of file
diff --git a/docs/.sphinx/_templates/header.html b/docs/.sphinx/_templates/header.html
new file mode 100644
index 0000000000..9ee3c77d80
--- /dev/null
+++ b/docs/.sphinx/_templates/header.html
@@ -0,0 +1,72 @@
+
\ No newline at end of file
diff --git a/docs/conf.py b/docs/conf.py
index 7a9c648fa2..751ec0d4c6 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -68,7 +68,7 @@
# NOTE: The Open Graph Protocol (OGP) enhances page display in a social graph
# and is used by social media platforms; see https://ogp.me/
-ogp_site_url = "https://canonical-checkbox.readthedocs-hosted.com/latest/"
+ogp_site_url = f"https://ubuntu.com/docs/checkbox/{os.environ.get('READTHEDOCS_VERSION', 'local')}/"
# Preview name of the documentation website
ogp_site_name = project
@@ -149,16 +149,16 @@
# - https://launchpad.net/example
# - https://git.launchpad.net/example
#
-# html_theme_options = {
-# 'source_edit_link': 'https://github.com/canonical/sphinx-docs-starter-pack',
-# }
+html_theme_options = {
+ "source_edit_link": "https://github.com/canonical/checkbox",
+}
# Project slug; see https://meta.discourse.org/t/what-is-category-slug/87897
#
# TODO: If your documentation is hosted on https://docs.ubuntu.com/,
# uncomment and update as needed.
-# slug = ''
+slug = "docs/checkbox" # required when hosted on ubuntu.com
#######################
# Sitemap configuration: https://sphinx-sitemap.readthedocs.io/
@@ -166,7 +166,8 @@
# Use RTD canonical URL to ensure duplicate pages have a specific canonical URL
-html_baseurl = os.environ.get("READTHEDOCS_CANONICAL_URL", "/")
+html_baseurl = f"https://ubuntu.com/docs/checkbox/{os.environ.get('READTHEDOCS_VERSION', 'local')}/"
+sitemap_filename = "doc-sitemap.xml"
# sphinx-sitemap uses html_baseurl to generate the full URL for each page:
@@ -181,7 +182,7 @@
#######################
html_static_path = [".sphinx/_static"]
-# templates_path = ["_templates"]
+templates_path = [".sphinx/_templates"]
# Adds custom CSS files, located under 'html_static_path'
html_css_files = [
@@ -189,7 +190,9 @@
]
# Adds custom JavaScript files, located under 'html_static_path'
-# html_js_files = []
+html_js_files = [
+ "overwrite_links.js", # support ReadTheDocs flyout when hosted at ubuntu.com/docs
+]
#############
# Redirects #
diff --git a/docs/index.rst b/docs/index.rst
index 02526481ed..7beba25869 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -1,4 +1,4 @@
-:relatedlinks: [Diátaxis](https://diataxis.fr/)
+:relatedlinks: [Project repository](https://github.com/canonical/checkbox)
.. _home: