-
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.
- Loading branch information
1 parent
861402e
commit d4ec4bf
Showing
8 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,5 +1,8 @@ | ||
{ | ||
"yaml.schemas": { | ||
"https://json.schemastore.org/github-workflow.json": "file:///mnt/wd-blue-2tb/home/jonahgam/bitbloxhub.github.io/.github/workflows/deploy.yaml" | ||
}, | ||
"files.associations": { | ||
"*.mdx": "markdown" | ||
} | ||
} |
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
1 change: 0 additions & 1 deletion
1
src/pages/posts/first-post.mdx → src/content/blog/first-post.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
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,16 @@ | ||
import { z, defineCollection } from "astro:content" | ||
|
||
const blogCollection = defineCollection({ | ||
type: "content", | ||
schema: z.object({ | ||
title: z.string(), | ||
pubDate: z.date(), | ||
description: z.string(), | ||
author: z.string(), | ||
minutesRead: z.string() | ||
}) | ||
}) | ||
|
||
export const collections = { | ||
"blog": blogCollection | ||
} |
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
/// <reference path="../.astro/types.d.ts" /> | ||
/// <reference types="astro/client" /> |
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
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 |
---|---|---|
@@ -1,14 +1,15 @@ | ||
--- | ||
import { getCollection } from "astro:content" | ||
import Layout from "../layouts/Layout.astro" | ||
import BlogPost from "../components/BlogPost.astro" | ||
const allPosts = await Astro.glob("../pages/posts/*.mdx") | ||
const allPosts = await getCollection("blog") | ||
const pageTitle = "bitbloxhub's blog" | ||
--- | ||
<Layout title={pageTitle}> | ||
<main class="m-auto p-6 max-w-6xl text-left"> | ||
<h1>bitbloxhub's blog!</h1> | ||
<ul class="text-base"> | ||
{allPosts.map((post) => <BlogPost url={post.url} title={post.frontmatter.title} minutesRead={post.frontmatter.minutesRead} pubDate={post.frontmatter.pubDate} />)} | ||
{allPosts.map((post) => <BlogPost url={`/posts/${post.slug}/`} title={post.data.title} minutesRead={post.data.minutesRead} pubDate={post.data.pubDate} />)} | ||
</ul> | ||
</main> | ||
</Layout> |
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,17 @@ | ||
--- | ||
import { getCollection } from "astro:content" | ||
import MarkdownPostLayout from "../../layouts/MarkdownPostLayout.astro" | ||
// 1. Generate a new path for every collection entry | ||
export async function getStaticPaths() { | ||
const blogEntries = await getCollection("blog") | ||
return blogEntries.map(entry => ({ | ||
params: { slug: entry.slug }, props: { entry } | ||
})) | ||
} | ||
// 2. When it's time to render, you can get the entry directly from the prop | ||
const { entry } = Astro.props | ||
const { Content } = await entry.render() | ||
--- | ||
<MarkdownPostLayout frontmatter={entry.data}> | ||
<Content /> | ||
</MarkdownPostLayout> |