Skip to content

Commit

Permalink
Opengraph: add description and custom title
Browse files Browse the repository at this point in the history
  • Loading branch information
abhiramtilakiiit committed Dec 10, 2024
1 parent 6c08a9a commit 513ab14
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/events/[id]/page.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import { notFound } from "next/navigation";

import { getFile, PUBLIC_URL } from "utils/files";
import EventDetails from "components/events/EventDetails";
import { locationMap } from "constants/events";

import dayjs from "dayjs";

export async function generateMetadata({ params }) {
const { id } = params;
Expand All @@ -16,8 +19,11 @@ export async function generateMetadata({ params }) {
? getFile(event.poster, true)
: `${PUBLIC_URL}/og-image.png`;

const time = dayjs(event.datetimeperiod[0]).format("dddd h A");

return {
title: event.name,
title: `${event.name} (Time: ${time}, Location: ${locationMap[event.location]})`,
description: event.description,
openGraph: {
images: [
{
Expand Down

0 comments on commit 513ab14

Please sign in to comment.