What are embeds?
When you share a link on platforms like Discord, Twitter, or Slack, these services fetch metadata from the URL to display a rich preview. Zipline lets you control:- Title - The headline shown in the embed
- Description - Descriptive text below the title
- Color - Accent color for the embed (Discord)
- Site name - The name of your site
- Image/Video - The actual file content
Enabling embeds
Embeds are configured per-user in their view settings:When
view.enabled is true, Zipline serves a special view page with embed metadata instead of the raw file.src/lib/db/models/user.ts:40-55.
View settings structure
Dynamic variables
Embed fields support dynamic variables that are replaced with file-specific data:Available variables
{file.name}- File name{file.size}- File size (formatted){file.type}- MIME type{file.createdAt}- Upload timestamp{user.username}- Uploader username{user.id}- Uploader user ID
Example usage
screenshot.png (2.5 MB) uploaded by alice is shared:
src/client/ssr-view/server.tsx:171-210.
How embeds are generated
Whenview.enabled and view.embed are both true:
- Request - A visitor accesses
/u/abc123.png - Redirect - Zipline redirects to
/view/abc123.png - SSR - Server renders a view page with OpenGraph tags
- Variables - Dynamic variables are replaced with file data
- Response - HTML with
<meta>tags is returned
<meta> tags to build the embed preview.
OpenGraph tags
Zipline generates standard OpenGraph metadata:Twitter Card tags
Zipline also includes Twitter Card metadata:Discord embed color
Discord supports custom embed colors using thetheme-color meta tag:
embedColor:
Colors must be valid hex codes (e.g.,
#FF5733). Discord will ignore invalid colors.File type behavior
Embed behavior varies by file type:Images
- Uses
og:imageandtwitter:image - Image displays inline in most platforms
- Recommended for photos, screenshots, artwork
Videos
- Uses
og:videoandog:video:type - Some platforms embed video players
- Formats: MP4, WebM, MOV
Text files
- Always redirect to view page
- No inline preview, just metadata
- See
src/server/routes/files.dy.ts:30
Other files
- Generic link preview with file info
- Download link provided
- MIME type shown if
showMimetypeis enabled
View page customization
Beyond embeds, the view page supports additional customization:Content alignment
left, center, right
Custom content
Metadata display
Password-protected files
Files with passwords always redirect to the view page:src/server/routes/files.dy.ts:31.
Raw file access
To bypass the view page and get raw files:/raw route always returns the file directly, regardless of view settings.
Updating view settings
Change your embed configuration:Only include the fields you want to change. Other view settings remain unchanged.
src/server/routes/api/user/index.ts:78-90.
Disabling embeds
To disable embeds but keep the view page:SSR implementation
The embed metadata is generated server-side using React SSR:parseString function replaces variables with actual file data.
Testing embeds
To preview how your embeds look:- Discord - Paste the link in any channel
- Twitter - Use the Card Validator
- OpenGraph - Use OpenGraph.xyz
- Telegram - Paste the link in a chat
FAQs
Why aren't my embeds showing on Discord?
Why aren't my embeds showing on Discord?
Make sure both
view.enabled and view.embed are true. Also check that your files are publicly accessible (not password-protected). Discord may cache old metadata for up to 24 hours.Can I have different embed settings for different files?
Can I have different embed settings for different files?
No, embed settings are per-user, not per-file. All your files will use the same embed template with dynamic variables.
Do embeds work with password-protected files?
Do embeds work with password-protected files?
Yes, but social media crawlers can’t access the actual file. They’ll show the metadata (title, description) but not the image/video preview.
Can I use custom fonts or styling in embeds?
Can I use custom fonts or styling in embeds?
Embed appearance is controlled by the platform (Discord, Twitter, etc.). You can only customize the text content, color, and which file is displayed.
What happens if I don't set embed settings?
What happens if I don't set embed settings?
Without embed settings, shared links will show basic information (URL, domain) without custom titles, descriptions, or previews.
See also
- Uploads - Learn about uploading files
- URL Shortening - Shorten links with custom metadata