From 439b0e0507e42d4efb1245b567debaec86d2acf9 Mon Sep 17 00:00:00 2001 From: satoshi-sh Date: Sat, 25 Nov 2023 15:20:57 -0600 Subject: [PATCH 1/5] Updated pageMeta for each page --- utils/meta.js | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/utils/meta.js b/utils/meta.js index 19e18ef4..0f0315fe 100644 --- a/utils/meta.js +++ b/utils/meta.js @@ -1,6 +1,29 @@ -export const meta = { - title: 'Web Dev Path', - keywords: 'web development, mentoring, volunteering, Next.js', - description: - 'The Web Dev Path is a team of professional developers project that aims to provide a comprehensive path for people who seek to begin their web development journey.', +const pageMeta = { + '/': { + title: 'Home - Web Dev Path', + description: 'Start your journey in web development with Web Dev Path.', + keywords: 'web development, learning, coding', + canonical: 'https://www.webdevpath.co', + }, + '/about': { + title: 'About Us - Web Dev Path', + description: 'Learn about the Web Dev Path team and our mission.', + keywords: 'about web dev path, web development team, web dev mentoring', + canonical: 'https://www.webdevpath.co/about', + }, + '/blog': { + title: 'Blog - Web Dev Path', + description: 'Check out the blog posts by Web Dev Path members', + keywords: 'web development blog, programming articles, success stories', + canonical: 'https://www.webdevpath.co/blog', + }, + '/contact': { + title: 'Contact - Web Dev Path', + description: + "Send us your questions, and we'll get back to you as soon as possible", + keywords: 'contact, questions', + canonical: 'https://www.webdevpath.co/contact', + }, }; + +export default pageMeta; From 00753aac7b7dc6c4d121329aac2c0226953ea9b2 Mon Sep 17 00:00:00 2001 From: satoshi-sh Date: Sat, 25 Nov 2023 15:58:18 -0600 Subject: [PATCH 2/5] Removed canonical link to avoid confliction with dynamic canonical URLs --- pages/_document.js | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/_document.js b/pages/_document.js index 7ba36843..e5e0b30d 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -62,7 +62,6 @@ class MyDocument extends Document { rel='stylesheet' href='https://fonts.googleapis.com/css2?family=Assistant:wght@400;700&family=Open+Sans:wght@700&display=swap' /> -
From 7254841d96aa03d8f169c3f517ca3c0779b56eec Mon Sep 17 00:00:00 2001 From: satoshi-sh Date: Sat, 25 Nov 2023 16:04:54 -0600 Subject: [PATCH 3/5] UsePathname to get path name, and implemented a fallback mechanism for routers not explicitly defined in meta.js --- components/layout/Meta.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/layout/Meta.js b/components/layout/Meta.js index 4fd9f492..f16758c7 100644 --- a/components/layout/Meta.js +++ b/components/layout/Meta.js @@ -1,8 +1,11 @@ import Head from 'next/head'; -import { meta } from '@/utils/meta'; +import pageMeta from '@/utils/meta'; +import { usePathname } from 'next/navigation'; import Script from 'next/script'; export default function Meta() { + const currentPath = usePathname(); + const meta = currentPath in pageMeta ? pageMeta[currentPath] : pageMeta['/']; return ( <> @@ -46,7 +49,7 @@ export default function Meta() { - + {/* Google Analytics */}