feat: Implement public blog post listing and individual post viewing with new public handlers and templates, adding chrono for date formatting.

This commit is contained in:
2026-03-03 17:11:26 +00:00
parent ef068f7dfa
commit 57f2610164
10 changed files with 303 additions and 24 deletions

46
templates/post.html Normal file
View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{{ post.title }} - Blog</title>
<style>
* {
font-family: monospace !important;
}
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#0000EE" vlink="#551A8B" alink="#FF0000">
<p><a href="/">[Back to Home]</a></p>
<hr size="1">
<h1>{{ post.title }}</h1>
<p><i>Posted by {{ author_username }} on {{ post.formatted_created_at() }}</i></p>
{% if !post.categories.is_empty() %}
<p>Categories: {{ post.categories }}</p>
{% endif %}
{% if !post.tags.is_empty() %}
<p>Tags: {{ post.tags }}</p>
{% endif %}
{% if post.visibility == "password_protected" %}
<p><b>[This post is password protected. In a full implementation, you'd enter a password here.]</b></p>
<hr size="1">
{% else if post.visibility == "private" %}
<p><b>[This post is private and only visible to authorized users.]</b></p>
<hr size="1">
{% else %}
<hr size="1">
<!-- Assuming content is plain text with newlines -->
<p>
<pre>{{ post.content|safe }}</pre>
</p>
<hr size="1">
{% endif %}
<p><a href="/">[Back to Home]</a></p>
</body>
</html>