summaryrefslogtreecommitdiff
path: root/examples/blog/src/layouts/BlogPost.astro
blob: 4baf8e9720f06fbd3aa91579dc652381f0636c46 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
---
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;
---

<html lang="en">
	<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>