aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/index.astro24
-rw-r--r--src/pages/micro/[...slug].astro20
-rw-r--r--src/pages/micro/index.astro54
-rw-r--r--src/pages/rss.xml.js14
4 files changed, 108 insertions, 4 deletions
diff --git a/src/pages/index.astro b/src/pages/index.astro
index c2129e0..3886d8f 100644
--- a/src/pages/index.astro
+++ b/src/pages/index.astro
@@ -9,6 +9,11 @@ import FormattedDate from "../components/FormattedDate.astro";
const posts = (await getCollection("blog")).sort(
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf()
);
+
+const microposts = (await getCollection("micro")).sort(
+ (a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf()
+);
+
---
<!DOCTYPE html>
@@ -50,6 +55,22 @@ const posts = (await getCollection("blog")).sort(
}
</ul>
</section>
+ <h2>Recent MicroPosts</h2>
+ <section>
+ <ul>
+ {
+ microposts
+ .slice(-5)
+ .map((post) => (
+ <li>
+ <FormattedDate date={post.data.pubDate} />
+ <a href={`/micro/${post.slug}/`}>{post.data.title}</a>
+ </li>
+ ))
+ .reverse()
+ }
+ </ul>
+ </section>
<h1>
👋 Greetings, Adventurer
</h1>
@@ -58,6 +79,9 @@ const posts = (await getCollection("blog")).sort(
archive my thoughts and processes on various topics or projects. It'll pretty much
just be whatever I feel like writing about, posts will be very infrequent so don't expect much.
</p>
+ <p>
+ Blog posts are regular long form writing about some technical concept, MicroPosts are all over the place and are usually quite unstructured. The RSS feed combines both of these.
+ </p>
<p>Check out the main site as well: <a href="https://pinapelz.com">pinapelz.com</a></p>
</p>
</main>
diff --git a/src/pages/micro/[...slug].astro b/src/pages/micro/[...slug].astro
new file mode 100644
index 0000000..0ad6f8b
--- /dev/null
+++ b/src/pages/micro/[...slug].astro
@@ -0,0 +1,20 @@
+---
+import { CollectionEntry, getCollection } from 'astro:content';
+import BlogPost from '../../layouts/BlogPost.astro';
+
+export async function getStaticPaths() {
+ const posts = await getCollection('micro');
+ return posts.map((post) => ({
+ params: { slug: post.slug },
+ props: post,
+ }));
+}
+type Props = CollectionEntry<'micro'>;
+
+const post = Astro.props;
+const { Content } = await post.render();
+---
+
+<BlogPost {...post.data}>
+ <Content />
+</BlogPost>
diff --git a/src/pages/micro/index.astro b/src/pages/micro/index.astro
new file mode 100644
index 0000000..7393216
--- /dev/null
+++ b/src/pages/micro/index.astro
@@ -0,0 +1,54 @@
+---
+import BaseHead from '../../components/BaseHead.astro';
+import Header from '../../components/Header.astro';
+import Footer from '../../components/Footer.astro';
+import { SITE_TITLE, SITE_DESCRIPTION } from '../../consts';
+import { getCollection } from 'astro:content';
+import FormattedDate from '../../components/FormattedDate.astro';
+
+const posts = (await getCollection('micro')).sort(
+ (a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf()
+);
+---
+
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <BaseHead title={SITE_TITLE} description={SITE_DESCRIPTION} />
+ <style>
+ ul {
+ list-style-type: none;
+ padding: unset;
+ }
+ ul li {
+ display: flex;
+ }
+ ul li :global(time) {
+ flex: 0 0 130px;
+ font-style: italic;
+ color: #646464;
+ }
+ ul li a:visited {
+ color: #8e32dc;
+ }
+ </style>
+ </head>
+ <body>
+ <Header />
+ <main>
+ <section>
+ <ul>
+ {
+ posts.map((post) => (
+ <li>
+ <FormattedDate date={post.data.pubDate} />
+ <a href={`/micro/${post.slug}/`}>{post.data.title}</a>
+ </li>
+ ))
+ }
+ </ul>
+ </section>
+ </main>
+ <Footer />
+ </body>
+</html>
diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js
index 6fed721..83f4946 100644
--- a/src/pages/rss.xml.js
+++ b/src/pages/rss.xml.js
@@ -3,15 +3,21 @@ import { getCollection } from 'astro:content';
import { SITE_TITLE, SITE_DESCRIPTION } from '../consts';
export async function GET(context) {
- const posts = await getCollection('blog');
- posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime());
+ const blogPosts = await getCollection('blog');
+ const microPosts = await getCollection('micro');
+ const posts = [...blogPosts, ...microPosts];
+ posts.sort(
+ (a, b) =>
+ new Date(b.data.pubDate).getTime() -
+ new Date(a.data.pubDate).getTime()
+ );
return rss({
title: SITE_TITLE,
description: SITE_DESCRIPTION,
site: context.site,
items: posts.map((post) => ({
...post.data,
- link: `/blog/${post.slug}/`,
+ link: `/${post.collection}/${post.slug}/`,
})),
});
-} \ No newline at end of file
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage