blog with links

This commit is contained in:
2022-08-20 15:39:52 +01:00
parent 2617497ed8
commit f97cbc0ee4
3 changed files with 28 additions and 1 deletions

19
src/pages/blog.astro Normal file
View File

@ -0,0 +1,19 @@
---
const posts = await Astro.glob('./posts/*.md');
console.log(posts[0].url);
---
<html>
<head>
<title>Blog</title>
</head>
<body class="w-full flex justify-center">
<div class="w-1/2 flex flex-col">
{posts.map((post) => {
console.log(post.frontmatter);
return (
<h1>{post.frontmatter.title}</h1>
<a href={post.url}>Read</a>
)})}
</div>
</body>
</html>

View File

@ -0,0 +1,8 @@
---
layout: '../../layouts/lay.astro'
title: 'Hello World'
---
# Hello World
This is a simple blog post written in markdown.

View File

@ -1,5 +1,5 @@
--- ---
layout: '../layouts/lay.astro' layout: '../../layouts/lay.astro'
title: 'My Markdown page' title: 'My Markdown page'
--- ---
# Hello world # Hello world