mirror of
https://github.com/d0zingcat/nextjs-notion-starter-kit.git
synced 2026-05-13 15:09:47 +00:00
17 lines
370 B
TypeScript
17 lines
370 B
TypeScript
import { api, host } from './config'
|
|
|
|
export function getSocialImageUrl(pageId: string | undefined) {
|
|
try {
|
|
const url = new URL(api.getSocialImage, host)
|
|
|
|
if (pageId) {
|
|
url.searchParams.set('id', pageId)
|
|
return url.toString()
|
|
}
|
|
} catch (err: any) {
|
|
console.warn('error invalid social image url', pageId, err.message)
|
|
}
|
|
|
|
return null
|
|
}
|