From 0fac15e5d7e8014949a59c321ef87ad498451830 Mon Sep 17 00:00:00 2001 From: Paolo Miguel de Leon Date: Thu, 11 Jun 2026 16:06:08 +0800 Subject: [PATCH 1/3] fix: prevent same-dir index link collapsing to empty href The clean-URL post-processing in `update_html_files` stripped the trailing `index.html` from internal links via `href[:-10]`. For a bare same-directory link (`href="index.html"`) this produced an empty string, which the browser resolves to the current page. As a result, clicking a section's parent entry in the sidebar (e.g. a product name, from one of its sub-pages) did nothing instead of returning to the section index. Fall back to "./" when stripping would leave an empty href, so the link still points at the directory index. This only runs on the production build (gated by SPHINX_DEV_BUILD), which is why it surfaced on the live site. Co-Authored-By: Claude Opus 4.8 --- docs/conf.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index dadb87b9..ac3847c3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -617,7 +617,12 @@ def update_html_files(app, exception): for a_tag in soup.find_all('a', {'class': 'reference internal'}): href = a_tag.get('href', '') if href.endswith('index.html'): - a_tag['href'] = href[:-10] + # A bare "index.html" (same-directory link, e.g. a + # section page pointing back to its own index) + # collapses to "", which the browser resolves to the + # current page so the link does nothing. Use "./" so + # it still points at the directory index. + a_tag['href'] = href[:-len('index.html')] or './' # update home logo link home_link = soup.find('a', {'class': 'navbar-brand text-wrap'}) From c6b27313c7226a865ce679285d43f442bc12afd1 Mon Sep 17 00:00:00 2001 From: Paolo Miguel de Leon Date: Thu, 11 Jun 2026 16:09:48 +0800 Subject: [PATCH 2/3] Update docs/conf.py Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- docs/conf.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index ac3847c3..c8f4d1bb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -617,12 +617,9 @@ def update_html_files(app, exception): for a_tag in soup.find_all('a', {'class': 'reference internal'}): href = a_tag.get('href', '') if href.endswith('index.html'): - # A bare "index.html" (same-directory link, e.g. a - # section page pointing back to its own index) - # collapses to "", which the browser resolves to the - # current page so the link does nothing. Use "./" so - # it still points at the directory index. - a_tag['href'] = href[:-len('index.html')] or './' + # Only strip if it is a true directory index (to avoid mangling files like genindex.html) + if href == 'index.html' or href.endswith('/index.html'): + a_tag['href'] = href[:-10] or './' # update home logo link home_link = soup.find('a', {'class': 'navbar-brand text-wrap'}) From 060d7c44f86b703b1e33c0b817c0f53aa299121c Mon Sep 17 00:00:00 2001 From: Paolo Miguel de Leon Date: Thu, 11 Jun 2026 16:14:50 +0800 Subject: [PATCH 3/3] Update conf.py --- docs/conf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index c8f4d1bb..041b19cd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -616,10 +616,10 @@ def update_html_files(app, exception): # Update internal reference links for a_tag in soup.find_all('a', {'class': 'reference internal'}): href = a_tag.get('href', '') - if href.endswith('index.html'): - # Only strip if it is a true directory index (to avoid mangling files like genindex.html) - if href == 'index.html' or href.endswith('/index.html'): - a_tag['href'] = href[:-10] or './' + # Strip true directory indexes (avoid Sphinx's genindex.html) + # and ensure links still resolve properly + if href == 'index.html' or href.endswith('/index.html'): + a_tag['href'] = href[:-10] or './' # update home logo link home_link = soup.find('a', {'class': 'navbar-brand text-wrap'})