File tree Expand file tree Collapse file tree 3 files changed +51
-3
lines changed Expand file tree Collapse file tree 3 files changed +51
-3
lines changed Original file line number Diff line number Diff line change @@ -4,11 +4,48 @@ import { getJobById } from "@/app/jobs/actions";
4
4
import { notFound } from "next/navigation" ;
5
5
import { Job } from "@/types/job" ;
6
6
import JobDetailsWrapper from "@/components/jobs/job-details-wrapper" ;
7
+ import { Metadata } from "next" ;
8
+ import OgImage from "@/assets/OgImage.png" ;
7
9
8
- export const metadata = {
9
- title : "Job Details" ,
10
+ type Props = {
11
+ params : Promise < { id : string } > ;
12
+ searchParams : Promise < { [ key : string ] : string | string [ ] | undefined } > ;
10
13
} ;
11
14
15
+ export async function generateMetadata ( { params } : Props ) : Promise < Metadata > {
16
+ // Fetch the job
17
+ const { id } = await params ;
18
+ const job : Job | null = await getJobById ( id ) ;
19
+
20
+ // Fallback to parent metadata if job not found
21
+ if ( ! job ) {
22
+ return {
23
+ title : "Job Not Found" ,
24
+ description : "The requested job could not be found." ,
25
+ } ;
26
+ }
27
+
28
+ // Create dynamic title and description
29
+ const title = `${ job . title } at ${ job . company . name } ` ;
30
+ const description =
31
+ job . one_liner || `${ job . title } position at ${ job . company . name } ` ;
32
+
33
+ return {
34
+ title,
35
+ description,
36
+ openGraph : {
37
+ title,
38
+ description,
39
+ images : [
40
+ {
41
+ url : OgImage . src ,
42
+ alt : title ,
43
+ } ,
44
+ ] ,
45
+ } ,
46
+ } ;
47
+ }
48
+
12
49
type PageProps = {
13
50
params : Promise < { id : string } > ;
14
51
} ;
Original file line number Diff line number Diff line change @@ -21,12 +21,23 @@ import { Metadata } from "next";
21
21
import FeedbackButton from "@/components/ui/feedback-button" ;
22
22
import { Notifications } from "@mantine/notifications" ;
23
23
24
+ import OgImage from "../assets/OgImage.png" ;
25
+
24
26
export const metadata : Metadata = {
25
27
title : {
26
28
template : "%s | MAC Jobs Board" ,
27
29
default : "MAC Jobs Board" ,
28
30
} ,
29
- description : "This is MACs Official Jobs Dashboard." ,
31
+ openGraph : {
32
+ title : "MAC Jobs Board" ,
33
+ description : "Stay ahead with the job board that never sleeps." ,
34
+ images : [
35
+ {
36
+ url : OgImage . src ,
37
+ alt : "MAC Jobs Board" ,
38
+ } ,
39
+ ] ,
40
+ } ,
30
41
} ;
31
42
32
43
const poppins = Poppins ( {
You can’t perform that action at this time.
0 commit comments