Setup blog content collection, move all posts, use pubDate

This commit is contained in:
2023-11-25 14:59:43 -06:00
parent f76cff7266
commit a5db301e81
9 changed files with 28 additions and 13 deletions

View File

@@ -9,7 +9,7 @@ description: "This is my first time trying to create a proper blog, and my secon
This is my first time trying to create a proper blog, and my second time using GitHub pages, [the first][github-pages-resume] less than 2 weeks earlier.
As a cheap high school student with zero income and expensive subscriptions, it's obvious that I wouldn't try to brunt
the cost of any sort of subscription for a site I <span style="white-space: nowrap;">barely use - well</span>, not anymore, at least.
the cost of any sort of subscription for a site I <span class="nowrap">barely use - well</span>, not anymore, at least.
Jekyll is pretty cool - I'm really having fun learning new web tech (like Vue, BrowserSync, Sass). The syntax of the header is something new, but the templating language's filters are something I'm already familiar with,
using Jinja with Flask and Django already (great, a third dialect of both similar and completely different filters to get used to!).

View File

@@ -1,7 +1,7 @@
---
layout: "@layouts/Post.astro"
title: "Painting Images with IPv6"
date: 2023-04-14 13:07:43 -0500
pubDate: 2023-04-14 13:07:43 -0500
tags: ["ipv6", "python", "asyncio", "websocket", "PIL"]
description: "Have you ever painted images with IPv6? I found out how in 30 minutes."
---

View File

@@ -1,7 +1,7 @@
---
title: "Project Facelift, New and Old"
layout: "@layouts/Post.astro"
date: 2021-02-25 16:41:41 -0600
pubDate: 2021-02-25 16:41:41 -0600
tags: ["projects", "photography", "update"]
preview_image: "https://raw.githubusercontent.com/Xevion/Paths/master/.media/banner.png"
description: "Through December, I decided to make heavy visual changes to many of my biggest projects, creating custom banners, of which I am quite proud..."

View File

@@ -1,7 +1,7 @@
---
title: "Restricted Memory & Data Framing Tricks"
layout: "@layouts/Post.astro"
date: 2022-07-16 13:51:00 -0500
pubDate: 2022-07-16 13:51:00 -0500
tags: ["c", "memory", "embedded", "ti", "msp430", "union"]
description: "Tips and tricks I learned about handling restricted memory while working on microcontrollers at my first internship"
---

View File

@@ -1,7 +1,7 @@
---
layout: "@layouts/Post.astro"
title: "Runnerspace, Built in Under 30 Hours"
date: 2022-03-29 13:56:22 -0600
pubDate: 2022-03-29 13:56:22 -0600
tags: ["flask", "hackathon", "utsa", "rowdyhacks", "projects"]
preview_image: https://raw.githubusercontent.com/Xevion/runnerspace/master/static/embed-banner.png
description: "I attended Rowdy Hacks 2022 at UTSA, and while I can't say I left smiling, I did create a pretty cool project that I'd like to talk about."

16
src/content/config.ts Normal file
View File

@@ -0,0 +1,16 @@
import { z, defineCollection } from 'astro:content';
const blogCollection = defineCollection({
type: 'content', // v2.5.0 and later
schema: z.object({
title: z.string(),
description: z.string(),
pubDate: z.string(),
tags: z.array(z.string()),
preview_image: z.string().optional(),
}),
});
export const collections = {
'blog': blogCollection,
};

1
src/env.d.ts vendored
View File

@@ -1 +1,2 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />

View File

@@ -1,21 +1,19 @@
---
import { getCollection, getEntry } from "astro:content";
import Base from "@layouts/Base.astro";
import Summary from "@components/Summary.astro";
const posts = await Astro.glob("/src/pages/posts/*.md");
interface Props {
pubDate: Date;
}
const posts = await getCollection("blog");
---
<Base>
{
posts.map((post) => (
<Summary
url={post.url || "unknown"}
description={post.frontmatter.description}
url={post.slug}
description={post.data.description}
date={new Date()}
title={post.frontmatter.title}
tags={post.frontmatter.tags}
title={post.data.title}
tags={post.data.tags}
/>
))
}