refactor: move website files to the root level

This commit is contained in:
Oliver Davies 2023-03-21 20:44:42 +00:00
parent c2887ecbc5
commit 2cbbfd60ff
590 changed files with 0 additions and 4484 deletions

View file

@ -0,0 +1,32 @@
---
import AboutMe from "~/components/AboutMe.astro";
import Layout from "~/layouts/Layout.astro";
import Markdown from "~/components/Markdown.astro";
import { getSlugFromFile } from "~/utils.ts";
export async function getStaticPaths() {
const posts = await Astro.glob("../../posts/*.md");
return posts.map((post) => {
const slug = getSlugFromFile(post.file);
return {
params: { slug },
props: { post },
};
});
}
const { Content } = Astro.props.post;
const { title } = Astro.props.post.frontmatter;
---
<Layout title={title}>
<div class="space-y-6">
<Markdown>
<Content />
</Markdown>
<AboutMe />
</div>
</Layout>

View file

@ -0,0 +1,32 @@
---
import ListingPage from "~/components/ListingPage.astro";
import PageLayout from "~/layouts/PageLayout.astro";
import { getSlugFromFile } from "~/utils.ts";
const posts = await Astro.glob("../../posts/*.md");
// TODO: show all posts when running locally.
const filteredPosts = posts
.filter((post) => !post.frontmatter.draft)
.filter((post) => post.frontmatter.date);
const sortedPosts = filteredPosts
.map((post) => {
const slug = `/blog/${getSlugFromFile(post.file)}`;
return { item: post, slug };
})
.sort(
(a, b) =>
new Date(b.item.frontmatter.date).valueOf() -
new Date(a.item.frontmatter.date).valueOf()
);
---
<ListingPage items={sortedPosts} title="Blog">
<p slot="intro">
This is where I publish my personal blog posts as well as technical posts
and tutorials on topics such as Drupal, PHP, Tailwind CSS, automated
testing, and systems administration.
</p>
</ListingPage>