blog with links
This commit is contained in:
19
src/pages/blog.astro
Normal file
19
src/pages/blog.astro
Normal 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>
|
8
src/pages/posts/hello-world.md
Normal file
8
src/pages/posts/hello-world.md
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
layout: '../../layouts/lay.astro'
|
||||||
|
title: 'Hello World'
|
||||||
|
---
|
||||||
|
|
||||||
|
# Hello World
|
||||||
|
|
||||||
|
This is a simple blog post written in markdown.
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
layout: '../layouts/lay.astro'
|
layout: '../../layouts/lay.astro'
|
||||||
title: 'My Markdown page'
|
title: 'My Markdown page'
|
||||||
---
|
---
|
||||||
# Hello world
|
# Hello world
|
||||||
|
Reference in New Issue
Block a user