Mystapp.com/how_can_i_personalize_this

Sorry for the title but idk how you call that part after the domain name. This is the only piece of code I have related to pages:

from st_pages import show_pages
from st_pages import Page as StPage
show_pages(
    [
        StPage(
            path = f"{self.data_handler.root_path}/Home.py",
            name = "Home",
            icon = "🏠" # 🏠 πŸšͺ πŸŒ…
        ), 
        StPage(
            path = f"{self.data_handler.root_path}/pages/backtest_results.py",
            name = "Backtest Results",
            icon = "πŸ“Š" # πŸ“ˆ πŸ’Ή πŸ“Š
        ),
        StPage(
            path = f"{self.data_handler.root_path}/pages/top_combination.py",
            name = "Top Combination",
            icon = "πŸ†" # πŸ† πŸ₯‡ πŸ”
        ),
        StPage(
            path = f"{self.data_handler.root_path}/pages/optimization_analysis.py",
            name = "Optimization Analysis",
            icon = "πŸ”" # πŸ” πŸ”¬ πŸ“‰
        ),
        StPage(
            path = f"{self.data_handler.root_path}/pages/trade_analysis.py",
            name = "Trade Analysis",
            icon = "πŸ’°" # πŸ’Έ πŸ’° πŸ’΅
        )
    ]
)

Hi @Ivan_Schuster,

Have you checked out the README for st_pages?

You can either declare the page names programmatically via Python or via a config file.

The first option looks like this (with β€œHome” being the page title):

from st_pages import Page, show_pages, add_page_title

# Optional -- adds the title and icon to the current page
add_page_title()

# Specify what pages should be shown in the sidebar, and what their titles and icons
# should be
show_pages(
    [
        Page("streamlit_app.py", "Home", "🏠"),
    ]
)

The second option (config file) looks like this (with β€œHome” being the page name again):

(You would add a .streamlit/pages.toml file)


[[pages]]
path = "streamlit_app.py"
name = "Home"
icon = "🏠"

Hi Caroline, thanks for your detailed answer.

I think I missexplained myself. I was wondering how I can get to change not the name of the page in the sidebar, but on the URL.

Are you trying specifically to make the URL and name in the sidebar be different? Using st_pages is going to affect both the sidebar menu and URL.