- 追蹤 ID 存 site_settings(空字串即關閉),於 /admin/settings 管理 - Base.astro 僅在用戶同意後載入分析工具,未同意前零請求 - 新增 /privacy 私隱政策頁與「重設 Cookie 偏好」按鈕 - 前台 SSR 頁面(首頁、blog、about、privacy)傳入 gaId / metaPixelId - seed 加入預設空值,Footer 加入私隱政策連結 - 同步更新 AGENTS.md 與 README 說明
33 lines
1016 B
Plaintext
33 lines
1016 B
Plaintext
---
|
|
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}
|
|
gaId={settings.ga4_measurement_id}
|
|
metaPixelId={settings.meta_pixel_id}
|
|
>
|
|
<BlogIndex posts={items} settings={settings} client:idle />
|
|
</Base>
|