From 33e8c1809e18a09e58ed7c56be00ac8389a93cdb Mon Sep 17 00:00:00 2001 From: asanvaq Date: Mon, 1 Jun 2026 15:07:23 +0200 Subject: [PATCH 1/5] feat: update files for migration --- docs/_static/js/overwrite_links.js | 38 ++++++++++++++++++++++++++++++ docs/conf.py | 12 ++++++---- 2 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 docs/_static/js/overwrite_links.js diff --git a/docs/_static/js/overwrite_links.js b/docs/_static/js/overwrite_links.js new file mode 100644 index 0000000..f4e0970 --- /dev/null +++ b/docs/_static/js/overwrite_links.js @@ -0,0 +1,38 @@ + // Replace oldDomain with newDomain + const oldDomain = 'documentation.ubuntu.com/chisel/en/latest/'; + const newDomain = 'ubuntu.com/chisel/docs/'; + + function escapeRegExp(value) { + return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + } + + function overwriteMatchingAnchorUrls(container) { + if (!container) return; + + const anchors = container.querySelectorAll('a[href], link[href]'); + const oldDomainRegex = new RegExp(escapeRegExp(oldDomain), 'g'); + + anchors.forEach(anchor => { + anchor.href = anchor.href.replace(oldDomainRegex, newDomain); + }); + } + + overwriteMatchingAnchorUrls(document.querySelector('header')); + + // Use a MutationObserver to wait for the RTD flyout element to appear in the DOM + const observer = new MutationObserver(function(mutations, obs) { + + const rtdFlyout = document.querySelector('readthedocs-flyout'); + if (!rtdFlyout) return; + + obs.disconnect(); + + rtdFlyout.addEventListener('click', function() { + const shadowRoot = rtdFlyout.shadowRoot; + if (!shadowRoot) return; + + overwriteMatchingAnchorUrls(shadowRoot); + }); + }); + + observer.observe(document.body, { childList: true, subtree: true }); \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 8acba1f..78e171b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -31,7 +31,9 @@ # Sidebar documentation title; best kept reasonably short # # TODO: To include a version number, add it here (hardcoded or automated). -# + +version = f"{os.environ.get('READTHEDOCS_VERSION', 'local')}" + # TODO: To disable the title, set to an empty string. html_title = project + " documentation" @@ -70,7 +72,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://documentation.ubuntu.com/chisel/" +ogp_site_url = f"https://ubuntu.com/chisel/docs//{version}/" # Preview name of the documentation website @@ -176,7 +178,7 @@ # TODO: If your documentation is hosted on https://docs.ubuntu.com/, # uncomment and update as needed. -slug = "chisel" +slug = '/docs' # Or '//docs' ####################### # Sitemap configuration: https://sphinx-sitemap.readthedocs.io/ @@ -184,7 +186,7 @@ # 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/chisel/docs//{version}/" # URL scheme. Add language and version scheme elements. # When configured with RTD variables, check for RTD environment so manual runs succeed: @@ -314,6 +316,7 @@ html_js_files = [ 'bundle.js', + "js/overwrite_links.js", ] @@ -392,4 +395,3 @@ def setup(app): app.add_css_file("tasklist.css") app.add_js_file("tasklist.js") #checkbox-enabling JS - From 3aea4f7683aa4b877f937bf1376c70ce411708d5 Mon Sep 17 00:00:00 2001 From: Anna Sancho Vaquer Date: Wed, 3 Jun 2026 08:36:24 +0200 Subject: [PATCH 2/5] fix: update slug Signed-off-by: Anna Sancho Vaquer --- docs/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 78e171b..402747b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -178,7 +178,7 @@ # TODO: If your documentation is hosted on https://docs.ubuntu.com/, # uncomment and update as needed. -slug = '/docs' # Or '//docs' +slug = 'chisel/docs' # Or '//docs' ####################### # Sitemap configuration: https://sphinx-sitemap.readthedocs.io/ From c22cf0df7261e5f8985d1bfcb2c8f0f4cffe8439 Mon Sep 17 00:00:00 2001 From: asanvaq Date: Wed, 3 Jun 2026 09:25:11 +0200 Subject: [PATCH 3/5] feat: delete js files --- docs/_static/js/overwrite_links.js | 38 ------------------------------ 1 file changed, 38 deletions(-) delete mode 100644 docs/_static/js/overwrite_links.js diff --git a/docs/_static/js/overwrite_links.js b/docs/_static/js/overwrite_links.js deleted file mode 100644 index f4e0970..0000000 --- a/docs/_static/js/overwrite_links.js +++ /dev/null @@ -1,38 +0,0 @@ - // Replace oldDomain with newDomain - const oldDomain = 'documentation.ubuntu.com/chisel/en/latest/'; - const newDomain = 'ubuntu.com/chisel/docs/'; - - function escapeRegExp(value) { - return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); - } - - function overwriteMatchingAnchorUrls(container) { - if (!container) return; - - const anchors = container.querySelectorAll('a[href], link[href]'); - const oldDomainRegex = new RegExp(escapeRegExp(oldDomain), 'g'); - - anchors.forEach(anchor => { - anchor.href = anchor.href.replace(oldDomainRegex, newDomain); - }); - } - - overwriteMatchingAnchorUrls(document.querySelector('header')); - - // Use a MutationObserver to wait for the RTD flyout element to appear in the DOM - const observer = new MutationObserver(function(mutations, obs) { - - const rtdFlyout = document.querySelector('readthedocs-flyout'); - if (!rtdFlyout) return; - - obs.disconnect(); - - rtdFlyout.addEventListener('click', function() { - const shadowRoot = rtdFlyout.shadowRoot; - if (!shadowRoot) return; - - overwriteMatchingAnchorUrls(shadowRoot); - }); - }); - - observer.observe(document.body, { childList: true, subtree: true }); \ No newline at end of file From d6885519838571a3bd432173664450a4bed84f53 Mon Sep 17 00:00:00 2001 From: asanvaq Date: Wed, 3 Jun 2026 11:14:02 +0200 Subject: [PATCH 4/5] feat: Revert "feat: delete js files". --- docs/_static/js/overwrite_links.js | 38 ++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 docs/_static/js/overwrite_links.js diff --git a/docs/_static/js/overwrite_links.js b/docs/_static/js/overwrite_links.js new file mode 100644 index 0000000..f4e0970 --- /dev/null +++ b/docs/_static/js/overwrite_links.js @@ -0,0 +1,38 @@ + // Replace oldDomain with newDomain + const oldDomain = 'documentation.ubuntu.com/chisel/en/latest/'; + const newDomain = 'ubuntu.com/chisel/docs/'; + + function escapeRegExp(value) { + return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + } + + function overwriteMatchingAnchorUrls(container) { + if (!container) return; + + const anchors = container.querySelectorAll('a[href], link[href]'); + const oldDomainRegex = new RegExp(escapeRegExp(oldDomain), 'g'); + + anchors.forEach(anchor => { + anchor.href = anchor.href.replace(oldDomainRegex, newDomain); + }); + } + + overwriteMatchingAnchorUrls(document.querySelector('header')); + + // Use a MutationObserver to wait for the RTD flyout element to appear in the DOM + const observer = new MutationObserver(function(mutations, obs) { + + const rtdFlyout = document.querySelector('readthedocs-flyout'); + if (!rtdFlyout) return; + + obs.disconnect(); + + rtdFlyout.addEventListener('click', function() { + const shadowRoot = rtdFlyout.shadowRoot; + if (!shadowRoot) return; + + overwriteMatchingAnchorUrls(shadowRoot); + }); + }); + + observer.observe(document.body, { childList: true, subtree: true }); \ No newline at end of file From fff015c14a4cfb4828febc801c9c459af855779e Mon Sep 17 00:00:00 2001 From: asanvaq Date: Wed, 3 Jun 2026 11:15:19 +0200 Subject: [PATCH 5/5] feat: update js file --- docs/_static/js/overwrite_links.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/_static/js/overwrite_links.js b/docs/_static/js/overwrite_links.js index f4e0970..25e0ad9 100644 --- a/docs/_static/js/overwrite_links.js +++ b/docs/_static/js/overwrite_links.js @@ -1,5 +1,5 @@ // Replace oldDomain with newDomain - const oldDomain = 'documentation.ubuntu.com/chisel/en/latest/'; + const oldDomain = 'canonical-chisel-migration.readthedocs-hosted.com'; const newDomain = 'ubuntu.com/chisel/docs/'; function escapeRegExp(value) {