Restore post metadata and align comments
Some checks are pending
Build / build (push) Waiting to run

This commit is contained in:
Neeldhara Misra 2026-06-25 05:04:25 +05:30
parent 5f146e3ef4
commit 4b3aa3022e
24 changed files with 400 additions and 95 deletions

View file

@ -8,7 +8,7 @@ const { storyID, storyURL } = Astro.props;
const coralRoot = "https://coral.neeldhara.cloud";
---
<section class="coral-comments container max-w-3xl py-10 md:py-12" aria-label="Comments">
<section class="coral-comments blog-comments-shell" aria-label="Comments">
<div id="coral_thread" data-story-id={storyID} data-story-url={storyURL}></div>
</section>

View file

@ -1,3 +1,14 @@
import { format } from "date-fns";
const getReadingTime = (body: string | undefined) => {
const words = (body ?? "")
.replace(/```[\s\S]*?```/g, " ")
.replace(/<[^>]+>/g, " ")
.match(/\b[\w'-]+\b/g);
return Math.max(1, Math.ceil((words?.length ?? 0) / 220));
};
const BlogPost = ({
post,
children,
@ -5,12 +16,19 @@ const BlogPost = ({
post: any;
children: React.ReactNode;
}) => {
const { title } = post.data;
const { title, pubDate } = post.data;
const readingTime = getReadingTime(post.body);
return (
<section className="container px-6 py-2 md:py-6">
<article className="poetry-post mx-auto">
<h1 className="poetry-post-title">{title}</h1>
<div className="poetry-post-meta">
<time dateTime={pubDate.toISOString()}>
{format(pubDate, "MMMM d, yyyy")}
</time>
<span>{readingTime} min read</span>
</div>
<div className="poetry-post-body">{children}</div>
</article>
</section>

View file

@ -18,6 +18,10 @@
}
.blog-post-meta {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.65rem;
color: hsl(var(--muted-foreground));
font-family: var(--font-mono);
font-size: 0.75rem;
@ -25,6 +29,12 @@
text-transform: uppercase;
}
.blog-post-meta span::before {
content: "/";
margin-right: 0.65rem;
color: color-mix(in srgb, hsl(var(--muted-foreground)) 55%, transparent);
}
.blog-post-header .blog-post-title {
margin-top: 0.65rem;
color: hsl(var(--foreground));
@ -314,7 +324,9 @@
}
.article-content :where([data-footnotes] ol) {
padding-left: 1.25rem;
margin-left: 0;
padding-left: 0;
list-style-position: inside;
}
.article-content :where([data-footnotes] li + li) {
@ -322,6 +334,7 @@
}
.article-content :where([data-footnotes] p) {
display: inline;
margin: 0;
}
@ -330,6 +343,17 @@
text-decoration: none;
}
.blog-comments-shell {
width: 100%;
max-width: 64rem;
margin-inline: auto;
padding: 0 1.5rem 4.5rem;
}
.blog-comments-shell #coral_thread {
width: 100%;
}
@media (min-width: 768px) {
.blog-post-shell {
padding-top: 4rem;

View file

@ -300,7 +300,16 @@
}
.poetry-post-title {
@apply mb-8 text-2xl font-semibold md:mb-10 md:text-3xl;
@apply mb-3 text-2xl font-semibold md:text-3xl;
}
.poetry-post-meta {
@apply mb-8 flex flex-wrap items-center justify-center gap-2 font-mono text-xs uppercase tracking-wide text-muted-foreground md:mb-10;
}
.poetry-post-meta span::before {
content: "/";
margin-right: 0.5rem;
}
.poetry-post-body {