Skip to content

Commit

Permalink
Add twitter:card
Browse files Browse the repository at this point in the history
  • Loading branch information
dcramer committed Oct 3, 2023
1 parent 0f65b9b commit 7f246a7
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions apps/web/app/routes/tastings.$tastingId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,21 +165,29 @@ export async function loader({ params, context }: LoaderArgs) {
export const meta: MetaFunction<typeof loader> = ({ data }) => {
if (!data) return [];

const title = `${data.tasting.bottle.fullName} - Tasting Details`;

const meta: Record<string, any>[] = [
{
title: `${data.tasting.bottle.fullName} - Tasting Details`,
title,
},
{
property: "og:title",
content: `${data.tasting.bottle.fullName} - Tasting Details`,
content: title,
},
];

if (data.tasting.imageUrl) {
meta.push({
property: "og:image",
content: data.tasting.imageUrl,
});
meta.push(
{
property: "og:image",
content: data.tasting.imageUrl,
},
{
property: "twitter:card",
content: "summary_large_image",
},
);
}

return meta;
Expand Down

0 comments on commit 7f246a7

Please sign in to comment.