summary refs log tree commit diff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/base.html17
-rw-r--r--templates/index.html11
-rw-r--r--templates/post.html8
3 files changed, 36 insertions, 0 deletions
diff --git a/templates/base.html b/templates/base.html
new file mode 100644
index 0000000..48b4d9c
--- /dev/null
+++ b/templates/base.html
@@ -0,0 +1,17 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Blog</title>
+    <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
+</head>
+<body>
+    <header>
+        <h1><a href="{{ url_for('index') }}">My Blog</a></h1>
+    </header>
+    <main>
+        {% block content %}{% endblock %}
+    </main>
+</body>
+</html>
\ No newline at end of file
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..9a05e7a
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,11 @@
+{% extends 'base.html' %}
+
+{% block content %}
+    <h2>Posts</h2>
+    <ul>
+        {% for post in posts %}
+            <li><a href="{{ url_for('post', post_id=post.id) }}">{{ post.title }}</a> - {{ post.created_at.strftime('%Y-%m-%d') }}</li>
+        {% endfor %}
+    </ul>
+    <a href="{{ url_for('create') }}">Create a new post</a>
+{% endblock %}
\ No newline at end of file
diff --git a/templates/post.html b/templates/post.html
new file mode 100644
index 0000000..5a28b2b
--- /dev/null
+++ b/templates/post.html
@@ -0,0 +1,8 @@
+{% extends 'base.html' %}
+
+{% block content %}
+    <h2>{{ post.title }}</h2>
+    <p>{{ post.created_at.strftime('%Y-%m-%d %H:%M') }}</p>
+    <div>{{ post.content }}</div>
+    <a href="{{ url_for('index') }}">Back to posts</a>
+{% endblock %}
\ No newline at end of file