fix(footer): navigate to / instead of /home on Back to Home

Reported: clicking Back to Home in the sticky footer surfaced
Streamlit's "Page not found — Running the app's main page" message
in the user's build.

Root cause: ``url_path="home"`` on the home page's ``st.Page``
registration is treated as an alias for the default page in some
Streamlit minor versions, but the user's build doesn't honour the
alias for the page that ALSO has ``default=True``. The default page
is served at the root URL ``/``; ``/home`` is treated as a missing
page on that build.

Switch the footer anchor's href from ``"home"`` (which resolved to
``/home`` from any tool-page URL) to ``"./"`` (resolves to the
current document's directory, which on a single-segment URL is the
server root → default page → Home). Robust across Streamlit minor
versions regardless of how the url_path alias is interpreted.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-17 02:25:57 +00:00
parent 2d2ff43754
commit be7191a5d1

View File

@@ -619,7 +619,15 @@ def render_sticky_footer() -> None:
div.id = 'datatools-sticky-footer';
var a = doc.createElement('a');
a.className = 'datatools-sticky-footer-link';
a.href = 'home';
// Navigate to the app root (``/``) instead of ``/home``. The
// home page is registered with ``default=True``, which serves
// it at the root URL. ``/home`` is NOT a recognized URL on
// every Streamlit minor version even with ``url_path="home"``
// — some builds reserve the alias only for non-default pages.
// Using ``./`` is robust against both: it resolves to the
// current document's directory, which on a single-segment
// tool-page URL like ``/01_deduplicator`` is the server root.
a.href = './';
a.target = '_self';
a.textContent = label;
div.appendChild(a);