--- import { render } from 'astro:content'; import BaseLayout from '@/layouts/BaseLayout.astro'; import Masthead from '@/components/Masthead.astro'; import { getContentCacheKey, getExcerpt, getPostCardImage, getPostPath, getPostTaxonomy, getPublicPosts, slugify } from '@/lib/content'; import { siteConfig } from '@/site.config'; import EngagementTabs from '@/components/EngagementTabs.astro'; import TableOfContents from '@/components/TableOfContents.astro'; import Mermaid from '@/components/Mermaid.astro'; import ImageLightbox from '@/components/ImageLightbox.astro'; export async function getStaticPaths() { const posts = await getPublicPosts(); return posts.map((post, index) => ({ params: { slug: getPostPath(post).replace(/^\/posts\//, '').replace(/\/$/, '') }, props: { post, newer: posts[index - 1], older: posts[index + 1] }, cacheKey: getContentCacheKey('post', [post, posts[index - 1], posts[index + 1]].filter(Boolean)) })); } const { post, newer, older } = Astro.props; const { Content, headings } = await render(post); const cover = getPostCardImage(post, siteConfig.cards.defaultCovers, siteConfig.site.url); const toc = typeof post.data.toc === 'boolean' ? { enabled: post.data.toc, position: 'right' as const } : post.data.toc; const taxonomy = getPostTaxonomy(post); const tags = taxonomy.tags; const date = { year: String(post.data.pubDate.getFullYear()), month: String(post.data.pubDate.getMonth() + 1).padStart(2, '0'), day: String(post.data.pubDate.getDate()).padStart(2, '0') }; const dateText = `${date.year} 年 ${date.month} 月 ${date.day} 日`; ---
{toc.enabled && }
{tags.length > 0 &&
{tags.map((tag) => )}
}