How to refer page in multipages?


The multipage tutorial is useful. However, it doesn’t mention how to refer pages.

Steps to reproduce

Let’s say we want to cite page2 using markdown in main_parge.

How to make [page2](??label??) jumping to page2?

Code snippet:

# Contents of ~/my_app/
import streamlit as st
st.title("Main page")

# Contents of ~/my_app/pages/
import streamlit as st
1 Like

thank you for this. It was a lot of help!! I wonder how can we jump to the page but stay in the same window or how to close the window we just left? I’m very new to Streamlit, sorry if it is a very beginner question. :handshake:

You can use this once you know the link of your website:

st.markdown('<a href="http://localhost:8501/page2" target="_self">page2</a>', unsafe_allow_html=True)

thank you!