MCPcopy
hub / github.com/Codehagen/Badget / constructMetadata

Function constructMetadata

src/lib/construct-metadata.ts:19–62  ·  view source on GitHub ↗
({
  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;
} = {})

Source from the content-addressed store, hash-verified

17]);
18
19export 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
64export const truncate = (str: string | null, length: number) => {
65 if (!str || str.length <= length) return str;

Callers 7

layout.tsxFile · 0.90
page.tsxFile · 0.90
generateMetadataFunction · 0.90
generateMetadataFunction · 0.90
layout.tsxFile · 0.90
generateMetadataFunction · 0.90
generateMetadataFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected