From 2e9ce1da8bc574cde85ff06260ac74fdf4276d04 Mon Sep 17 00:00:00 2001 From: Javier Diaz Date: Mon, 18 Aug 2025 13:19:45 -0600 Subject: [PATCH 1/2] fix: updated schema for manage content --- src/content.config.ts | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/content.config.ts b/src/content.config.ts index 1ddf035..8c346e5 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -8,23 +8,29 @@ export const seoSchemaWithoutImage = z.object({ type: z.string().optional(), keywords: z.string().optional(), canonicalUrl: z.string().optional(), - twitter: z.object({ - creator: z.string().optional(), - }).optional(), + twitter: z + .object({ + creator: z.string().optional(), + }) + .optional(), robots: z.string().optional(), -}) +}); const seoSchema = (image: ImageFunction) => - z.object({ - image: image().optional(), - }).merge(seoSchemaWithoutImage); + z + .object({ + image: image().optional(), + }) + .merge(seoSchemaWithoutImage); const pageCollection = defineCollection({ loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: './src/content/pages' }), - schema: ({ image }) => z.object({ - title: z.string(), - seo: seoSchema(image), - }), + schema: ({ image }) => + z.object({ + title: z.string(), + description: z.string().optional(), + seo: seoSchema(image), + }), }); const linkCollection = defineCollection({ @@ -61,12 +67,13 @@ const talkCollection = defineCollection({ const postCollection = defineCollection({ loader: glob({ pattern: '**/[^_]*.{md,mdx}', base: './src/content/posts' }), - schema: ({ image }) => z.object({ - title: z.string(), - date: z.date(), - image: image().optional(), - seo: seoSchema(image), - }), + schema: ({ image }) => + z.object({ + title: z.string(), + date: z.date(), + image: image().optional(), + seo: seoSchema(image), + }), }); export const collections = { From aec62a622343d61ab961e5c8f6e10f2d6181b340 Mon Sep 17 00:00:00 2001 From: Javier Diaz Date: Mon, 18 Aug 2025 13:20:14 -0600 Subject: [PATCH 2/2] feat: added 404 not found page --- src/content/pages/404.mdx | 9 +++++ src/pages/404.astro | 80 +++++++++++++++++++++++++++++++++++++++ src/pages/index.astro | 15 +++++--- 3 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 src/content/pages/404.mdx create mode 100644 src/pages/404.astro diff --git a/src/content/pages/404.mdx b/src/content/pages/404.mdx new file mode 100644 index 0000000..6d81557 --- /dev/null +++ b/src/content/pages/404.mdx @@ -0,0 +1,9 @@ +--- +title: 404 - Page not found +description: Sorry, the page you are looking for doesn't exist or has been moved. +seo: + title: 404 - Page not found + description: Sorry, the page you are looking for doesn't exist or has been moved. + type: website + robots: noindex, no follow +--- diff --git a/src/pages/404.astro b/src/pages/404.astro new file mode 100644 index 0000000..9421b9e --- /dev/null +++ b/src/pages/404.astro @@ -0,0 +1,80 @@ +--- +import { getEntry } from 'astro:content'; +import BaseLayout from '@/layouts/BaseLayout.astro'; +import Container from '@/components/Container.astro'; + +const entry = await getEntry('pages', '404'); +--- + + + +
+ +
+

+ 404 +

+
+

+ {entry?.data.title} +

+

+ {entry?.data.description} +

+
+
+ + + + + +

+ If you believe this is an error, please check the URL or try refreshing + the page. +

+
+
+
diff --git a/src/pages/index.astro b/src/pages/index.astro index d585d3a..2ed11a6 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -9,6 +9,11 @@ import Talk from '@/components/ui/Talk.astro'; import { sortJobsByDate } from '@/lib/utils'; const entry = await getEntry('pages', 'homepage'); + +if (!entry) { + throw new Error('Homepage entry not found'); +} + const { Content } = await render(entry); const links = await getCollection('links'); @@ -18,11 +23,11 @@ const talks = await getCollection('talks'); --- - + - +
About @@ -34,7 +39,7 @@ const talks = await getCollection('talks'); { links.length > 0 && ( - +
Contact
    @@ -62,7 +67,7 @@ const talks = await getCollection('talks'); } { sortedJobs.length > 0 && ( - +
    Work Experience
      @@ -76,7 +81,7 @@ const talks = await getCollection('talks'); } { talks.length > 0 && ( - +
      Speaking