first commit
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
---
|
||||
import Base from "../../layouts/Base.astro";
|
||||
import { BlogIndex } from "../../components/site/BlogIndex";
|
||||
import { getPublishedPosts, getSettings, formatDate } from "../../data/content";
|
||||
import { getDb } from "../../lib/db";
|
||||
import { getEnv } from "../../lib/env";
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
const db = getDb(getEnv().DB);
|
||||
const [posts, settings] = await Promise.all([getPublishedPosts(db), getSettings(db)]);
|
||||
|
||||
const items = posts.map((p) => ({
|
||||
slug: p.slug,
|
||||
title: p.title,
|
||||
excerpt: p.excerpt,
|
||||
coverImage: p.coverImage,
|
||||
dateLabel: formatDate(p.publishedAt),
|
||||
}));
|
||||
|
||||
Astro.response.headers.set("Cache-Control", "public, s-maxage=60, stale-while-revalidate=300");
|
||||
---
|
||||
|
||||
<Base
|
||||
title="太陽能知識庫"
|
||||
description={settings.seo_default_description || "村屋太陽能嘅實用資訊、安裝心得同回本分析。"}
|
||||
image={settings.og_image}
|
||||
>
|
||||
<BlogIndex posts={items} settings={settings} client:load />
|
||||
</Base>
|
||||
Reference in New Issue
Block a user