File tree Expand file tree Collapse file tree 9 files changed +37
-98
lines changed Expand file tree Collapse file tree 9 files changed +37
-98
lines changed Original file line number Diff line number Diff line change @@ -3,21 +3,11 @@ import type { Metadata } from "next";
3
3
import CommunitiesSection from "@/components/Community/CommunitiesSection" ;
4
4
import Hero from "@/components/Community/hero" ;
5
5
import { heroQuery , HeroQueryType } from "@/queries/community/hero" ;
6
- import { seoQuery , SEOQueryType } from "@/queries/seo" ;
7
6
import { request } from "@/utils/graphQLClient" ;
7
+ import { getPageMetadata } from "@/utils/seo" ;
8
8
9
9
export const generateMetadata = async ( ) : Promise < Metadata > => {
10
- const seoData = await request < SEOQueryType > ( seoQuery ) ;
11
- const { title, description, image } = seoData . communityPageSeo . SEO ;
12
- return {
13
- title,
14
- description,
15
- openGraph : {
16
- title,
17
- description,
18
- images : image . url ,
19
- } ,
20
- } ;
10
+ return await getPageMetadata ( "communityPageSeo" ) ;
21
11
} ;
22
12
23
13
const Community : React . FC = async ( ) => {
Original file line number Diff line number Diff line change @@ -12,21 +12,11 @@ import {
12
12
cooperativePageReportQuery ,
13
13
CooperativePageReportQueryType ,
14
14
} from "@/queries/cooperative/report-section" ;
15
- import { seoQuery , SEOQueryType } from "@/queries/seo" ;
16
15
import { request } from "@/utils/graphQLClient" ;
16
+ import { getPageMetadata } from "@/utils/seo" ;
17
17
18
18
export const generateMetadata = async ( ) : Promise < Metadata > => {
19
- const seoData = await request < SEOQueryType > ( seoQuery ) ;
20
- const { title, description, image } = seoData . cooperativePageSeo . SEO ;
21
- return {
22
- title,
23
- description,
24
- openGraph : {
25
- title,
26
- description,
27
- images : image . url ,
28
- } ,
29
- } ;
19
+ return await getPageMetadata ( "cooperativePageSeo" ) ;
30
20
} ;
31
21
32
22
const Cooperative : React . FC = async ( ) => {
Original file line number Diff line number Diff line change @@ -4,21 +4,11 @@ import Hero from "@/components/Earn/Hero";
4
4
import TabSection from "@/components/Earn/TabSection" ;
5
5
import { heroQuery , HeroQueryType } from "@/queries/earn/hero" ;
6
6
import { tabSectionQuery , TabSectionQueryType } from "@/queries/earn/tabs-data" ;
7
- import { seoQuery , SEOQueryType } from "@/queries/seo" ;
8
7
import { request } from "@/utils/graphQLClient" ;
8
+ import { getPageMetadata } from "@/utils/seo" ;
9
9
10
10
export const generateMetadata = async ( ) : Promise < Metadata > => {
11
- const seoData = await request < SEOQueryType > ( seoQuery ) ;
12
- const { title, description, image } = seoData . earnPageSeo . SEO ;
13
- return {
14
- title,
15
- description,
16
- openGraph : {
17
- title,
18
- description,
19
- images : image . url ,
20
- } ,
21
- } ;
11
+ return await getPageMetadata ( "earnPageSeo" ) ;
22
12
} ;
23
13
24
14
const Earn : React . FC = async ( ) => {
Original file line number Diff line number Diff line change @@ -8,21 +8,11 @@ import {
8
8
useCasesQuery ,
9
9
UseCasesQueryType ,
10
10
} from "@/queries/for-builders/use-cases" ;
11
- import { seoQuery , SEOQueryType } from "@/queries/seo" ;
12
11
import { request } from "@/utils/graphQLClient" ;
12
+ import { getPageMetadata } from "@/utils/seo" ;
13
13
14
14
export const generateMetadata = async ( ) : Promise < Metadata > => {
15
- const seoData = await request < SEOQueryType > ( seoQuery ) ;
16
- const { title, description, image } = seoData . forBuildersPageSeo . SEO ;
17
- return {
18
- title,
19
- description,
20
- openGraph : {
21
- title,
22
- description,
23
- images : image . url ,
24
- } ,
25
- } ;
15
+ return await getPageMetadata ( "forBuildersPageSeo" ) ;
26
16
} ;
27
17
28
18
const ForBuilders : React . FC = async ( ) => {
Original file line number Diff line number Diff line change 1
1
import type { Metadata } from "next" ;
2
2
3
- import { seoQuery , SEOQueryType } from "@/queries/seo" ;
4
- import { request } from "@/utils/graphQLClient" ;
3
+ import { getPageMetadata } from "@/utils/seo" ;
5
4
6
5
import Hero from "./components/Hero" ;
7
6
import KlerosDisputeResolutionSection from "./components/KlerosDisputeResolutionSection" ;
@@ -11,17 +10,7 @@ import KlerosMediationSection from "./components/KlerosMediationSection";
11
10
import KlerosParticipateSection from "./components/KlerosParticipateSection" ;
12
11
13
12
export const generateMetadata = async ( ) : Promise < Metadata > => {
14
- const seoData = await request < SEOQueryType > ( seoQuery ) ;
15
- const { title, description, image } = seoData . forLawyersPageSeo . SEO ;
16
- return {
17
- title,
18
- description,
19
- openGraph : {
20
- title,
21
- description,
22
- images : image . url ,
23
- } ,
24
- } ;
13
+ return getPageMetadata ( "forLawyersPageSeo" ) ;
25
14
} ;
26
15
27
16
const ForLawyers : React . FC = async ( ) => {
Original file line number Diff line number Diff line change 1
1
import type { Metadata } from "next" ;
2
2
3
3
import IntegrateSection from "@/components/IntegrateSection" ;
4
- import { seoQuery , SEOQueryType } from "@/queries/seo" ;
5
- import { request } from "@/utils/graphQLClient" ;
4
+ import { getPageMetadata } from "@/utils/seo" ;
6
5
7
6
import CaseStudies from "./components/CaseStudies" ;
8
7
import GetInTouch from "./components/GetInTouch" ;
@@ -14,17 +13,7 @@ import TrustedBy from "./components/TrustedBy";
14
13
import UseCases from "./components/UseCases" ;
15
14
16
15
export const generateMetadata = async ( ) : Promise < Metadata > => {
17
- const seoData = await request < SEOQueryType > ( seoQuery ) ;
18
- const { title, description, image } = seoData . homePageSeo . SEO ;
19
- return {
20
- title,
21
- description,
22
- openGraph : {
23
- title,
24
- description,
25
- images : image . url ,
26
- } ,
27
- } ;
16
+ return await getPageMetadata ( "homePageSeo" ) ;
28
17
} ;
29
18
30
19
const Home : React . FC = async ( ) => {
Original file line number Diff line number Diff line change @@ -17,21 +17,11 @@ import {
17
17
TokenomicsSectionQueryType ,
18
18
tokenomicsSectionQuery ,
19
19
} from "@/queries/pnk-token/tokenomics" ;
20
- import { seoQuery , SEOQueryType } from "@/queries/seo" ;
21
20
import { request } from "@/utils/graphQLClient" ;
21
+ import { getPageMetadata } from "@/utils/seo" ;
22
22
23
23
export const generateMetadata = async ( ) : Promise < Metadata > => {
24
- const seoData = await request < SEOQueryType > ( seoQuery ) ;
25
- const { title, description, image } = seoData . pnkTokenPageSeo . SEO ;
26
- return {
27
- title,
28
- description,
29
- openGraph : {
30
- title,
31
- description,
32
- images : image . url ,
33
- } ,
34
- } ;
24
+ return await getPageMetadata ( "pnkTokenPageSeo" ) ;
35
25
} ;
36
26
37
27
const PNKToken : React . FC = async ( ) => {
Original file line number Diff line number Diff line change @@ -7,21 +7,11 @@ import {
7
7
tabSectionQuery ,
8
8
TabSectionQueryType ,
9
9
} from "@/queries/research-development/tabs-data" ;
10
- import { seoQuery , SEOQueryType } from "@/queries/seo" ;
11
10
import { request } from "@/utils/graphQLClient" ;
11
+ import { getPageMetadata } from "@/utils/seo" ;
12
12
13
13
export const generateMetadata = async ( ) : Promise < Metadata > => {
14
- const seoData = await request < SEOQueryType > ( seoQuery ) ;
15
- const { title, description, image } = seoData . rAndDPageSeo . SEO ;
16
- return {
17
- title,
18
- description,
19
- openGraph : {
20
- title,
21
- description,
22
- images : image . url ,
23
- } ,
24
- } ;
14
+ return getPageMetadata ( "rAndDPageSeo" ) ;
25
15
} ;
26
16
27
17
const ResearchDevelopment : React . FC = async ( ) => {
Original file line number Diff line number Diff line change
1
+ import type { Metadata } from "next" ;
2
+
3
+ import { seoQuery , SEOQueryType } from "@/queries/seo" ;
4
+ import { request } from "@/utils/graphQLClient" ;
5
+
6
+ type PageKey = keyof SEOQueryType ;
7
+
8
+ export const getPageMetadata = async ( pageKey : PageKey ) : Promise < Metadata > => {
9
+ const seoData = await request < SEOQueryType > ( seoQuery ) ;
10
+ const { title, description, image } = seoData [ pageKey ] . SEO ;
11
+
12
+ return {
13
+ title,
14
+ description,
15
+ openGraph : {
16
+ title,
17
+ description,
18
+ images : image . url ,
19
+ } ,
20
+ } ;
21
+ } ;
You can’t perform that action at this time.
0 commit comments