switch to fully static site
This commit is contained in:
@@ -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>
|
||||
))
|
||||
|
||||
@@ -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,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,5 +1,4 @@
|
||||
---
|
||||
export const prerender = true;
|
||||
import { getCollection } from 'astro:content';
|
||||
|
||||
import Layout from '@layouts/Layout.astro';
|
||||
|
||||
Reference in New Issue
Block a user