({
title = siteConfig.name,
description = siteConfig.description,
image = `${HOME_DOMAIN}/opengraph-image`,
icons = "/favicon.ico",
noIndex = false,
}: {
title?: string;
description?: string;
image?: string;
icons?: string;
noIndex?: boolean;
} = {})
| 17 | ]); |
| 18 | |
| 19 | export function constructMetadata({ |
| 20 | title = siteConfig.name, |
| 21 | description = siteConfig.description, |
| 22 | image = `${HOME_DOMAIN}/opengraph-image`, |
| 23 | icons = "/favicon.ico", |
| 24 | noIndex = false, |
| 25 | }: { |
| 26 | title?: string; |
| 27 | description?: string; |
| 28 | image?: string; |
| 29 | icons?: string; |
| 30 | noIndex?: boolean; |
| 31 | } = {}): Metadata { |
| 32 | return { |
| 33 | title, |
| 34 | description, |
| 35 | openGraph: { |
| 36 | title, |
| 37 | description, |
| 38 | type: "website", |
| 39 | siteName: siteConfig.name, |
| 40 | images: [ |
| 41 | { |
| 42 | url: image, |
| 43 | }, |
| 44 | ], |
| 45 | }, |
| 46 | twitter: { |
| 47 | card: "summary_large_image", |
| 48 | title, |
| 49 | description, |
| 50 | images: [image], |
| 51 | creator: "@badget", |
| 52 | }, |
| 53 | icons, |
| 54 | metadataBase: new URL(HOME_DOMAIN), |
| 55 | ...(noIndex && { |
| 56 | robots: { |
| 57 | index: false, |
| 58 | follow: false, |
| 59 | }, |
| 60 | }), |
| 61 | }; |
| 62 | } |
| 63 | |
| 64 | export const truncate = (str: string | null, length: number) => { |
| 65 | if (!str || str.length <= length) return str; |
no outgoing calls
no test coverage detected