Created simple blog.

This commit is contained in:
WickedJack99
2025-07-28 15:04:22 +02:00
parent 93c17ca16c
commit 7b91d32f23
10 changed files with 2132 additions and 1 deletions

18
index.php Normal file
View File

@@ -0,0 +1,18 @@
<?php
include 'includes/header.php';
$posts = glob('posts/*.md');
rsort($posts);
?>
<h1>Blog</h1>
<ul>
<?php foreach ($posts as $post):
$slug = basename($post, '.md');
$firstLine = fgets(fopen($post, 'r'));
$title = trim(str_replace('#', '', $firstLine));
?>
<li><a href="post.php?slug=<?= urlencode($slug) ?>"><?= htmlspecialchars($title) ?></a></li>
<?php endforeach; ?>
</ul>
<?php include 'includes/footer.php'; ?>