Skip to content

Commit 2c4280a

Browse files
authored
feat: Add Open Graph and Twitter meta tags for cloud distribution (#6571)
## Summary - Add meta tags plugin for social media previews (Twitter, Facebook, LinkedIn, etc.) - Include SEO meta tags (title, description, keywords) - Only applies to cloud distribution (`DISTRIBUTION === 'cloud'`) ## Changes - Added Open Graph meta tags for better social media link previews - Added Twitter Card meta tags for Twitter sharing - Added SEO meta tags (title, description, keywords) - Added `og-image.png` for preview image - Meta tags only inject when `DISTRIBUTION === 'cloud'` to avoid affecting other distributions ## Test plan - [x] Build with `DISTRIBUTION=cloud pnpm build` - [x] Verify meta tags appear in built HTML - [ ] Test link sharing on Twitter, Facebook, Slack - [ ] Verify meta tags don't appear in localhost/desktop builds 🤖 Generated with Claude Code ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6571-feat-Add-Open-Graph-and-Twitter-meta-tags-for-cloud-distribution-2a16d73d365081e58c73f6009513b2bb) by [Unito](https://www.unito.io)
1 parent c2150c6 commit 2c4280a

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

public/assets/images/og-image.png

325 KB
Loading

vite.config.mts

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ const VITE_REMOTE_DEV = process.env.VITE_REMOTE_DEV === 'true'
2727
const DISABLE_TEMPLATES_PROXY = process.env.DISABLE_TEMPLATES_PROXY === 'true'
2828
const GENERATE_SOURCEMAP = process.env.GENERATE_SOURCEMAP !== 'false'
2929

30+
// Open Graph / Twitter Meta Tags Constants
31+
const VITE_OG_URL = 'https://cloud.comfy.org'
32+
const VITE_OG_TITLE =
33+
'Comfy Cloud: Run ComfyUI online | Zero Setup, Powerful GPUs, Create anywhere'
34+
const VITE_OG_DESC =
35+
'Bring your creative ideas to life with Comfy Cloud. Build and run your workflows to generate stunning images and videos instantly using powerful GPUs — all from your browser, no installation required.'
36+
const VITE_OG_IMAGE = `${VITE_OG_URL}/assets/images/og-image.png`
37+
const VITE_OG_KEYWORDS = 'ComfyUI, Comfy Cloud, ComfyUI online'
38+
3039
// Auto-detect cloud mode from DEV_SERVER_COMFYUI_URL
3140
const DEV_SERVER_COMFYUI_ENV_URL = process.env.DEV_SERVER_COMFYUI_URL
3241
const IS_CLOUD_URL = DEV_SERVER_COMFYUI_ENV_URL?.includes('.comfy.org')
@@ -222,6 +231,90 @@ export default defineConfig({
222231
: [vue()]),
223232
tailwindcss(),
224233
comfyAPIPlugin(IS_DEV),
234+
// Twitter/Open Graph meta tags plugin (cloud distribution only)
235+
{
236+
name: 'inject-twitter-meta',
237+
transformIndexHtml(html) {
238+
if (DISTRIBUTION !== 'cloud') return html
239+
240+
return {
241+
html,
242+
tags: [
243+
// Basic SEO
244+
{ tag: 'title', children: VITE_OG_TITLE, injectTo: 'head' },
245+
{
246+
tag: 'meta',
247+
attrs: { name: 'description', content: VITE_OG_DESC },
248+
injectTo: 'head'
249+
},
250+
{
251+
tag: 'meta',
252+
attrs: { name: 'keywords', content: VITE_OG_KEYWORDS },
253+
injectTo: 'head'
254+
},
255+
256+
// Twitter Card tags
257+
{
258+
tag: 'meta',
259+
attrs: { name: 'twitter:card', content: 'summary_large_image' },
260+
injectTo: 'head'
261+
},
262+
{
263+
tag: 'meta',
264+
attrs: { name: 'twitter:title', content: VITE_OG_TITLE },
265+
injectTo: 'head'
266+
},
267+
{
268+
tag: 'meta',
269+
attrs: { name: 'twitter:description', content: VITE_OG_DESC },
270+
injectTo: 'head'
271+
},
272+
{
273+
tag: 'meta',
274+
attrs: { name: 'twitter:image', content: VITE_OG_IMAGE },
275+
injectTo: 'head'
276+
},
277+
278+
// Open Graph tags (Twitter fallback & other platforms)
279+
{
280+
tag: 'meta',
281+
attrs: { property: 'og:title', content: VITE_OG_TITLE },
282+
injectTo: 'head'
283+
},
284+
{
285+
tag: 'meta',
286+
attrs: { property: 'og:description', content: VITE_OG_DESC },
287+
injectTo: 'head'
288+
},
289+
{
290+
tag: 'meta',
291+
attrs: { property: 'og:image', content: VITE_OG_IMAGE },
292+
injectTo: 'head'
293+
},
294+
{
295+
tag: 'meta',
296+
attrs: { property: 'og:url', content: VITE_OG_URL },
297+
injectTo: 'head'
298+
},
299+
{
300+
tag: 'meta',
301+
attrs: { property: 'og:type', content: 'website' },
302+
injectTo: 'head'
303+
},
304+
{
305+
tag: 'meta',
306+
attrs: { property: 'og:site_name', content: 'Comfy Cloud' },
307+
injectTo: 'head'
308+
},
309+
{
310+
tag: 'meta',
311+
attrs: { property: 'og:locale', content: 'en_US' },
312+
injectTo: 'head'
313+
}
314+
]
315+
}
316+
}
317+
},
225318
// Skip import-map generation for cloud builds to keep bundle small
226319
...(DISTRIBUTION !== 'cloud'
227320
? [

0 commit comments

Comments
 (0)