Skip to content

Commit

Permalink
feat: twitter + google meta tags
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgoff committed Oct 25, 2024
1 parent 5528811 commit 193da69
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
1 change: 0 additions & 1 deletion app/[locale]/[...uriSegments]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ export async function generateMetadata(
openGraph: {
images: featuredImage || previousImages,
},
alternates: { canonical: "./" },
};
}

Expand Down
12 changes: 11 additions & 1 deletion app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function generateMetadata({
}

const { siteInfo: metadata } = await getGlobalData(locale);
const { siteTitle, siteDescription, siteImage, language } = metadata;
const { siteTitle, siteDescription, siteImage, language, twitter } = metadata;
const { url, width, height, altText: alt } = siteImage[0];

return {
Expand All @@ -32,10 +32,15 @@ export async function generateMetadata({
},
description: siteDescription,
manifest: "/site.webmanifest",
alternates: { canonical: "./" },
openGraph: {
locale: language,
images: [{ url, width, height, alt }],
},
twitter: {
card: "summary_large_image",
site: `@${twitter.substring(twitter.lastIndexOf("/") + 1)}`,
},
icons: {
icon: [
{ url: "/favicon-16x16.png", sizes: "16x16", type: "image/png" },
Expand All @@ -45,6 +50,11 @@ export async function generateMetadata({
{ url: "/apple-touch-icon.png", sizes: "180x180", type: "image/png" },
],
},
robots: {
googleBot: {
"max-image-preview": "large",
},
},
};
}

Expand Down
2 changes: 1 addition & 1 deletion app/[locale]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export async function generateMetadata({
entry: { title, description },
} = await getHomepageMetadata(locale, previewToken);

return { title, description, alternates: { canonical: "./" } };
return { title, description };
}

const RootPage: FunctionComponent<LocaleProps> = async ({
Expand Down
5 changes: 4 additions & 1 deletion lib/api/noirlab/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@ export const generateReleaseMetadata = async (id: string, locale: string) => {

return {
title: data?.title,
description: data?.headline,
description: data?.subtitle,
twitter: {
title: data?.title,
},
openGraph: {
images: getReleaseOpenGraph(data?.images),
},
Expand Down

0 comments on commit 193da69

Please sign in to comment.