From 29007372f0990ef0cf5cc2556b89c719f98d7189 Mon Sep 17 00:00:00 2001 From: Andrei Liviu Georgescu <146103342+andreilgeorgescu@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:11:32 +0000 Subject: [PATCH 1/7] Remove optional 'extra' field from course schema and related content --- src/collections/courses.ts | 5 ----- src/content/courses/zio-rite-of-passage/index.mdx | 2 -- 2 files changed, 7 deletions(-) diff --git a/src/collections/courses.ts b/src/collections/courses.ts index 5a86e739..3c2c3462 100644 --- a/src/collections/courses.ts +++ b/src/collections/courses.ts @@ -55,11 +55,6 @@ export default defineCollection({ path: ["excerpt"], }, ), - extra: z - .object({ - title: z.string().max(70, "Title must be at most 70 characters"), - }) - .optional(), faqs: z .array( z diff --git a/src/content/courses/zio-rite-of-passage/index.mdx b/src/content/courses/zio-rite-of-passage/index.mdx index 75ef53d6..531bcda3 100644 --- a/src/content/courses/zio-rite-of-passage/index.mdx +++ b/src/content/courses/zio-rite-of-passage/index.mdx @@ -29,8 +29,6 @@ features: one: images/feature1.png two: images/feature2.png three: images/feature3.png -extra: - title: What will you build? --- import CourseLayout from "@pages/courses/_layouts/CourseLayout.astro"; From 45d344cafabca46ca1d7ffd27d4f6dd1aec9fb89 Mon Sep 17 00:00:00 2001 From: Andrei Liviu Georgescu <146103342+andreilgeorgescu@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:32:40 +0000 Subject: [PATCH 2/7] Rename frontmatter variable to improve clarity in ArticleLayout --- src/pages/articles/_layouts/ArticleLayout.astro | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/pages/articles/_layouts/ArticleLayout.astro b/src/pages/articles/_layouts/ArticleLayout.astro index e309870c..5e881ba9 100644 --- a/src/pages/articles/_layouts/ArticleLayout.astro +++ b/src/pages/articles/_layouts/ArticleLayout.astro @@ -23,7 +23,7 @@ interface Props { } const { article, headings, minutesRead } = Astro.props; -const frontmatter = article.data; +const _frontmatter = article.data; const { canonicalUrl, description, @@ -34,12 +34,12 @@ const { title, updatedDate, videoId, -} = frontmatter; +} = _frontmatter; const author = await getEntry( - frontmatter.author.collection, - frontmatter.author.id, + _frontmatter.author.collection, + _frontmatter.author.id, ); -const tags = await getEntries(frontmatter.tags); +const tags = await getEntries(_frontmatter.tags); const structuredData = JSON.stringify({ "@context": "https://schema.org", From 7d02e1d1dd8dbfa04b63ecd74e6c2bb1009d3e63 Mon Sep 17 00:00:00 2001 From: Andrei Liviu Georgescu <146103342+andreilgeorgescu@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:32:59 +0000 Subject: [PATCH 3/7] Add tags and authors filtering to CourseLayout for improved search functionality --- src/pages/courses/_layouts/CourseLayout.astro | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/pages/courses/_layouts/CourseLayout.astro b/src/pages/courses/_layouts/CourseLayout.astro index 106648be..baf14b02 100644 --- a/src/pages/courses/_layouts/CourseLayout.astro +++ b/src/pages/courses/_layouts/CourseLayout.astro @@ -48,6 +48,7 @@ const [bundledCourses, _categoryFrontmatter, collaborators] = await Promise.all( : [], ], ); +const tags = await getEntries(_frontmatter.tags); const { color: categoryColor, faqs: categoryFaqs } = _categoryFrontmatter; const { includedInMembership, @@ -160,6 +161,17 @@ const structuredData = JSON.stringify({ image={{ alt: title, src: heroImage.src }} {structuredData} > + { + instructors.map((instructor) => ( +
+ )) + } + { + collaborators.map((collaborator) => ( +
+ )) + } + {tags.map((tag) =>
)}
{ From 3682ca97a84f0ebc0e8517d306f9185bc549dc01 Mon Sep 17 00:00:00 2001 From: Andrei Liviu Georgescu <146103342+andreilgeorgescu@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:33:20 +0000 Subject: [PATCH 4/7] Update validation message for article tags to reflect correct maximum limit --- src/collections/articles.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/collections/articles.ts b/src/collections/articles.ts index 9815ab8b..31b93cf0 100644 --- a/src/collections/articles.ts +++ b/src/collections/articles.ts @@ -38,7 +38,7 @@ export default defineCollection({ z .array(reference("tags")) .min(1, "Article must have at least one tag") - .max(10, "Article must have at most three tags"), + .max(10, "Article must have at most ten tags"), "tags", ), title: z From b271bcc16815d07c3f841399a127d41217a600f7 Mon Sep 17 00:00:00 2001 From: Andrei Liviu Georgescu <146103342+andreilgeorgescu@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:33:45 +0000 Subject: [PATCH 5/7] Add unique tag validation to course schema with limits on count --- src/collections/courses.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/collections/courses.ts b/src/collections/courses.ts index 3c2c3462..d4a81af7 100644 --- a/src/collections/courses.ts +++ b/src/collections/courses.ts @@ -1,3 +1,4 @@ +import { unique } from "@utils/unique"; import { defineCollection, reference, z } from "astro:content"; export default defineCollection({ @@ -102,6 +103,13 @@ export default defineCollection({ }) .strict() .optional(), + tags: unique( + z + .array(reference("tags")) + .min(1, "Course must have at least one tag") + .max(10, "Course must have at most ten tags"), + "tags", + ), technologies: z .array( z From 254f1b9b04a3300c31f4a2f256e65cf41595e9b1 Mon Sep 17 00:00:00 2001 From: Andrei Liviu Georgescu <146103342+andreilgeorgescu@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:39:59 +0000 Subject: [PATCH 6/7] Add publishedDate field to course schema for better date management --- src/collections/courses.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/collections/courses.ts b/src/collections/courses.ts index d4a81af7..c9d4a5e7 100644 --- a/src/collections/courses.ts +++ b/src/collections/courses.ts @@ -96,6 +96,7 @@ export default defineCollection({ isFree: z.boolean().default(false), isNew: z.boolean().default(false), pricingPlanId: z.number().int().positive(), + publishedDate: z.date(), question: z .object({ image: image(), From 35d2ff59c1fb336229330a60dd4ed4a8771016c2 Mon Sep 17 00:00:00 2001 From: Andrei Liviu Georgescu <146103342+andreilgeorgescu@users.noreply.github.com> Date: Mon, 9 Dec 2024 18:40:46 +0000 Subject: [PATCH 7/7] Add updatedDate field to course schema for tracking modifications --- src/collections/courses.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/collections/courses.ts b/src/collections/courses.ts index c9d4a5e7..87dbf2cb 100644 --- a/src/collections/courses.ts +++ b/src/collections/courses.ts @@ -138,6 +138,7 @@ export default defineCollection({ // .min(30, "Title must be at least 30 characters") .max(70, "Title must be at most 70 characters"), repositoryUrl: z.string().optional(), + updatedDate: z.date().optional(), videoId: z.string().optional(), hasGoal: z.boolean().default(true), hasSkills: z.boolean().default(true),