Hi All,
It seems that the title and description that appears in social preview and in Google search results require different implementation for tackling the issue.
Firstly, the meta title and description that is indexed in Google search results appears to be taken directly from the Streamlit app page. Particularly, the meta title is taken from the page title via st.title
or st.header
. As for the meta description, it is taken from the text appearing underneath the title text.
Secondly, the meta title shown in social preview is as specified by st.set_page_config(page_title="My App")
while the description is taken from the GitHub repo’s README.md file (See Share previews - Streamlit Docs).
Hope this helps!
1 Like
@dataprofessor
It’s worth noting this solution ONLY works if your application is hosted on Streamlit Community Cloud. In my opinion there’s no actual “hack-less” fix to deploy custom metadata to your own custom domain.
The only way I’ve managed to deploy metadata is by a custom docker image, which is going to be risky to maintain!
I think this feature is one of very few holding Streamlit back from competing with the likes of Flask, Django and FastAPI
2 Likes
Hi @chrissamharris
Thanks for the suggestion, and yes the suggested solution is for apps hosted on Community Cloud. Could you make a formal feature request here.
2 Likes
Hi, is there any update on this? I am a beginner and a solution like st.set_page_config(meta = ‘A little description of the app for a better SEO on google’) would be ideal. Same with the name
2 Likes
Dear everyone, I wrote a post on how to programmatically add the meta tags!
Big thanks to @salmanhiro for his post, I think I took his approach a bit further!
Question: Do you think I should make this a library/component so everyone would use it? Are you interested?
Thanks to everyone!
Best,
Damián Capdevila
1 Like
Hi Damian,
Thanks a lot for your update. It’s been a long time and unfortunately I can’t progress much to do this work due to my ongoing graduate study. I really appreciate everyone working on that feature.
Best wishes,
Salman
Hi Damian,
Ah I forgot the answer. Sure, I think it will be helpful from search-engine optimization side.