Skip to content

Commit 8dc357f

Browse files
authored
Merge pull request #552 from streamlit/social-share-previews
Add docs for social share previews
2 parents a814e2a + eaafb5c commit 8dc357f

File tree

5 files changed

+67
-1
lines changed

5 files changed

+67
-1
lines changed

content/menu.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ site_menu:
333333
url: /streamlit-cloud/get-started/share-your-app
334334
- category: Streamlit Cloud / Get started / Share your app / App indexability
335335
url: /streamlit-cloud/get-started/share-your-app/indexability
336+
- category: Streamlit Cloud / Get started / Share your app / Share previews
337+
url: /streamlit-cloud/get-started/share-your-app/share-previews
336338
# - category: Streamlit Cloud / Get started / Share your app / Configuring Single Sign-on (SSO)
337339
# url: /streamlit-cloud/get-started/share-your-app/configuring-single-on-sso
338340
# visible: false

content/streamlit-cloud/get-started/deploy-an-app/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@ It's that simple! You can then access your app by visiting your custom subdomain
109109

110110
If a custom subdomain is not available (e.g. because it's already taken), you'll see an error message like this:
111111

112-
![Custom subdomain error](/images/streamlit-cloud/custom-subdomain-error.png)
112+
<Image src="/images/streamlit-cloud/custom-subdomain-error.png" clean />
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Share previews
3+
slug: /streamlit-cloud/get-started/share-your-app/share-previews
4+
---
5+
6+
# Share previews
7+
8+
Social media sites generate a card with a title, preview image, and description when you share a link. This feature is called a "share preview." In the same way, when you share a link to a public Streamlit app on social media, a share preview is also generated. Here's an example of a share preview for a public Streamlit app posted on Twitter:
9+
10+
<div style={{ marginLeft: '3em' }}>
11+
<Flex>
12+
<Image caption="Share preview for a public Streamlit app" src="/images/streamlit-cloud/share-preview-twitter-annotated.png" />
13+
</Flex>
14+
</div>
15+
16+
<Note>
17+
18+
Share previews are generated only for public apps deployed on Community Cloud.
19+
20+
</Note>
21+
22+
## Titles
23+
24+
The title is the text that appears at the top of the share preview. The text also appears in the browser tab when you visit the app. You should set the title to something that will make sense to your app's audience and describe what the app does. It is best practice to keep the title concise, ideally under 60 characters.
25+
26+
There are two ways to set the title of a share preview:
27+
28+
1. Set the `page_title` parameter in [`st.set_page_config()`](/library/api-reference/utilities/st.set_page_config) to your desired title. E.g.:
29+
30+
```python
31+
import streamlit as st
32+
33+
st.set_page_config(page_title="My App")
34+
35+
# ... rest of your app
36+
```
37+
38+
2. If you don't set the `page_title` parameter, the title of the share preview will be the name of your app's GitHub repository. E.g., if you don't set the `page_title` parameter in `st.set_page_config()`, the title of the share preview for an app hosted on GitHub at https://github.com/jrieke/traingenerator will be "traingenerator".
39+
40+
## Descriptions
41+
42+
The description is the text that appears below the title in the share preview. The description should summarize what the app does and ideally should be under 100 characters.
43+
44+
Streamlit pulls the description from the README in the app's GitHub repository. If there is no README, the description will default to:
45+
46+
_This app was built in Streamlit! Check it out and visit https://streamlit.io for more awesome community apps. 🎈_
47+
48+
<div style={{ marginLeft: '6em' }}>
49+
<Flex>
50+
<Image caption="Default share preview when a description is missing" src="/images/streamlit-cloud/share-preview-private-app.png" />
51+
</Flex>
52+
</div>
53+
54+
<!-- ![Default share preview when a description is missing](/images/streamlit-cloud/share-preview-private-app.png) -->
55+
56+
If you want your share previews to look great and want users to share your app and click on your links, you should write a good description in the README of your app’s GitHub repository.
57+
58+
## Preview images
59+
60+
Community Cloud takes a screenshot of your app once a day and uses it as the preview image, unlike titles and descriptions, which are pulled directly from your app's code or GitHub repository. This screenshot may take up to 24 hours to update.
61+
62+
## Switching your app from public to private
63+
64+
If you initially made your app public and later decided to make it private, we will stop generating share previews for the app. However, it may take up to 24 hours for the share previews to stop appearing.
Loading
Loading

0 commit comments

Comments
 (0)