aboutsummaryrefslogtreecommitdiff
path: root/src/layouts/HomePageLayout.astro
blob: 146eaec7bb2acb59825e8fa7e16ba7c130fea02e (plain)
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
57
58
59
60
61
62
---
import { getCollection } from "astro:content";
import Layout from "./Layout.astro";
import { useTranslations } from "../i18n";

const blogCollection = (await getCollection("blog")).sort((a, b) => {
	return b.data.publishedAt.getTime() - a.data.publishedAt.getTime();
});

const t = useTranslations(Astro.currentLocale);

const schema = {
	"@context": "http://schema.org",
	"@type": "WebSite",
	id: "https://www.costas.dev/",
	url: "https://www.costas.dev/",
	headline: t.homePage.title,
};
---

<Layout title={t.homePage.title} description={t.homePage.description}>
	<script
		is:inline
		type="application/ld+json"
		slot="head-jsonld"
		set:html={JSON.stringify(schema)}
	/>

	<h1>{t.homePage.title}</h1>
	<p>{t.homePage.welcome}</p>

	<h2>{t.homePage.whoAmI}</h2>
	<p>{t.homePage.whoAmIDesc}</p>
	<a href="/trajectory">{t.homePage.moreAboutMe}</a>

	<h2>{t.homePage.whatIDo}</h2>
	<p>{t.homePage.whatIDoDesc}</p>
	<a href="/portfolio">{t.homePage.myPortfolio}</a>

	<h2>{t.homePage.latestBlogPosts}</h2>
	<ul>
		{
			blogCollection.slice(0, 5).map((p) => {
				const date = Intl.DateTimeFormat(Astro.currentLocale, {
					day: "2-digit",
					month: "short",
					year: "numeric",
				}).format(p.data.publishedAt);
				return (
					<li>
						<time datetime={p.data.publishedAt.toISOString()}>
							{date}
						</time>
						<a href={`/blog/${p.id}`}>{p.data.title}</a>
					</li>
				);
			})
		}
	</ul>
	<a href="/blog">{t.homePage.viewAllPosts}</a>

</Layout>