From 012548b4de041b240a45db0ce0c12e0cefc88168 Mon Sep 17 00:00:00 2001 From: alcercu <333aleix333@gmail.com> Date: Mon, 10 Feb 2025 16:44:48 +0100 Subject: [PATCH 1/8] wip(frontend): add placeholder metadata on home --- frontend/src/app/home/page.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/src/app/home/page.tsx b/frontend/src/app/home/page.tsx index e7e54dc..3864732 100644 --- a/frontend/src/app/home/page.tsx +++ b/frontend/src/app/home/page.tsx @@ -1,4 +1,7 @@ +import Head from "next/head"; + import IntegrateSection from "@/components/IntegrateSection"; +import { request } from "@/utils/graphQLClient"; import CaseStudies from "./components/CaseStudies"; import GetInTouch from "./components/GetInTouch"; @@ -8,10 +11,21 @@ import LearnPosts from "./components/LearnPosts"; import StartEarning from "./components/StartEarning"; import TrustedBy from "./components/TrustedBy"; import UseCases from "./components/UseCases"; +import { HeroQueryType, heroQuery } from "./queries/hero"; const Home: React.FC = async () => { + const heroData = await request(heroQuery); + const { title, subtitle, background } = heroData.homePageHero; + return ( <> + + {title} + + + + + From 89371a477eafd7e61e7d620a39df25d6402c9292 Mon Sep 17 00:00:00 2001 From: alcercu <333aleix333@gmail.com> Date: Mon, 10 Feb 2025 16:54:30 +0100 Subject: [PATCH 2/8] feat(frontend): add favicon --- frontend/src/app/icon.svg | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 frontend/src/app/icon.svg diff --git a/frontend/src/app/icon.svg b/frontend/src/app/icon.svg new file mode 100644 index 0000000..cd36b61 --- /dev/null +++ b/frontend/src/app/icon.svg @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From b9b18cde4c441093ef0fb6d3f9cee92d26135bcb Mon Sep 17 00:00:00 2001 From: alcercu <333aleix333@gmail.com> Date: Mon, 10 Feb 2025 17:12:00 +0100 Subject: [PATCH 3/8] fix(frontend): use correct way of adding metadata --- frontend/src/app/home/page.tsx | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/frontend/src/app/home/page.tsx b/frontend/src/app/home/page.tsx index 3864732..6df9617 100644 --- a/frontend/src/app/home/page.tsx +++ b/frontend/src/app/home/page.tsx @@ -1,4 +1,4 @@ -import Head from "next/head"; +import type { Metadata } from "next"; import IntegrateSection from "@/components/IntegrateSection"; import { request } from "@/utils/graphQLClient"; @@ -13,19 +13,23 @@ import TrustedBy from "./components/TrustedBy"; import UseCases from "./components/UseCases"; import { HeroQueryType, heroQuery } from "./queries/hero"; -const Home: React.FC = async () => { +export const generateMetadata = async (): Promise => { const heroData = await request(heroQuery); const { title, subtitle, background } = heroData.homePageHero; + return { + title, + description: subtitle, + openGraph: { + title, + description: subtitle, + images: background.url, + }, + }; +}; +const Home: React.FC = async () => { return ( <> - - {title} - - - - - From 74a3175c00452e1a170c7ac6c713fae601550b66 Mon Sep 17 00:00:00 2001 From: alcercu <333aleix333@gmail.com> Date: Tue, 11 Feb 2025 17:33:04 +0100 Subject: [PATCH 4/8] feat(frontend): add SEO queries --- frontend/src/app/brand-assets/page.tsx | 17 +++++++ frontend/src/app/community/page.tsx | 17 +++++++ frontend/src/app/cooperative/page.tsx | 17 +++++++ frontend/src/app/earn/page.tsx | 17 +++++++ frontend/src/app/for-builders/page.tsx | 17 +++++++ frontend/src/app/for-lawyers/page.tsx | 19 ++++++++ frontend/src/app/home/page.tsx | 12 ++--- frontend/src/app/pnk-token/page.tsx | 17 +++++++ frontend/src/app/r-and-d/page.tsx | 17 +++++++ frontend/src/queries/seo.ts | 65 ++++++++++++++++++++++++++ 10 files changed, 209 insertions(+), 6 deletions(-) create mode 100644 frontend/src/queries/seo.ts diff --git a/frontend/src/app/brand-assets/page.tsx b/frontend/src/app/brand-assets/page.tsx index 2bd6ddb..a681b55 100644 --- a/frontend/src/app/brand-assets/page.tsx +++ b/frontend/src/app/brand-assets/page.tsx @@ -1,3 +1,5 @@ +import type { Metadata } from "next"; + import Hero from "@/components/BrandAssets/Hero"; import KlerosBadgesSection from "@/components/BrandAssets/KlerosBadgesSection"; import KlerosColorsSection from "@/components/BrandAssets/KlerosColorsSection/index"; @@ -35,8 +37,23 @@ import { styledImagesSectionQuery, StyledImagesSectionQueryType, } from "@/queries/brand-assets/styled-images-section"; +import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +export const generateMetadata = async (): Promise => { + const seoData = await request(seoQuery); + const { title, description, image } = seoData.brandAssetsPageSeo.SEO; + return { + title, + description, + openGraph: { + title, + description, + images: image.url, + }, + }; +}; + const BrandAssets: React.FC = async () => { const heroData = await request(heroQuery); const logosPackageData = await request( diff --git a/frontend/src/app/community/page.tsx b/frontend/src/app/community/page.tsx index fdca25a..4262341 100644 --- a/frontend/src/app/community/page.tsx +++ b/frontend/src/app/community/page.tsx @@ -1,8 +1,25 @@ +import type { Metadata } from "next"; + import CommunitiesSection from "@/components/Community/CommunitiesSection"; import Hero from "@/components/Community/hero"; import { heroQuery, HeroQueryType } from "@/queries/community/hero"; +import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +export const generateMetadata = async (): Promise => { + const seoData = await request(seoQuery); + const { title, description, image } = seoData.communityPageSeo.SEO; + return { + title, + description, + openGraph: { + title, + description, + images: image.url, + }, + }; +}; + const Community: React.FC = async () => { const heroData = await request(heroQuery); diff --git a/frontend/src/app/cooperative/page.tsx b/frontend/src/app/cooperative/page.tsx index 9bcd6d4..312e77a 100644 --- a/frontend/src/app/cooperative/page.tsx +++ b/frontend/src/app/cooperative/page.tsx @@ -1,3 +1,5 @@ +import type { Metadata } from "next"; + import Hero from "@/components/Cooperative/hero"; import MemberSection from "@/components/Cooperative/MemberSection"; import ReportSection from "@/components/Cooperative/ReportSection"; @@ -10,8 +12,23 @@ import { cooperativePageReportQuery, CooperativePageReportQueryType, } from "@/queries/cooperative/report-section"; +import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +export const generateMetadata = async (): Promise => { + const seoData = await request(seoQuery); + const { title, description, image } = seoData.cooperativePageSeo.SEO; + return { + title, + description, + openGraph: { + title, + description, + images: image.url, + }, + }; +}; + const Cooperative: React.FC = async () => { const heroData = await request(heroQuery); const reportData = await request( diff --git a/frontend/src/app/earn/page.tsx b/frontend/src/app/earn/page.tsx index 5397d80..14047c1 100644 --- a/frontend/src/app/earn/page.tsx +++ b/frontend/src/app/earn/page.tsx @@ -1,9 +1,26 @@ +import type { Metadata } from "next"; + import Hero from "@/components/Earn/Hero"; import TabSection from "@/components/Earn/TabSection"; import { heroQuery, HeroQueryType } from "@/queries/earn/hero"; import { tabSectionQuery, TabSectionQueryType } from "@/queries/earn/tabs-data"; +import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +export const generateMetadata = async (): Promise => { + const seoData = await request(seoQuery); + const { title, description, image } = seoData.earnPageSeo.SEO; + return { + title, + description, + openGraph: { + title, + description, + images: image.url, + }, + }; +}; + const Earn: React.FC = async () => { const heroData = await request(heroQuery); const tabsData = await request(tabSectionQuery); diff --git a/frontend/src/app/for-builders/page.tsx b/frontend/src/app/for-builders/page.tsx index c07021b..4d72f54 100644 --- a/frontend/src/app/for-builders/page.tsx +++ b/frontend/src/app/for-builders/page.tsx @@ -1,3 +1,5 @@ +import type { Metadata } from "next"; + import Hero from "@/components/ForBuilders/Hero"; import UseCasesSection from "@/components/ForBuilders/UseCasesSection"; import IntegrateSection from "@/components/IntegrateSection"; @@ -6,8 +8,23 @@ import { useCasesQuery, UseCasesQueryType, } from "@/queries/for-builders/use-cases"; +import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +export const generateMetadata = async (): Promise => { + const seoData = await request(seoQuery); + const { title, description, image } = seoData.forBuildersPageSeo.SEO; + return { + title, + description, + openGraph: { + title, + description, + images: image.url, + }, + }; +}; + const ForBuilders: React.FC = async () => { const heroData = await request(heroQuery); const useCasesData = await request(useCasesQuery); diff --git a/frontend/src/app/for-lawyers/page.tsx b/frontend/src/app/for-lawyers/page.tsx index e80beda..54dd30b 100644 --- a/frontend/src/app/for-lawyers/page.tsx +++ b/frontend/src/app/for-lawyers/page.tsx @@ -1,3 +1,8 @@ +import type { Metadata } from "next"; + +import { seoQuery, SEOQueryType } from "@/queries/seo"; +import { request } from "@/utils/graphQLClient"; + import Hero from "./components/Hero"; import KlerosDisputeResolutionSection from "./components/KlerosDisputeResolutionSection"; import KlerosEnterpriseSection from "./components/KlerosEnterpriseSection"; @@ -5,6 +10,20 @@ import KlerosFellowSection from "./components/KlerosFellowSection"; import KlerosMediationSection from "./components/KlerosMediationSection"; import KlerosParticipateSection from "./components/KlerosParticipateSection"; +export const generateMetadata = async (): Promise => { + const seoData = await request(seoQuery); + const { title, description, image } = seoData.forLawyersPageSeo.SEO; + return { + title, + description, + openGraph: { + title, + description, + images: image.url, + }, + }; +}; + const ForLawyers: React.FC = async () => { return ( <> diff --git a/frontend/src/app/home/page.tsx b/frontend/src/app/home/page.tsx index 6df9617..017bd95 100644 --- a/frontend/src/app/home/page.tsx +++ b/frontend/src/app/home/page.tsx @@ -1,6 +1,7 @@ import type { Metadata } from "next"; import IntegrateSection from "@/components/IntegrateSection"; +import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; import CaseStudies from "./components/CaseStudies"; @@ -11,18 +12,17 @@ import LearnPosts from "./components/LearnPosts"; import StartEarning from "./components/StartEarning"; import TrustedBy from "./components/TrustedBy"; import UseCases from "./components/UseCases"; -import { HeroQueryType, heroQuery } from "./queries/hero"; export const generateMetadata = async (): Promise => { - const heroData = await request(heroQuery); - const { title, subtitle, background } = heroData.homePageHero; + const seoData = await request(seoQuery); + const { title, description, image } = seoData.homePageSeo.SEO; return { title, - description: subtitle, + description, openGraph: { title, - description: subtitle, - images: background.url, + description, + images: image.url, }, }; }; diff --git a/frontend/src/app/pnk-token/page.tsx b/frontend/src/app/pnk-token/page.tsx index 94d8e5a..b7afdbb 100644 --- a/frontend/src/app/pnk-token/page.tsx +++ b/frontend/src/app/pnk-token/page.tsx @@ -1,3 +1,5 @@ +import type { Metadata } from "next"; + import BuySection from "@/components/PNKToken/BuySection"; import Hero from "@/components/PNKToken/Hero"; import TokenNeedSection from "@/components/PNKToken/TokenNeedSection"; @@ -15,8 +17,23 @@ import { TokenomicsSectionQueryType, tokenomicsSectionQuery, } from "@/queries/pnk-token/tokenomics"; +import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +export const generateMetadata = async (): Promise => { + const seoData = await request(seoQuery); + const { title, description, image } = seoData.pnkTokenPageSeo.SEO; + return { + title, + description, + openGraph: { + title, + description, + images: image.url, + }, + }; +}; + const PNKToken: React.FC = async () => { const heroData = await request(heroQuery); const buyData = await request(buySectionQuery); diff --git a/frontend/src/app/r-and-d/page.tsx b/frontend/src/app/r-and-d/page.tsx index b44f583..690b148 100644 --- a/frontend/src/app/r-and-d/page.tsx +++ b/frontend/src/app/r-and-d/page.tsx @@ -1,3 +1,5 @@ +import type { Metadata } from "next"; + import Hero from "@/components/ResearchDevelopment/Hero"; import TabSection from "@/components/ResearchDevelopment/TabSection"; import { heroQuery, HeroQueryType } from "@/queries/research-development/hero"; @@ -5,8 +7,23 @@ import { tabSectionQuery, TabSectionQueryType, } from "@/queries/research-development/tabs-data"; +import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +export const generateMetadata = async (): Promise => { + const seoData = await request(seoQuery); + const { title, description, image } = seoData.rAndDPageSeo.SEO; + return { + title, + description, + openGraph: { + title, + description, + images: image.url, + }, + }; +}; + const ResearchDevelopment: React.FC = async () => { const heroData = await request(heroQuery); const tabsData = await request(tabSectionQuery); diff --git a/frontend/src/queries/seo.ts b/frontend/src/queries/seo.ts new file mode 100644 index 0000000..34c277e --- /dev/null +++ b/frontend/src/queries/seo.ts @@ -0,0 +1,65 @@ +import { gql } from "graphql-request"; + +const SEO_CONTENT = ` + SEO { + title + description + image { + url + } + } +`; + +export const seoQuery = gql` + { + brandAssetsPageSeo { + ${SEO_CONTENT} + } + communityPageSeo { + ${SEO_CONTENT} + } + cooperativePageSeo { + ${SEO_CONTENT} + } + earnPageSeo { + ${SEO_CONTENT} + } + forBuildersPageSeo { + ${SEO_CONTENT} + } + forLawyersPageSeo { + ${SEO_CONTENT} + } + homePageSeo { + ${SEO_CONTENT} + } + pnkTokenPageSeo { + ${SEO_CONTENT} + } + rAndDPageSeo { + ${SEO_CONTENT} + } + } +`; + +type ISEO = { + SEO: { + title: string; + description: string; + image: { + url: string; + }; + }; +}; + +export type SEOQueryType = { + brandAssetsPageSeo: ISEO; + communityPageSeo: ISEO; + cooperativePageSeo: ISEO; + earnPageSeo: ISEO; + forBuildersPageSeo: ISEO; + forLawyersPageSeo: ISEO; + homePageSeo: ISEO; + pnkTokenPageSeo: ISEO; + rAndDPageSeo: ISEO; +}; From f9ba9d3e08b422ff3e7e5c3dfd2ade5247e9d3da Mon Sep 17 00:00:00 2001 From: alcercu <333aleix333@gmail.com> Date: Tue, 11 Feb 2025 17:44:39 +0100 Subject: [PATCH 5/8] feat(frontend): set robots index to true --- frontend/src/app/layout.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index 1d79f5b..28fcf1a 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -1,21 +1,28 @@ import React from "react"; import clsx from "clsx"; +import type { Metadata } from "next"; import { Urbanist } from "next/font/google"; import Footer from "@/components/Footer"; import Navbar from "@/components/Navbar"; +import { HeroImagesQueryType, herosImagesQuery } from "@/queries/heroImages"; import { navbarQuery, NavbarQueryType } from "@/queries/navbar"; import "@/styles/globals.css"; import { getHeroImgsProps } from "@/utils/getHeroImgsProps"; import { request } from "@/utils/graphQLClient"; -import { HeroImagesQueryType, herosImagesQuery } from "@/queries/heroImages"; const urbanist = Urbanist({ weight: ["400", "500"], subsets: ["latin"], }); +export const metadata: Metadata = { + robots: { + index: true, + }, +}; + export default async function RootLayout({ children, }: { From 7a0b015274a7f06ca38df6296855afdad13b95d3 Mon Sep 17 00:00:00 2001 From: alcercu <333aleix333@gmail.com> Date: Fri, 14 Feb 2025 15:36:50 +0100 Subject: [PATCH 6/8] chore(frontend): add robots.txt file --- frontend/src/app/layout.tsx | 7 ------- frontend/src/app/robots.txt | 2 ++ 2 files changed, 2 insertions(+), 7 deletions(-) create mode 100644 frontend/src/app/robots.txt diff --git a/frontend/src/app/layout.tsx b/frontend/src/app/layout.tsx index 28fcf1a..5c3a260 100644 --- a/frontend/src/app/layout.tsx +++ b/frontend/src/app/layout.tsx @@ -1,7 +1,6 @@ import React from "react"; import clsx from "clsx"; -import type { Metadata } from "next"; import { Urbanist } from "next/font/google"; import Footer from "@/components/Footer"; @@ -17,12 +16,6 @@ const urbanist = Urbanist({ subsets: ["latin"], }); -export const metadata: Metadata = { - robots: { - index: true, - }, -}; - export default async function RootLayout({ children, }: { diff --git a/frontend/src/app/robots.txt b/frontend/src/app/robots.txt new file mode 100644 index 0000000..eb05362 --- /dev/null +++ b/frontend/src/app/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: From 35ca0a464a48624fdebb5e297ea01e3644a6fe2d Mon Sep 17 00:00:00 2001 From: alcercu <333aleix333@gmail.com> Date: Fri, 14 Feb 2025 15:58:57 +0100 Subject: [PATCH 7/8] refactor(frontend): abstract get metadata --- frontend/src/app/community/page.tsx | 14 ++------------ frontend/src/app/cooperative/page.tsx | 14 ++------------ frontend/src/app/earn/page.tsx | 14 ++------------ frontend/src/app/for-builders/page.tsx | 14 ++------------ frontend/src/app/for-lawyers/page.tsx | 15 ++------------- frontend/src/app/home/page.tsx | 15 ++------------- frontend/src/app/pnk-token/page.tsx | 14 ++------------ frontend/src/app/r-and-d/page.tsx | 14 ++------------ frontend/src/utils/seo.ts | 21 +++++++++++++++++++++ 9 files changed, 37 insertions(+), 98 deletions(-) create mode 100644 frontend/src/utils/seo.ts diff --git a/frontend/src/app/community/page.tsx b/frontend/src/app/community/page.tsx index 4262341..5755954 100644 --- a/frontend/src/app/community/page.tsx +++ b/frontend/src/app/community/page.tsx @@ -3,21 +3,11 @@ import type { Metadata } from "next"; import CommunitiesSection from "@/components/Community/CommunitiesSection"; import Hero from "@/components/Community/hero"; import { heroQuery, HeroQueryType } from "@/queries/community/hero"; -import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +import { getPageMetadata } from "@/utils/seo"; export const generateMetadata = async (): Promise => { - const seoData = await request(seoQuery); - const { title, description, image } = seoData.communityPageSeo.SEO; - return { - title, - description, - openGraph: { - title, - description, - images: image.url, - }, - }; + return await getPageMetadata("communityPageSeo"); }; const Community: React.FC = async () => { diff --git a/frontend/src/app/cooperative/page.tsx b/frontend/src/app/cooperative/page.tsx index 312e77a..dc49f6d 100644 --- a/frontend/src/app/cooperative/page.tsx +++ b/frontend/src/app/cooperative/page.tsx @@ -12,21 +12,11 @@ import { cooperativePageReportQuery, CooperativePageReportQueryType, } from "@/queries/cooperative/report-section"; -import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +import { getPageMetadata } from "@/utils/seo"; export const generateMetadata = async (): Promise => { - const seoData = await request(seoQuery); - const { title, description, image } = seoData.cooperativePageSeo.SEO; - return { - title, - description, - openGraph: { - title, - description, - images: image.url, - }, - }; + return await getPageMetadata("cooperativePageSeo"); }; const Cooperative: React.FC = async () => { diff --git a/frontend/src/app/earn/page.tsx b/frontend/src/app/earn/page.tsx index 14047c1..6e5236d 100644 --- a/frontend/src/app/earn/page.tsx +++ b/frontend/src/app/earn/page.tsx @@ -4,21 +4,11 @@ import Hero from "@/components/Earn/Hero"; import TabSection from "@/components/Earn/TabSection"; import { heroQuery, HeroQueryType } from "@/queries/earn/hero"; import { tabSectionQuery, TabSectionQueryType } from "@/queries/earn/tabs-data"; -import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +import { getPageMetadata } from "@/utils/seo"; export const generateMetadata = async (): Promise => { - const seoData = await request(seoQuery); - const { title, description, image } = seoData.earnPageSeo.SEO; - return { - title, - description, - openGraph: { - title, - description, - images: image.url, - }, - }; + return await getPageMetadata("earnPageSeo"); }; const Earn: React.FC = async () => { diff --git a/frontend/src/app/for-builders/page.tsx b/frontend/src/app/for-builders/page.tsx index 4d72f54..c40186a 100644 --- a/frontend/src/app/for-builders/page.tsx +++ b/frontend/src/app/for-builders/page.tsx @@ -8,21 +8,11 @@ import { useCasesQuery, UseCasesQueryType, } from "@/queries/for-builders/use-cases"; -import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +import { getPageMetadata } from "@/utils/seo"; export const generateMetadata = async (): Promise => { - const seoData = await request(seoQuery); - const { title, description, image } = seoData.forBuildersPageSeo.SEO; - return { - title, - description, - openGraph: { - title, - description, - images: image.url, - }, - }; + return await getPageMetadata("forBuildersPageSeo"); }; const ForBuilders: React.FC = async () => { diff --git a/frontend/src/app/for-lawyers/page.tsx b/frontend/src/app/for-lawyers/page.tsx index 54dd30b..433e545 100644 --- a/frontend/src/app/for-lawyers/page.tsx +++ b/frontend/src/app/for-lawyers/page.tsx @@ -1,7 +1,6 @@ import type { Metadata } from "next"; -import { seoQuery, SEOQueryType } from "@/queries/seo"; -import { request } from "@/utils/graphQLClient"; +import { getPageMetadata } from "@/utils/seo"; import Hero from "./components/Hero"; import KlerosDisputeResolutionSection from "./components/KlerosDisputeResolutionSection"; @@ -11,17 +10,7 @@ import KlerosMediationSection from "./components/KlerosMediationSection"; import KlerosParticipateSection from "./components/KlerosParticipateSection"; export const generateMetadata = async (): Promise => { - const seoData = await request(seoQuery); - const { title, description, image } = seoData.forLawyersPageSeo.SEO; - return { - title, - description, - openGraph: { - title, - description, - images: image.url, - }, - }; + return getPageMetadata("forLawyersPageSeo"); }; const ForLawyers: React.FC = async () => { diff --git a/frontend/src/app/home/page.tsx b/frontend/src/app/home/page.tsx index 017bd95..c2c6899 100644 --- a/frontend/src/app/home/page.tsx +++ b/frontend/src/app/home/page.tsx @@ -1,8 +1,7 @@ import type { Metadata } from "next"; import IntegrateSection from "@/components/IntegrateSection"; -import { seoQuery, SEOQueryType } from "@/queries/seo"; -import { request } from "@/utils/graphQLClient"; +import { getPageMetadata } from "@/utils/seo"; import CaseStudies from "./components/CaseStudies"; import GetInTouch from "./components/GetInTouch"; @@ -14,17 +13,7 @@ import TrustedBy from "./components/TrustedBy"; import UseCases from "./components/UseCases"; export const generateMetadata = async (): Promise => { - const seoData = await request(seoQuery); - const { title, description, image } = seoData.homePageSeo.SEO; - return { - title, - description, - openGraph: { - title, - description, - images: image.url, - }, - }; + return await getPageMetadata("homePageSeo"); }; const Home: React.FC = async () => { diff --git a/frontend/src/app/pnk-token/page.tsx b/frontend/src/app/pnk-token/page.tsx index b7afdbb..aa75d2b 100644 --- a/frontend/src/app/pnk-token/page.tsx +++ b/frontend/src/app/pnk-token/page.tsx @@ -17,21 +17,11 @@ import { TokenomicsSectionQueryType, tokenomicsSectionQuery, } from "@/queries/pnk-token/tokenomics"; -import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +import { getPageMetadata } from "@/utils/seo"; export const generateMetadata = async (): Promise => { - const seoData = await request(seoQuery); - const { title, description, image } = seoData.pnkTokenPageSeo.SEO; - return { - title, - description, - openGraph: { - title, - description, - images: image.url, - }, - }; + return await getPageMetadata("pnkTokenPageSeo"); }; const PNKToken: React.FC = async () => { diff --git a/frontend/src/app/r-and-d/page.tsx b/frontend/src/app/r-and-d/page.tsx index 690b148..4e94c4f 100644 --- a/frontend/src/app/r-and-d/page.tsx +++ b/frontend/src/app/r-and-d/page.tsx @@ -7,21 +7,11 @@ import { tabSectionQuery, TabSectionQueryType, } from "@/queries/research-development/tabs-data"; -import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +import { getPageMetadata } from "@/utils/seo"; export const generateMetadata = async (): Promise => { - const seoData = await request(seoQuery); - const { title, description, image } = seoData.rAndDPageSeo.SEO; - return { - title, - description, - openGraph: { - title, - description, - images: image.url, - }, - }; + return getPageMetadata("rAndDPageSeo"); }; const ResearchDevelopment: React.FC = async () => { diff --git a/frontend/src/utils/seo.ts b/frontend/src/utils/seo.ts new file mode 100644 index 0000000..3c193ed --- /dev/null +++ b/frontend/src/utils/seo.ts @@ -0,0 +1,21 @@ +import type { Metadata } from "next"; + +import { seoQuery, SEOQueryType } from "@/queries/seo"; +import { request } from "@/utils/graphQLClient"; + +type PageKey = keyof SEOQueryType; + +export const getPageMetadata = async (pageKey: PageKey): Promise => { + const seoData = await request(seoQuery); + const { title, description, image } = seoData[pageKey].SEO; + + return { + title, + description, + openGraph: { + title, + description, + images: image.url, + }, + }; +}; From fdd57b9cecb1ac8a5b198741ee471e0463568fee Mon Sep 17 00:00:00 2001 From: alcercu <333aleix333@gmail.com> Date: Fri, 14 Feb 2025 16:08:35 +0100 Subject: [PATCH 8/8] fix(frontend): brandassets page metadata --- frontend/src/app/brand-assets/page.tsx | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/brand-assets/page.tsx b/frontend/src/app/brand-assets/page.tsx index a681b55..fc7258e 100644 --- a/frontend/src/app/brand-assets/page.tsx +++ b/frontend/src/app/brand-assets/page.tsx @@ -37,21 +37,11 @@ import { styledImagesSectionQuery, StyledImagesSectionQueryType, } from "@/queries/brand-assets/styled-images-section"; -import { seoQuery, SEOQueryType } from "@/queries/seo"; import { request } from "@/utils/graphQLClient"; +import { getPageMetadata } from "@/utils/seo"; export const generateMetadata = async (): Promise => { - const seoData = await request(seoQuery); - const { title, description, image } = seoData.brandAssetsPageSeo.SEO; - return { - title, - description, - openGraph: { - title, - description, - images: image.url, - }, - }; + return await getPageMetadata("brandAssetsPageSeo"); }; const BrandAssets: React.FC = async () => {