Skip to content

Commit 8c8f5c3

Browse files
committed
feat: add description to pages
1 parent 44712c8 commit 8c8f5c3

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

src/content/blog/client.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const getAllPosts = async () => {
2626
id
2727
title
2828
subtitle
29+
brief
2930
slug
3031
publishedAt
3132
readTimeInMinutes

src/content/blog/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ export const PostSchema = z.object({
44
id: z.string(),
55
title: z.string(),
66
subtitle: z.string(),
7+
brief: z.string(),
78
slug: z.string(),
89
publishedAt: z.string(),
910
readTimeInMinutes: z.number(),

src/layouts/BaseLayout.astro

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@ import Navbar from "~/components/Navbar";
66
77
interface Props {
88
title?: string;
9+
description?: string;
910
}
1011
11-
const { title = "TheComputerM" } = Astro.props;
12+
const {
13+
title = "TheComputerM",
14+
description = "I am Mudit Somani, a CS student at BITS Pilani, GSoC'24 @Dart, Google Code-in '19 @JuliaLang and the president of my college's coding club",
15+
} = Astro.props;
1216
---
1317

14-
1518
<!doctype html>
1619
<html lang="en">
1720
<head>
@@ -20,11 +23,12 @@ const { title = "TheComputerM" } = Astro.props;
2023
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
2124
<meta name="generator" content={Astro.generator} />
2225
<title>{title}</title>
26+
<meta name="description" content={description} />
2327
<slot name="head" />
2428
</head>
2529
<body>
2630
<Navbar client:idle />
2731
<slot />
2832
<Footer />
2933
</body>
30-
</html>
34+
</html>

src/pages/blog/[slug].astro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const post = entry.data;
2929
const content = await getPostHTML(slug);
3030
---
3131

32-
<BaseLayout title={`${post.title} | TheComputerM's Blog`}>
32+
<BaseLayout title={`${post.title} | TheComputerM's Blog`} description={post.brief}>
3333
<Fragment slot="head">
3434
<link
3535
rel="stylesheet"

0 commit comments

Comments
 (0)