@@ -42,19 +42,49 @@ export default defineConfig({
4242 ]
4343 } ,
4444
45+ transformPageData ( pageData ) {
46+ const baseUrl = env . VITE_SITE_URL ?? 'https://coolify.io/docs/'
47+ const defaultImage = 'https://coolcdn.b-cdn.net/assets/coolify/og-image-docs.png'
48+ const defaultDescription = 'Self hosting with superpowers: An open-source & self-hostable Heroku / Netlify / Vercel alternative.'
49+
50+ // Build canonical URL for this page
51+ const pageUrl = `${ baseUrl } ${ pageData . relativePath . replace ( / ( ( ^ | \/ ) i n d e x ) ? \. m d $ / , '$2' ) } `
52+
53+ // Extract values with fallback chain
54+ const title = pageData . frontmatter . title || pageData . title || 'Coolify Docs'
55+ const description = pageData . frontmatter . description || defaultDescription
56+
57+ // Handle image with relative to absolute URL conversion
58+ const relativeImage = pageData . frontmatter . image
59+ const image = relativeImage
60+ ? `${ baseUrl . replace ( / \/ $ / , '' ) } ${ relativeImage . startsWith ( '/' ) ? relativeImage : '/' + relativeImage } ` . replace ( / \/ d o c s \/ d o c s \/ / , '/docs/' )
61+ : defaultImage
62+
63+ // Initialize head array if it doesn't exist
64+ pageData . frontmatter . head ??= [ ]
65+
66+ // Add Open Graph tags
67+ pageData . frontmatter . head . push (
68+ [ 'meta' , { property : 'og:title' , content : title } ] ,
69+ [ 'meta' , { property : 'og:description' , content : description } ] ,
70+ [ 'meta' , { property : 'og:url' , content : pageUrl } ] ,
71+ [ 'meta' , { property : 'og:image' , content : image } ]
72+ )
73+
74+ // Add Twitter Card tags
75+ pageData . frontmatter . head . push (
76+ [ 'meta' , { property : 'twitter:title' , content : title } ] ,
77+ [ 'meta' , { property : 'twitter:description' , content : description } ] ,
78+ [ 'meta' , { property : 'twitter:url' , content : pageUrl } ] ,
79+ [ 'meta' , { property : 'twitter:image' , content : image } ]
80+ )
81+ } ,
82+
4583 head : [
4684 [ 'meta' , { name : 'theme-color' , content : '#000000' } ] ,
4785 [ 'meta' , { property : 'og:type' , content : 'website' } ] ,
48- [ 'meta' , { property : 'og:title' , content : 'Coolify Docs' } ] ,
49- [ 'meta' , { property : 'og:url' , content : env . VITE_SITE_URL ?? 'https://coolify.io/docs/' } ] ,
50- [ 'meta' , { property : 'og:description' , content : 'Self hosting with superpowers: An open-source & self-hostable Heroku / Netlify / Vercel alternative.' } ] ,
51- [ 'meta' , { property : 'og:image' , content : 'https://coolcdn.b-cdn.net/assets/coolify/og-image-docs.png' } ] ,
5286 [ 'meta' , { property : 'twitter:site' , content : '@coolifyio' } ] ,
5387 [ 'meta' , { property : 'twitter:card' , content : 'summary_large_image' } ] ,
54- [ 'meta' , { property : 'twitter:title' , content : 'Coolify Docs' } ] ,
55- [ 'meta' , { property : 'twitter:description' , content : 'Self hosting with superpowers: An open-source & self-hostable Heroku / Netlify / Vercel alternative.' } ] ,
56- [ 'meta' , { property : 'twitter:url' , content : env . VITE_SITE_URL ?? 'https://coolify.io/docs/' } ] ,
57- [ 'meta' , { property : 'twitter:image' , content : 'https://coolcdn.b-cdn.net/assets/coolify/og-image-docs.png' } ] ,
5888 [ 'link' , { rel : 'icon' , href : '/docs/coolify-logo-transparent.png' , alt : "Coolify's Logo" } ] ,
5989 [ 'link' , { rel : 'icon' , type : 'image/x-icon' , href : '/favicon.ico' } ] ,
6090 [ 'script' , { defer : 'true' , src : 'https://analytics.coollabs.io/js/script.tagged-events.js' , 'data-domain' : env . VITE_ANALYTICS_DOMAIN ?? 'coolify.io/docs' } ] ,
0 commit comments