blogs/sites/research/src/pages/[...slug].astro
Neeldhara Misra 165aa5636f
Some checks are pending
Build / build (push) Waiting to run
Improve blog post rendering
2026-06-25 00:56:25 +05:30

30 lines
1 KiB
Text

---
import { getCollection, render } from 'astro:content';
import CoralComments from '@/components/CoralComments.astro';
import DefaultLayout from '@/layouts/DefaultLayout.astro';
import { BlogPost } from '@/components/sections/blog-post';
import { ACTIVE_BLOG_SITE } from '@/blog-sites.js';
import { SITE_TITLE } from '@/consts';
export async function getStaticPaths() {
const posts = await getCollection(ACTIVE_BLOG_SITE.key);
return posts.map((post) => ({
params: { slug: post.id.replace(/\/index$/, '') },
props: post,
}));
}
const post = Astro.props;
const { Content } = await render(post);
const postSlug = post.id.replace(/\/index$/, '');
const coralStoryID = `${ACTIVE_BLOG_SITE.key}:${postSlug}`;
const coralStoryURL = new URL(`/${postSlug}/`, ACTIVE_BLOG_SITE.url).toString();
---
<DefaultLayout title={`${post.data.title} | ${SITE_TITLE}`} description={post.data.description}>
<BlogPost post={post}>
<Content />
</BlogPost>
<CoralComments storyID={coralStoryID} storyURL={coralStoryURL} />
</DefaultLayout>