Post

Hiding pages in Streamlit navigation sidebars

If using st.navigation to manage creation of the navigation, as of version 1.44.0 there is no way of hiding individual pages from the navigation.

This can be done by including code such as the following in the file that creates the navigation (generally streamlit_app.py), however:

1
2
3
4
5
6
7
8
9
10
st.markdown(
    """
        <style>
            a[href$="web_metrics_page_detail"]{
                display: none;
            }
        </style>
    """,
    unsafe_allow_html=True
)

In this specific case, links ending with web_metrics_page_detail would be hidden from the sidebar.

This post is licensed under CC BY 4.0 by the author.