From d1445d6c7c4349fd7c6d8ddca54336f7d22a04e5 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Tue, 3 Jan 2023 20:31:41 +0400 Subject: [PATCH] Add SEO configuration for all the pages --- src/layouts/BaseLayout.astro | 87 ++++++++++++++++++------------ src/layouts/MarkdownLayout.astro | 5 +- src/lib/topic.ts | 4 +- src/pages/[...topicId].astro | 4 +- src/pages/[roadmapId]/index.astro | 7 ++- src/pages/[roadmapId]/topics.astro | 8 +-- src/pages/guides/[guideId].astro | 7 ++- src/pages/guides/index.astro | 2 +- src/pages/index.astro | 2 +- src/pages/privacy.md | 1 + src/pages/roadmaps.astro | 2 +- src/pages/signup.astro | 5 +- src/pages/terms.md | 1 + src/pages/videos/[videoId].astro | 9 +++- src/pages/videos/index.astro | 5 +- 15 files changed, 96 insertions(+), 53 deletions(-) diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index cce28be9d..b3abf36ae 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -11,19 +11,14 @@ import { siteConfig } from '../lib/config'; export interface Props { title: string; description?: string; + keywords?: string[]; sponsor?: SponsorType; - seo: { - title: string; - description: string; - keywords: string[]; - }; } const { title = siteConfig.title, description = siteConfig.description, keywords = siteConfig.keywords, - seo, sponsor, } = Astro.props; --- @@ -36,39 +31,63 @@ const { {title} - - - + + + - - + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + - - - - + + + - + + + + + + diff --git a/src/layouts/MarkdownLayout.astro b/src/layouts/MarkdownLayout.astro index 4441e1fa2..3ad335cf3 100644 --- a/src/layouts/MarkdownLayout.astro +++ b/src/layouts/MarkdownLayout.astro @@ -1,8 +1,11 @@ --- import BaseLayout from './BaseLayout.astro'; + +const { frontmatter = {} } = Astro.props; +const { title, description } = frontmatter; --- - +
diff --git a/src/lib/topic.ts b/src/lib/topic.ts index 85b33b89b..2c15fc248 100644 --- a/src/lib/topic.ts +++ b/src/lib/topic.ts @@ -66,7 +66,7 @@ export type BreadcrumbItem = { export interface TopicFileType { url: string; - text: string; + heading: string; file: MarkdownFileType; roadmap: RoadmapFrontmatter; roadmapId: string; @@ -102,7 +102,7 @@ export async function getTopicFiles(): Promise> { mapping[topicUrl] = { url: topicUrl, - text: firstHeading?.text, + heading: firstHeading?.text, file: fileContent, roadmap: currentRoadmap.frontmatter, roadmapId: roadmapId, diff --git a/src/pages/[...topicId].astro b/src/pages/[...topicId].astro index f4fea4e0d..195f73e66 100644 --- a/src/pages/[...topicId].astro +++ b/src/pages/[...topicId].astro @@ -15,10 +15,10 @@ export async function getStaticPaths() { } const { topicId } = Astro.params; -const { file, breadcrumbs, roadmapId, roadmap } = Astro.props as TopicFileType; +const { file, breadcrumbs, roadmapId, roadmap, heading } = Astro.props as TopicFileType; --- - +
diff --git a/src/pages/[roadmapId]/index.astro b/src/pages/[roadmapId]/index.astro index b0b19076c..959140848 100644 --- a/src/pages/[roadmapId]/index.astro +++ b/src/pages/[roadmapId]/index.astro @@ -22,7 +22,12 @@ const roadmapFile = await import(`../../roadmaps/${roadmapId}/${roadmapId}.md`); const roadmapData = roadmapFile.frontmatter as RoadmapFrontmatter; --- - + + - {topic.text} + {topic.heading} ); }) diff --git a/src/pages/guides/[guideId].astro b/src/pages/guides/[guideId].astro index be0bb32f2..086fe9430 100644 --- a/src/pages/guides/[guideId].astro +++ b/src/pages/guides/[guideId].astro @@ -19,13 +19,16 @@ export async function getStaticPaths() { const { guideId } = Astro.params; const { guide } = Astro.props; +const { frontmatter: guideData } = guide; --- - +
-
+
diff --git a/src/pages/guides/index.astro b/src/pages/guides/index.astro index e0f3961c5..2e009d0c7 100644 --- a/src/pages/guides/index.astro +++ b/src/pages/guides/index.astro @@ -7,7 +7,7 @@ import { getAllGuides } from '../../lib/guide'; const guides = await getAllGuides(); --- - + +
+ +
+
-
+
diff --git a/src/pages/videos/index.astro b/src/pages/videos/index.astro index dc5d9c5c9..eb459c7cb 100644 --- a/src/pages/videos/index.astro +++ b/src/pages/videos/index.astro @@ -7,7 +7,10 @@ import { getAllVideos } from '../../lib/video'; const videos = await getAllVideos(); --- - +