Move to Astro

This commit is contained in:
2023-02-01 14:12:30 +00:00
commit bf36c8c9b3
463 changed files with 10340 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
---
import { getCollection } from "astro:content";
export async function getStaticPaths() {
const blogEntries = await getCollection("blog");
return blogEntries.map((entry) => ({
params: { slug: entry.slug },
props: { entry },
}));
}
const { entry } = Astro.props;
const { Content } = await entry.render();
---
<Content />
+36
View File
@@ -0,0 +1,36 @@
---
import Layout from "../layouts/TitleLayout.astro";
import FrontPageLink from "../components/FrontPageLink.astro";
import { getCollection } from "astro:content";
const allBlogPosts = await getCollection("blog");
---
<Layout>
<main>
<div class="container">
<div class="row row-cols-1 row-cols-sm-2 row-cols-lg-3">
{
allBlogPosts
.sort((a, b) => {
return (
new Date(a.data.date).getTime() -
new Date(b.data.date).getTime()
);
})
.map((b) => (
<FrontPageLink
href={b.slug}
title={b.data.title}
imageSrc={b.data.image}
description={b.data.description}
/>
))
}
</div>
</div>
</main>
</Layout>
<style></style>
+17
View File
@@ -0,0 +1,17 @@
import rss from "@astrojs/rss";
import { getCollection } from "astro:content";
export async function get(context: any) {
const blog = await getCollection("blog");
return rss({
title: "Nozzy House News",
description: "What's going on in the Nozzy house",
site: context.site,
items: blog.map((post) => ({
title: post.data.title,
pubDate: post.data.date,
description: `In which ${post.data.description}`,
link: post.slug,
})),
});
}