-
Notifications
You must be signed in to change notification settings - Fork 0
/
post.php
51 lines (45 loc) · 1.06 KB
/
post.php
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
<?php
// Template for rendering a single post
require "config.php";
require "utils.php";
?>
<!DOCTYPE html>
<html lang="<?= $site_language ?>">
<head>
<?php include "partials/head.php" ?>
<script src="/assets/webmention.min.js" async></script>
<?php
if (isset($_GET['year']) && isset($_GET['id'])) {
$post = getPost($_GET['year'], $_GET['id']);
$notFound = !isset($post);
} else {
header("Location: /");
}
?>
<title>
<?php
if(!$notFound) {
echo "$post->id by @".$post->author->name." — $site_title";
} else {
echo "Post not found — $site_title";
}
?>
</title>
</head>
<body>
<main>
<?php
include "partials/header.php";
if(!$notFound) {
showPost($post);
include "partials/comment-section.php";
} else {
showError("This post doesn't exist (anymore)");
}
?>
</main>
<aside>
<?php include "partials/sidebar.php" ?>
</aside>
</body>
</html>