switch to fully static site

This commit is contained in:
2024-06-24 21:32:27 -04:00
parent 1707188201
commit 3947e06968
5 changed files with 20 additions and 6 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ const { tags } = Astro.props;
<div class="tag-container">
{
tags.sort().map((tag: Tag) => (
<a class="tag" href={`/archive/${tag}?page=1`}>
<a class="tag" href={`/archive/${tag}`}>
#{tag}
</a>
))
+17 -1
View File
@@ -4,7 +4,23 @@ import { getCollection } from 'astro:content';
import Layout from '@layouts/Layout.astro';
export const prerender = false;
export async function getStaticPaths() {
const posts = await getCollection('blog');
const tags = ['all'];
posts.forEach((post) =>
post.data.tags.forEach((tag) => {
if (!tags.includes(tag)) {
tags.push(tag);
}
})
);
return tags.map((tag) => ({
params: { tag },
props: { tag },
}));
}
const { tag }: { tag?: string } = Astro.params;
+1 -2
View File
@@ -1,5 +1,4 @@
---
export const prerender = true;
import { getCollection } from 'astro:content';
import Layout from '@layouts/Layout.astro';
@@ -22,7 +21,7 @@ const posts = await getCollection('blog');
{
posts.length < 6 ? null : (
<div class="more-posts">
<a href="/archive/all?page=1">All Posts</a>
<a href="/archive/all">All Posts</a>
</div>
)
}
-1
View File
@@ -1,5 +1,4 @@
---
export const prerender = true;
import { getCollection } from 'astro:content';
import Layout from '@layouts/Layout.astro';