switch to fully static site
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ import mdx from '@astrojs/mdx';
|
|||||||
// https://astro.build/config
|
// https://astro.build/config
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
site: 'https://ghall.blog',
|
site: 'https://ghall.blog',
|
||||||
output: 'hybrid',
|
output: 'static',
|
||||||
adapter: netlify(),
|
adapter: netlify(),
|
||||||
integrations: [
|
integrations: [
|
||||||
mdx(),
|
mdx(),
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const { tags } = Astro.props;
|
|||||||
<div class="tag-container">
|
<div class="tag-container">
|
||||||
{
|
{
|
||||||
tags.sort().map((tag: Tag) => (
|
tags.sort().map((tag: Tag) => (
|
||||||
<a class="tag" href={`/archive/${tag}?page=1`}>
|
<a class="tag" href={`/archive/${tag}`}>
|
||||||
#{tag}
|
#{tag}
|
||||||
</a>
|
</a>
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -4,7 +4,23 @@ import { getCollection } from 'astro:content';
|
|||||||
|
|
||||||
import Layout from '@layouts/Layout.astro';
|
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;
|
const { tag }: { tag?: string } = Astro.params;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
---
|
---
|
||||||
export const prerender = true;
|
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
|
|
||||||
import Layout from '@layouts/Layout.astro';
|
import Layout from '@layouts/Layout.astro';
|
||||||
@@ -22,7 +21,7 @@ const posts = await getCollection('blog');
|
|||||||
{
|
{
|
||||||
posts.length < 6 ? null : (
|
posts.length < 6 ? null : (
|
||||||
<div class="more-posts">
|
<div class="more-posts">
|
||||||
<a href="/archive/all?page=1">All Posts</a>
|
<a href="/archive/all">All Posts</a>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
---
|
---
|
||||||
export const prerender = true;
|
|
||||||
import { getCollection } from 'astro:content';
|
import { getCollection } from 'astro:content';
|
||||||
|
|
||||||
import Layout from '@layouts/Layout.astro';
|
import Layout from '@layouts/Layout.astro';
|
||||||
|
|||||||
Reference in New Issue
Block a user