MCPcopy Create free account
hub / github.com/TheOrcDev/github-creature / generateMetadata

Function generateMetadata

app/[username]/page.tsx:10–56  ·  view source on GitHub ↗
({
  params,
}: {
  params: Params;
})

Source from the content-addressed store, hash-verified

8type Params = Promise<{ username: string }>;
9
10export async function generateMetadata({
11 params,
12}: {
13 params: Params;
14}): Promise<Metadata> {
15 const { username } = await params;
16
17 const creature = await getCreatureByGithubUsername(username.toLowerCase());
18
19 const ogImage = creature?.image ?? "/github-creature-logo.png";
20 const title = creature?.name
21 ? `${creature.name} - ${creature.githubProfileUrl
22 .split("/")
23 .pop()}'s GitHub Creature`
24 : "GitHub Creature";
25
26 return {
27 title,
28 description:
29 creature?.description ??
30 "Generate a creature based on your GitHub profile.",
31 openGraph: {
32 title,
33 description:
34 creature?.description ??
35 "Generate a creature based on your GitHub profile.",
36 images: [
37 {
38 url: ogImage,
39 width: 1200,
40 height: 630,
41 alt: creature?.name
42 ? `${creature.name} (GitHub Creature)`
43 : "GitHub Creature",
44 },
45 ],
46 },
47 twitter: {
48 card: "summary_large_image",
49 title,
50 description:
51 creature?.description ??
52 "Generate a creature based on your GitHub profile.",
53 images: [ogImage],
54 },
55 };
56}
57
58async function CreatureCardWrapper({ params }: { params: Params }) {
59 const { username } = await params;

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected