create-unmint 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import { getMDXComponents } from '../../components/docs/mdx'
|
|
|
6
6
|
import { findNeighbour } from 'fumadocs-core/page-tree'
|
|
7
7
|
import type { Metadata } from 'next'
|
|
8
8
|
import type { Root, Node } from 'fumadocs-core/page-tree'
|
|
9
|
-
import {
|
|
9
|
+
import { getSiteUrl } from '@/lib/theme-config'
|
|
10
10
|
|
|
11
11
|
interface PageProps {
|
|
12
12
|
params: Promise<{ slug?: string[] }>
|
|
@@ -108,7 +108,9 @@ export async function generateMetadata({ params }: PageProps): Promise<Metadata>
|
|
|
108
108
|
const description = page.data.description
|
|
109
109
|
|
|
110
110
|
// Build OG image URL with query params
|
|
111
|
-
|
|
111
|
+
// getSiteUrl() auto-detects Vercel deployments
|
|
112
|
+
const baseUrl = getSiteUrl()
|
|
113
|
+
const ogImageUrl = new URL(`${baseUrl}/api/og`)
|
|
112
114
|
ogImageUrl.searchParams.set('title', title)
|
|
113
115
|
ogImageUrl.searchParams.set('section', section)
|
|
114
116
|
|
|
@@ -119,7 +121,7 @@ export async function generateMetadata({ params }: PageProps): Promise<Metadata>
|
|
|
119
121
|
title,
|
|
120
122
|
description,
|
|
121
123
|
type: 'article',
|
|
122
|
-
url: `${
|
|
124
|
+
url: `${baseUrl}${page.url}`,
|
|
123
125
|
images: [
|
|
124
126
|
{
|
|
125
127
|
url: ogImageUrl.toString(),
|
|
@@ -87,3 +87,18 @@ export function getCSSVariables(mode: 'light' | 'dark') {
|
|
|
87
87
|
'--accent-muted': colors.accentMuted,
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get the site URL dynamically
|
|
93
|
+
* Priority: NEXT_PUBLIC_SITE_URL > VERCEL_URL > siteConfig.url
|
|
94
|
+
* This allows OG images to work automatically on Vercel without configuration
|
|
95
|
+
*/
|
|
96
|
+
export function getSiteUrl(): string {
|
|
97
|
+
if (process.env.NEXT_PUBLIC_SITE_URL) {
|
|
98
|
+
return process.env.NEXT_PUBLIC_SITE_URL
|
|
99
|
+
}
|
|
100
|
+
if (process.env.VERCEL_URL) {
|
|
101
|
+
return `https://${process.env.VERCEL_URL}`
|
|
102
|
+
}
|
|
103
|
+
return siteConfig.url
|
|
104
|
+
}
|