Astro blog starter
This commit is contained in:
57
src/layouts/BlogPost.astro
Normal file
57
src/layouts/BlogPost.astro
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
import BaseHead from "../components/BaseHead.astro";
|
||||
import Header from "../components/Header.astro";
|
||||
import Footer from "../components/Footer.astro";
|
||||
|
||||
export interface Props {
|
||||
content: {
|
||||
title: string;
|
||||
description: string;
|
||||
pubDate?: string;
|
||||
updatedDate?: string;
|
||||
heroImage?: string;
|
||||
};
|
||||
}
|
||||
|
||||
const {
|
||||
content: { title, description, pubDate, updatedDate, heroImage },
|
||||
} = Astro.props as Props;
|
||||
---
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<BaseHead title={title} description={description} />
|
||||
<style>
|
||||
.title {
|
||||
font-size: 2em;
|
||||
margin: 0.25em 0 0;
|
||||
}
|
||||
hr {
|
||||
border-top: 1px solid #DDD;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<Header />
|
||||
<main>
|
||||
<article>
|
||||
{heroImage && (
|
||||
<img
|
||||
width={720}
|
||||
height={360}
|
||||
src={heroImage}
|
||||
alt=""
|
||||
/>
|
||||
)}
|
||||
<h1 class="title">{title}</h1>
|
||||
{pubDate && <time>{pubDate}</time>}
|
||||
{updatedDate && <div>Last updated on <time>{updatedDate}</time></div>}
|
||||
<hr/>
|
||||
<slot />
|
||||
</article>
|
||||
</main>
|
||||
<Footer />
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user