-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move blogs to astro collections
- Loading branch information
1 parent
76303e0
commit 26e001e
Showing
11 changed files
with
62 additions
and
37 deletions.
There are no files selected for viewing
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
tools-nodejs/vighnesh153-astro/website/src/content.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { defineCollection, z } from "astro:content"; | ||
|
||
import { glob } from "astro/loaders"; | ||
|
||
const blog = defineCollection({ | ||
loader: glob({ base: "./src/content/blog", pattern: "**/*.mdx" }), | ||
schema: z.object({ | ||
title: z.coerce.string(), | ||
creationDate: z.coerce.date(), | ||
description: z.coerce.string(), | ||
tags: z.enum(["software engineering", "best practices", "philosophy"]) | ||
.array(), | ||
slug: z.coerce.string(), | ||
live: z.coerce.boolean().default(false), | ||
}), | ||
}); | ||
|
||
export const collections = { blog }; |
3 changes: 1 addition & 2 deletions
3
...pages/blog/how-to-pull-requests/index.mdx → ...src/content/blog/how-to-pull-requests.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...bsite/src/pages/blog/playground/index.mdx → ...o/website/src/content/blog/playground.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...c/pages/blog/reinvent-the-wheel/index.mdx → ...content/blog/reinvent-the-wheel/index.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
tools-nodejs/vighnesh153-astro/website/src/pages/blog/[id].astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
import { getCollection, render } from "astro:content"; | ||
import BlogLayout from "@/layouts/BlogLayout.astro"; | ||
export async function getStaticPaths() { | ||
const posts = await getCollection("blog"); | ||
return posts.map((post) => ({ | ||
params: { id: post.data.slug }, | ||
props: { post }, | ||
})); | ||
} | ||
const { post } = Astro.props; | ||
const { Content } = await render(post); | ||
--- | ||
|
||
<BlogLayout post={post}> | ||
<Content /> | ||
</BlogLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 0 additions & 7 deletions
7
tools-nodejs/vighnesh153-astro/website/src/utils/BlogFrontmatter.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters