--- import { type CollectionEntry, getCollection, render } from "astro:content"; import PostLayout from "@/layouts/PostLayout.astro"; import Header from "@/components/Header.astro"; import Footer from "@/components/Footer.astro"; import Datetime from "@/components/Datetime.astro"; import Tag from "@/components/Tag.astro"; import { getPostSlug, getPostUrl } from "@/utils/getPostPaths"; import { getSortedPosts } from "@/utils/getSortedPosts"; import { slugifyStr } from "@/utils/slugify"; import EditPost from "./_components/EditPost.astro"; import ShareLinks from "./_components/ShareLinks.astro"; import BackButton from "./_components/BackButton.astro"; import BackToTopButton from "./_components/BackToTopButton.astro"; import AdjacentPostNav from "./_components/AdjacentPostNav.astro"; import config from "@/config"; export async function getStaticPaths() { const posts = await getCollection("posts"); const sortedPosts = getSortedPosts(posts); return sortedPosts.map((post, index) => ({ params: { slug: getPostSlug(post.id, post.filePath) }, props: { post, prevPost: index > 0 ? { id: sortedPosts[index - 1].id, title: sortedPosts[index - 1].data.title, filePath: sortedPosts[index - 1].filePath, } : null, nextPost: index < sortedPosts.length - 1 ? { id: sortedPosts[index + 1].id, title: sortedPosts[index + 1].data.title, filePath: sortedPosts[index + 1].filePath, } : null, }, })); } type AdjacentPost = { id: string; title: string; filePath: string | undefined; } | null; type Props = { post: CollectionEntry<"posts">; prevPost: AdjacentPost; nextPost: AdjacentPost; }; const { post, prevPost, nextPost } = Astro.props; const locale = Astro.currentLocale ?? config.site.lang; const { title, description, ogImage: initOgImage, canonicalURL, pubDatetime, modDatetime, timezone, tags, hideEditPost, } = post.data; const { Content } = await render(post); let ogImageUrl: string | undefined; if (typeof initOgImage === "string") { ogImageUrl = initOgImage; } else if (initOgImage?.src) { ogImageUrl = initOgImage.src; } if (!ogImageUrl && config.features.dynamicOgImage) { const postUrl = getPostUrl(post.id, post.filePath, locale).replace( /\/+$/, "" ); ogImageUrl = `${postUrl}/index.png`; } const ogImage = ogImageUrl ? new URL(ogImageUrl, Astro.url.origin).href : undefined; ---

{title}


    {tags.map(tag => )}