Something similar to @MaxMnemo’s solution would be very much appreciated.
This discussion is scattered around various parts of this forum as well as GitHub, though the conversation seems to always peter out – is there any update on adding this functionality?
When my app is searched on google (the primary way people find it), it simply says “Streamlit”, which is basically meaningless to the biologist audience that is trying to find it
I do not know HTML/CSS/Javascript basically at all (hence why Streamlit is so amazing!), so Im not sure how get google and other search engines to scrape metadata for my Streamlit app.
If no “official” Streamlit API method is included, can I simply do this myself? Do I add an index.html or robots.txt in the base folder? What would I include? Any guidance on solving this would be very much appreciated.
Yes we really need this feature. Tried to insert custom html via markdown doesn’t work. Even setting the title via st.set_page_config doesn’t seem to be crawled by Google and other robots.
I am using docker to deploy it to GCP cloud run. If you are doing something similar, make sure your Dockerfile has the following lines to replace index.html while building the container:
FROM python:3.10
EXPOSE 8080
COPY requirements.txt requirements.txt
RUN pip install -U pip
RUN pip install --no-cache-dir -r requirements.txt
# Most Important Line
COPY index.html /usr/local/lib/python3.10/site-packages/streamlit/static/index.html
# Most Important Line
COPY app.py app.py
COPY Images Images
COPY Text Text
COPY .streamlit .streamlit
WORKDIR .
ENTRYPOINT [ "streamlit", "run", "app.py", "--server.port=8080", "--server.address=0.0.0.0"]
I can confirm that the method from @spartan8868 works to update the default /site-packages/streamlit/static/index.html file. I used it to implement Google Analytics tracking on my Streamlit app, as I found that this conversation didn’t give me a functional method.
To test the method proposed by @spartan8868 , I went to /site-packages/streamlit/static/ and changed the <title> in the index.html file and also favicon.png, but even after rebooting the app it still shows the default Streamlit title and favicon.
Did you encounter a similar issue, or do you know what might be happening (for example, are index.html and favicon.png “cached” somewhere)?
Just to reinforce the obvious, modifying the index.html file in the package is, basically, a horrible idea, and we really need a safe way to inject trusted scripts into headers and footers. Where is this on the roadmap?
Not sure if this is even possible, but maybe an MVP solution could be: A small file we drop into the .streamlit folder of the app’s folder (as we already do with config.toml file), that is read and contents (, meta tags) appended to the of the index.html - instead of manually modifying the index.html in the package.
If that works, maybe something similar could be done with the default favicon.png.
Okay, I already made it clear. I copied the file from Docker shell, modify it, and this is what the index.html file should be. You can use the steps described in Dockerfile of @spartan8868
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.