-
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
Showing
19 changed files
with
356 additions
and
51 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,6 +1,12 @@ | ||
import { defineConfig } from 'astro/config' | ||
import { defineConfig } from "astro/config"; | ||
|
||
export default defineConfig({ | ||
site: 'https://mudkip.dev', | ||
compressHTML: true, | ||
site: "https://mudkip.dev", | ||
prefetch: { | ||
defaultStrategy: "viewport", | ||
prefetchAll: true | ||
}, | ||
devToolbar: { | ||
enabled: false | ||
}, | ||
}) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Large diffs are not rendered by default.
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
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,14 @@ | ||
--- | ||
--- | ||
<div class="cards"> | ||
<slot /> | ||
</div> | ||
|
||
<style> | ||
.cards { | ||
margin: 1em auto; | ||
gap: 0.75em; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
</style> |
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,23 @@ | ||
--- | ||
interface Props { | ||
date: Date; | ||
} | ||
const { date } = Astro.props; | ||
--- | ||
<time datetime={date.toISOString()}> | ||
{ | ||
date.toLocaleDateString("en-US", { | ||
year: "numeric", | ||
month: "short", | ||
day: "numeric" | ||
}) | ||
} | ||
</time> | ||
|
||
<style> | ||
time { | ||
color: var(--surface-2); | ||
font-size: 0.85em; | ||
} | ||
</style> |
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,8 @@ | ||
--- | ||
date: 2024-05-09 | ||
title: Test | ||
--- | ||
This is a demo of my blog. I can write for as long as I want, but eventually this description will be cut off at the 50 character limit. | ||
|
||
# boop | ||
helo |
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,12 @@ | ||
import { z, defineCollection } from "astro:content"; | ||
|
||
export const collections = { | ||
"blog": defineCollection({ | ||
type: "content", | ||
schema: z.object({ | ||
title: z.string(), | ||
date: z.date(), | ||
tags: z.array(z.string()).default([]) | ||
}) | ||
}) | ||
}; |
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
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,6 +1,27 @@ | ||
--- | ||
import Page from '../layouts/Page.astro' | ||
import Page from "@layouts/Page.astro"; | ||
import Card from "@components/Card.astro"; | ||
import Cards from "@components/Cards.astro"; | ||
import { getCollection } from "astro:content"; | ||
const posts = await getCollection("blog"); | ||
--- | ||
<Page title="blog"> | ||
<p>coming soon...</p> | ||
{ | ||
posts.length != 0 | ||
? <p>there are currently no published posts</p> | ||
: ( | ||
<Cards> | ||
{posts.map(post => ( | ||
<Card | ||
title={post.data.title} | ||
description={post.body.substring(0, 100) + "..."} | ||
url={"/blog/" + post.slug} | ||
date={post.data.date} | ||
/> | ||
))} | ||
</Cards> | ||
) | ||
} | ||
|
||
</Page> |
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,27 @@ | ||
--- | ||
import type { InferGetStaticPropsType, GetStaticPaths } from "astro"; | ||
import { getCollection } from 'astro:content'; | ||
import Page from "@layouts/Page.astro"; | ||
import Date from '@components/Date.astro'; | ||
type Props = InferGetStaticPropsType<typeof getStaticPaths>; | ||
export const getStaticPaths = (async () => { | ||
const posts = await getCollection("blog"); | ||
return posts.map(post => { | ||
return { | ||
params: { slug: post.slug }, | ||
props: { post, data: post.data }, | ||
}; | ||
}); | ||
}) satisfies GetStaticPaths; | ||
const { post, data } = Astro.props; | ||
const { Content } = await post.render(); | ||
--- | ||
<Page title="blog"> | ||
<h1>{data.title}</h1> | ||
<Date date={data.date} /> | ||
<Content /> | ||
</Page> |
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
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,22 @@ | ||
import rss from "@astrojs/rss"; | ||
import type { APIContext } from "astro"; | ||
import { getCollection } from "astro:content"; | ||
|
||
export async function GET(context: APIContext) { | ||
const posts = await getCollection("blog"); | ||
|
||
return rss({ | ||
site: context.site!, | ||
title: "mudkip's blog", | ||
description: "Random thoughts and ramblings I have.", | ||
stylesheet: "/style.xsl", | ||
items: posts.map(post => ({ | ||
link: `/blog/${post.slug}`, | ||
title: post.data.title, | ||
pubDate: post.data.date, | ||
content: post.body, | ||
})), | ||
customData: "<language>en-us</language>", | ||
trailingSlash: false, | ||
}) | ||
} |
Oops, something went wrong.