Update structure

This commit is contained in:
Thuan Bui
2026-03-14 16:07:03 +07:00
11 changed files with 68 additions and 41 deletions
@@ -16,14 +16,14 @@ const { post } = Astro.props;
const { Content, remarkPluginFrontmatter } = await render(post);
const { title, description, pubDate, author, image } = post.data;
const formattedDate = pubDate.toLocaleDateString("es-ES", {
const formattedDate = pubDate.toLocaleDateString("vi-VN", {
year: "numeric",
month: "long",
day: "numeric",
});
const readingTime = remarkPluginFrontmatter?.minutesRead
? `${Math.ceil(remarkPluginFrontmatter.minutesRead)} min de lectura`
? `${Math.ceil(remarkPluginFrontmatter.minutesRead)} phút đọc`
: "";
const metadata = {
@@ -62,7 +62,11 @@ const metadata = {
{
image && (
<div class="reveal relative mb-8 h-96 w-full overflow-hidden rounded-xl shadow-lg">
<img src={image} alt={title} class="h-full w-full object-cover" />
<img
src={`/images/${image}`}
alt={title}
class="h-full w-full object-cover"
/>
</div>
)
}
@@ -10,9 +10,7 @@ export async function getStaticPaths() {
const categories = new Set();
posts.forEach((post) => {
if (post.data.category) {
categories.add(post.data.category);
}
post.data.categories?.forEach((tag) => categories.add(tag));
});
return Array.from(categories).map((category) => {
@@ -20,7 +18,9 @@ export async function getStaticPaths() {
params: { category: category as string },
props: {
category,
posts: posts.filter((post) => post.data.category === category),
posts: posts.filter((post) =>
post.data.categories?.includes(category as string),
),
},
};
});
@@ -50,7 +50,7 @@ const metadata = {
/>
<div class="mb-8 text-center">
<a href="/blog" class="text-primary hover:underline">← Back to blog</a>
<a href="/blog" class="text-primary hover:underline">← Quay lại blog</a>
</div>
<div class="grid gap-8 md:grid-cols-2 lg:grid-cols-3">
@@ -48,7 +48,7 @@ const metadata = {
/>
<div class="mb-8 text-center">
<a href="/blog" class="text-primary hover:underline">← Back to blog</a>
<a href="/blog" class="text-primary hover:underline">← Quay lại blog</a>
</div>
<div class="grid gap-8 md:grid-cols-2 lg:grid-cols-3">