diff --git a/site/content/static/css/blog.css b/site/content/static/css/blog.css
index d3502ce..eb57754 100644
--- a/site/content/static/css/blog.css
+++ b/site/content/static/css/blog.css
@@ -26,7 +26,8 @@ article {
}
.post-link {
- padding-right: 20px;
+ text-decoration: none;
+ color: black;
}
.post-title {
@@ -39,6 +40,12 @@ article {
.post-body {
padding-top: 1rem;
+ margin-left: 2rem;
+}
+
+.submit-box {
+ display: flex;
+ justify-content: space-between;
}
#submit-form {
diff --git a/site/content/templates/about.html b/site/content/templates/about.html
index 7d4d5cf..f647ce1 100644
--- a/site/content/templates/about.html
+++ b/site/content/templates/about.html
@@ -1,55 +1,47 @@
-
-
+{% extends "base.html" %}
-
-
-
-
-
+{% block head %}
+{{ super() }}
+Submit post
+
+{% endblock head %}
- {{ username }}' site
-
-
-
+{% block content %}
+Hi, I'm {{ username }}
+
+ Back to the blog
+
+
+ This is my blog.
-
- Hi, I'm {{ username }}
-
- Back to the blog
-
-
- This is my blog.
-
- {% if email %}
- If you have questions or input for me please send me an E-Mail to {{ email }}
- {% endif %}
-
-
-
-
-
-
-
-
\ No newline at end of file
+ {% if email %}
+ If you have questions or input for me please send me an E-Mail to {{ email }}
+ {% endif %}
+
+
+
+
+
+{% endblock content %}
\ No newline at end of file
diff --git a/site/content/templates/article.html.macro b/site/content/templates/article.html.macro
new file mode 100644
index 0000000..f250781
--- /dev/null
+++ b/site/content/templates/article.html.macro
@@ -0,0 +1,11 @@
+{% macro article(id, title, body, publish_date) %}
+
+
+
+ {{ title }}
+
+
{{ publish_date | date(format="%Y-%m-%d at %H:%M") }}
+
{{ body }}
+
+
+{% endmacro article %}
\ No newline at end of file
diff --git a/site/content/templates/base.html b/site/content/templates/base.html
new file mode 100644
index 0000000..3a994db
--- /dev/null
+++ b/site/content/templates/base.html
@@ -0,0 +1,18 @@
+
+
+
+
+ {% block head %}
+
+
+
+
+
+ {% endblock head %}
+
+
+
+ {% block content %}{% endblock content %}
+
+
+
\ No newline at end of file
diff --git a/site/content/templates/blog-all-posts.html b/site/content/templates/blog-all-posts.html
index 7f9eeaf..4f3c563 100644
--- a/site/content/templates/blog-all-posts.html
+++ b/site/content/templates/blog-all-posts.html
@@ -1,35 +1,25 @@
-
-
-
-
-
-
-
-
+{% extends "base.html" %}
+{% import "article.html.macro" as article_macro %}
- All posts
-
-
-
+{% block head %}
+{{ super() }}
+
+
+
+ All posts
+{% endblock head %}
-
-
-
- About
- Last 5 posts
-
-
-
-
+
+{% block content %}
+
+
+ About
+ Last 5 posts
+
+
+ {% for post in posts %}
+ {{ article_macro::article(id=post.id,title=post.title,body=post.body,publish_date=post.publish_date) }}
+ {% endfor %}
+
+
+{% endblock content %}
\ No newline at end of file
diff --git a/site/content/templates/blog-by-id.html b/site/content/templates/blog-by-id.html
index 89f4ec4..d755cc7 100644
--- a/site/content/templates/blog-by-id.html
+++ b/site/content/templates/blog-by-id.html
@@ -1,35 +1,28 @@
-
-
-
-
-
-
-
-
+{% extends "base.html" %}
- {{ post.title }} | {{ username }}' blog
-
-
-
+{% block head %}
+{{ super() }}
+
+
+ {{ post.title }} | {{ username }}' blog
+{% endblock head %}
-
-
-
- Home
- About
- All Posts
-
-
-
-
-
-
{{ post.title }}
-
{{ post.publish_date | date(format="%Y-%m-%d at %H:%M") }}
-
{{ post.body }}
-
-
-
-
-
+{% block content %}
+
+
+ Home
+ About
+ All Posts
+
+
+
+
+
+ {{ post.title }}
+
+
{{ post.publish_date | date(format="%Y-%m-%d at %H:%M") }}
+
{{ post.body }}
+
+
+
+{% endblock content %}
\ No newline at end of file
diff --git a/site/content/templates/blog.html b/site/content/templates/blog.html
index 4fd04a0..751b75a 100644
--- a/site/content/templates/blog.html
+++ b/site/content/templates/blog.html
@@ -1,38 +1,22 @@
-
-
+{% extends "base.html" %}
+{% import "article.html.macro" as article_macro %}
-
-
-
-
-
-
+{% block head %}
+{{ super() }}
+
+
+ {{ username }} blog
+{% endblock head %}
- {{ username }}' blog
-
-
-
-
-
-
-
- About
- All Posts
-
-
- {% for post in posts %}
-
-
-
-
{{ post.title }}
-
{{ post.publish_date | date(format="%Y-%m-%d at %H:%M") }}
-
{{ post.body }}
-
-
- {% endfor %}
-
-
-
-
\ No newline at end of file
+{% block content %}
+
+
+ About
+ All Posts
+
+
+ {% for post in posts %}
+ {{ article_macro::article(id=post.id,title=post.title,body=post.body,publish_date=post.publish_date) }}
+ {% endfor %}
+
+{% endblock content %}
\ No newline at end of file
diff --git a/site/content/templates/edit-form.html b/site/content/templates/edit-form.html
index 34c5c1e..a8160a3 100644
--- a/site/content/templates/edit-form.html
+++ b/site/content/templates/edit-form.html
@@ -1,43 +1,32 @@
-
-
+{% extends "base.html" %}
-
-
-
-
-
+{% block head %}
+{{ super() }}
+Edit '{{ title }}'
+
+{% endblock head %}
- Edit '{{ title }}'
-
-
-
+{% block content %}
+
-
-
- Password
-
-
-
-
-
-
- Title
- {{ title }}
-
- Content
- {{ body }}
-
- Edit post
-
-
-
-
- Hide post
-
-
-
- Delete post
-
-
-
-
\ No newline at end of file
+
+
+ Hide post
+
+
+
+ Delete post
+
+{% endblock content %}
\ No newline at end of file
diff --git a/site/content/templates/submit.html b/site/content/templates/submit.html
index 869350a..599d7da 100644
--- a/site/content/templates/submit.html
+++ b/site/content/templates/submit.html
@@ -1,34 +1,26 @@
-
-
+{% extends "base.html" %}
-
-
-
-
-
+{% block head %}
+{{ super() }}
+Submit post
+
+{% endblock head %}
- Submit post
-
-
-
-
-
- Password
-
-
-
-
-
-
- Title
- {{ title }}
-
- Content
- {{ body }}
-
+{% block content %}
+
+ Title
+ {{ title }}
+
+ Content
+ {{ body }}
+
+
+
+ Password
+
+
Submit
-
-
-
-
\ No newline at end of file
+
+
+{% endblock content %}
\ No newline at end of file
diff --git a/site/src/api.rs b/site/src/api.rs
index 73d200b..7e7eab0 100644
--- a/site/src/api.rs
+++ b/site/src/api.rs
@@ -26,7 +26,7 @@ async fn blog_create_post(form: Form) -> impl Responder {
}
HttpResponse::MovedPermanently()
- .insert_header(("LOCATION", "/blog"))
+ .insert_header(("LOCATION", "/"))
.finish()
}
@@ -46,7 +46,7 @@ async fn blog_edit_post(post_id: web::Path, form: Form) ->
}
return HttpResponse::MovedPermanently()
- .insert_header(("LOCATION", "/blog"))
+ .insert_header(("LOCATION", "/"))
.finish();
}
@@ -65,7 +65,7 @@ async fn blog_delete_post(
}
return HttpResponse::MovedPermanently()
- .insert_header(("LOCATION", "/blog"))
+ .insert_header(("LOCATION", "/"))
.finish();
}
@@ -81,7 +81,7 @@ async fn blog_hide_post(post_id: web::Path, form: Form)
}
return HttpResponse::MovedPermanently()
- .insert_header(("LOCATION", "/blog"))
+ .insert_header(("LOCATION", "/"))
.finish();
}
diff --git a/site/src/main.rs b/site/src/main.rs
index 08b36b8..5be401f 100644
--- a/site/src/main.rs
+++ b/site/src/main.rs
@@ -22,7 +22,7 @@ async fn main() -> std::io::Result<()> {
Tera::new(format!("{}{}", CONFIG.root_path, "/templates/*").as_str()).unwrap();
tera.autoescape_on(vec![".sql"]);
- env_logger::Builder::from_env(Env::default().default_filter_or("info"));
+ env_logger::Builder::from_env(Env::default().default_filter_or("debug"));
App::new()
.app_data(Data::new(tera))