Closed randyzwitch closed 3 years ago
I noticed this too. Since it was reverted from bug to product review needed, does that mean this is an intended functionality?
When running on local host it's showing "streamlit-embedcode documentation · Streamlit", but i don't want this append value · Streamlit, how can i do this, urgent response is needed please.
As a temporary workaround, you can modify the streamlit frontend main file to remove "· Streamlit" from the title.
document.title="".concat(t," \xb7 Streamlit")
and replace it with document.title="".concat(t,"")
I am chaging the same inside a docker container after that i am deploying. So it crashing. What might be the possibile solution for docker deployment changes?
how are you changing it in the docker container?
I imagine you're installing streamlit as a requirement? After the RUN pip install -r requirements.txt
command, you need to have another command, something like RUN sed -i 's/document.title="".concat(t," \xb7 Streamlit")/document.title="".concat(t,"")/g' site-packages/streamlit/static/static/js/main...chunk.js
. You'll need to change the main....chunk.js to whatever it actually is on your version (I think it changes between versions). I was actually doing this before but recently switched to Dash, so I can't recall exactly how I was doing it.
Yes i am installing the streamlit as in requirements.txt. Once i have build that docker image. I am entering inside docker as docker run -it $IMAGE_NAME /bin/bash. Inside the docker i am going to that site packages path and with VIM editor i am changing that. I am hosting the docker image in Cloud as a deployment. Can you share me the docker image code if it is working there.
add these docker commands in your dockerfile after you install requirements.txt:
WORKDIR /
RUN sed -i 's/ \\xb7 Streamlit//g' /usr/local/lib/python3.8/site-packages/streamlit/static/static/js/main.68bdddd4.chunk.js
So long as that's the name of the main...chunk.js file, it should work - I just tested it and it worked fine for me. You may need to change the python version number depending on which version you're using.
Let me test that. Thanks for quick reply.
Thanks its working solution. I think we can close this issue.
I think the issue still stands, the page title should not include '· Streamlit' if set_page_config has been set.
Ya correct once you refresh the page the stremlit title and the default favicon.png image still comes.
That shouldn't be happening 🤔 you completely removed the code to add the '· Streamlit' with that RUN sed command, so that's strange that it would come back. Did you set_page_config in your app.py?
Could you take this to the Streamlit forum? This is triggering notifications to everyone following this issue, whereas yours is a specific, tangentially related question.
Thanks!
That shouldn't be happening 🤔 you completely removed the code to add the '· Streamlit' with that RUN sed command, so that's strange that it would come back. Did you set_page_config in your app.py?
Yes i have set page config at the starting of my code with custom title and image.
Could you take this to the Streamlit forum? This is triggering notifications to everyone following this issue, whereas yours is a specific, tangentially related question.
Thanks!
Sure will take that.
That shouldn't be happening 🤔 you completely removed the code to add the '· Streamlit' with that RUN sed command, so that's strange that it would come back. Did you set_page_config in your app.py?
Yes i have set page config at the starting of my code with custom title and image.
For first time launch or whenever you will refresh it shows the streamlit name. Once the page is refreshed fully it comes back to our custom title. So intially it shows for 2 secs at starti g point of loading a page thats the problem
Any update on this one? I thought this would be an easy fix from Streamlit team's side.
Would be nice to have this fixed, also if you use a custom title it flashes "Streamlit" first before displaying the custom title favicon, would be nice if it didn't do that as well.
@anlinguist, how can I add my path correctly to dockerfile?
C:\Users\KevinAQM\anaconda3\Lib\site-packages\streamlit\static\static\js
I'm getting an "error" when I'm deploying my app to the GCP APP Engine. Error I get occurs on dockerfile, exactly on that codeline: RUN sed -i ........
Thanks to all.
Here's another hacky solution which doesn't require to change streamlit files. You can use the following function directly in your apps:
def set_page_title(title):
st.sidebar.markdown(unsafe_allow_html=True, body=f"""
<iframe height=0 srcdoc="<script>
const title = window.parent.document.querySelector('title') \
const oldObserver = window.parent.titleObserver
if (oldObserver) {{
oldObserver.disconnect()
}} \
const newObserver = new MutationObserver(function(mutations) {{
const target = mutations[0].target
if (target.text !== '{title}') {{
target.text = '{title}'
}}
}}) \
newObserver.observe(title, {{ childList: true }})
window.parent.titleObserver = newObserver \
title.text = '{title}'
</script>" />
""")
This will however add a small padding where you'll call the function.
Caution: for security reasons, do not let the app user change that title with a text_input or anything else.
set_page_title("My title") # OK
set_page_title(st.text_input("Edit my title")) # Security risks
any news on this bug?
This was fixed in 0.84, which went out last week: https://docs.streamlit.io/en/stable/changelog.html
@tconkling I know I'm bumping an old thread - but did those changes actually do anything given later in src/App.tsx
we see this:
I still have the same problem. I'm on version 1.16 and it seems that the changes have had no effect.
st.set_page_config(
page_title="Test - Home",
page_icon="👀",
layout="centered",
initial_sidebar_state="auto",
menu_items={
'Get Help': 'https://github.com/-',
'Report a bug': "https://github.com/-",
'About': "WebApp."
}
)
Using the above configuration shows: "Test -Home · Streamlit". I can't get the icon to appear either. It is empty. This is strange as it worked months ago and I haven't changed anything in this part of the code.
Edit: The icon issue is related to #5942
When running
st.beta_set_page_config(page_title="streamlit-embedcode documentation",)
, the Streamlit app appends an extra· Streamlit
value to the string:<title>streamlit-embedcode documentation · Streamlit</title>
In letting the user set the value, we should not display anything other than what the user wrote.