Add MarkdownPostLayout component and update post files to use it for consistent layout

This commit is contained in:
Thuan Bui
2026-01-02 14:09:12 +07:00
parent 89a1d62208
commit 2289c0cf44
4 changed files with 15 additions and 4 deletions
+12
View File
@@ -0,0 +1,12 @@
---
import BaseLayout from "./BaseLayout.astro";
const { frontmatter } = Astro.props;
---
<BaseLayout pageTitle={frontmatter.title}>
<p>Published on: {frontmatter.pubDate.toString().slice(0, 10)}</p>
<p>Written by {frontmatter.author}</p>
<img src={frontmatter.image.url} width='300' alt={frontmatter.image.alt} />
<slot />
</BaseLayout>
<meta charset='utf-8' />
+1 -4
View File
@@ -1,4 +1,5 @@
--- ---
layout: ../../layouts/MarkdownPostLayout.astro
title: 'My First Blog Post' title: 'My First Blog Post'
pubDate: 2022-07-01 pubDate: 2022-07-01
description: 'This is the first post of my new Astro blog.' description: 'This is the first post of my new Astro blog.'
@@ -8,10 +9,6 @@ image:
alt: 'The Astro logo on a dark background with a pink glow.' alt: 'The Astro logo on a dark background with a pink glow.'
tags: ["astro", "blogging", "learning in public"] tags: ["astro", "blogging", "learning in public"]
--- ---
# My First Blog Post
Published on: 2022-07-01
Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website. Welcome to my _new blog_ about learning Astro! Here, I will share my learning journey as I build a new website.
## What I've accomplished ## What I've accomplished
+1
View File
@@ -1,4 +1,5 @@
--- ---
layout: ../../layouts/MarkdownPostLayout.astro
title: My Second Blog Post title: My Second Blog Post
author: Astro Learner author: Astro Learner
description: "After learning some Astro, I couldn't stop!" description: "After learning some Astro, I couldn't stop!"
+1
View File
@@ -1,4 +1,5 @@
--- ---
layout: ../../layouts/MarkdownPostLayout.astro
title: My Third Blog Post title: My Third Blog Post
author: Astro Learner author: Astro Learner
description: "I had some challenges, but asking in the community really helped!" description: "I had some challenges, but asking in the community really helped!"