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