Recent Blog Posts


Adding an RSS feed to my Astro blog

One of the reasons I had delayed setting up an RSS feed for this blog is that Astro is still technically in beta, and many aspects of coding the site are changing right before my eyes! With everything else I was learning, I didn't want to have to re-learn this, too. But, in the spirit of accessible, self-hosted content, I started the new year by sitting down and cranking it out. Here's how I did it...

rss
astro
blogging

2022-01-07

Read more

RSS - getting started

I finally did the work to create an RSS feed for this blog. I'll be getting in to how I (eventually!) set this up in Astro, but first, here's a quick description of how I *consume* RSS. (And, convienently, how I'm gonna test that I can successfully see a new post!)

rss
astro
blogging

2022-01-05

Read more

See full post archive ...


The Code For This Page:

This is src/pages/blog.astro which is generated from markdown files located in src/pages/posts/ using:

---
import BaseLayout from '../layouts/BaseLayout.astro';
import { Markdown } from 'astro/components'
let allPosts = Astro.fetchContent('../pages/posts/*.md');
allPosts.sort((a, b) => new Date(b.date) - new Date(a.date));
---
<div>
{allPosts.slice(0, 5).map((post) => (
<article>
<a href={post.url}><h3>{post.title}</h3></a>
<p>{post.url}</p>
<p>{post.description}</p>
<p>{new Date(post.date).toISOString().slice(0, 10)}</p>
<a href={post.url}>Read more</a>
</article>
))}
</div>