Rename the home page in a multi-page app

Is it possible to rename the home page in a multi-page app?

My entry point file for my Streamlit app on the cloud is streamlit_app.py. I am now trying to make the app multi-page, but when I preview it on my local machine, the home page is “streamlit app” and the new page is correctly named “Competition Checker” as you can see in the screenshot. I want to rename the home page to “Individual Checker” or something like that.

Is that possible or do I need to delete and redeploy my app with a renamed entry point file?

Hey @Niloc1624 . Yes it is possible. You can simply rename that page to interested one. If you face any error feel free to raise the new query.

Happy Streamlit-ing :balloon:

With the release of the page_link widget there is a new approach to building a navigation bar without renaming your current file names.

Here is an example.

  1. Set the showSidebarNavigation to false, this would prevent showing the multi-pages in the sidebar.

    • create a .streamlit folder
    • create a config.toml file, and write showSidebarNavigation = false

  2. In your streamlit_app.py

import streamlit as st


def main():
    # builds the sidebar menu
    with st.sidebar:
        st.page_link('streamlit_app.py', label='Individual Checker', icon='🔥')
        st.page_link('pages/competition.py', label='Competition Checker', icon='🛡️')

    st.title(f'🔥 Individual Checker')

    # your content


if __name__ == '__main__':
    main()

  1. In your pages, my example just uses competition.py, this could be different in your case. But there is no need to rename it. See the page_link parameters below.
import streamlit as st


def main():
    # builds the sidebar menu
    with st.sidebar:
        st.page_link('streamlit_app.py', label='Individual Checker', icon='🔥')
        st.page_link('pages/competition.py', label='Competition Checker', icon='🛡️')

    st.title(f'🛡️ Competition Checker')

    # your content


if __name__ == '__main__':
    main()

The navigation menu is just like this.

    with st.sidebar:
        st.page_link('streamlit_app.py', label='Individual Checker', icon='🔥')
        st.page_link('pages/competition.py', label='Competition Checker', icon='🛡️')

Code improvement

You can create a function and put that on it and call that function in any page you want it to be.

For example you can create a folder called modules under your app folder name.

modules/nav.py

import streamlit as st


def Navbar():
    with st.sidebar:
        st.page_link('streamlit_app.py', label='Individual Checker', icon='🔥')
        st.page_link('pages/competition.py', label='Competition Checker', icon='🛡️')

And import that Navbar component in other pages you have.

streamlit_app.py

import streamlit as st
from modules.nav import Navbar


def main():
    Navbar()

    st.title(f'🔥 Individual Checker')


if __name__ == '__main__':
    main()

pages/competition.py

import streamlit as st
from modules.nav import Navbar


def main():
    Navbar()

    st.title(f'🛡️ Competition Checker')


if __name__ == '__main__':
    main()

Reference

Custom Navigation