From cf4c44dd223cd40bec3256fed0defd9a640fc02d Mon Sep 17 00:00:00 2001 From: Bobby Date: Wed, 24 May 2023 22:47:11 -0400 Subject: Update article page --- blog/views.py | 7 +++++++ static/css/styles.css | 18 +++++++++++++++++- templates/blog/home.html | 2 +- templates/blog/post.html | 37 +++++++++++++++++++++++++------------ 4 files changed, 50 insertions(+), 14 deletions(-) diff --git a/blog/views.py b/blog/views.py index 9fd2b10e..4c10af31 100644 --- a/blog/views.py +++ b/blog/views.py @@ -118,6 +118,13 @@ def post(request, slug): if p.find('br') is not None: p.decompose() + # separate the body in two parts -> the first paragraph and the rest + first_paragraph = soup.find('p') + if first_paragraph is not None: + first_paragraph = str(first_paragraph) + soup.find('p').decompose() + + post.first_paragraph = first_paragraph post.body = str(soup) diff --git a/static/css/styles.css b/static/css/styles.css index 3df5c61e..819e974f 100644 --- a/static/css/styles.css +++ b/static/css/styles.css @@ -13,6 +13,10 @@ body { box-sizing: border-box; } +input, textarea { + font-family: 'Mali', sans-serif !important; +} + #bg-video { position: fixed; right: 0; @@ -116,7 +120,7 @@ kbd { blockquote { border-left: solid 4px #a591ee; - width: 650px; + /* width: 650px; */ margin: 0px auto; padding: 8px; background: #2f2f2f; @@ -313,6 +317,18 @@ blockquote { text-align: justify; } +#article { + padding: 0px; + display: block; + clear: both; + width: 730px; +} + +#article-body { + width: 730px; + margin: 0px 10px; +} + #article-body img, #editor-container img { height: 300px; diff --git a/templates/blog/home.html b/templates/blog/home.html index a0fe6b47..391c510e 100644 --- a/templates/blog/home.html +++ b/templates/blog/home.html @@ -49,7 +49,7 @@ {% if posts %}
-

Recent Posts

+

Recent Posts

{% include 'blog/partials/post_list.html' %}
{% endif %} diff --git a/templates/blog/post.html b/templates/blog/post.html index f5227e25..701d0b28 100644 --- a/templates/blog/post.html +++ b/templates/blog/post.html @@ -1,18 +1,31 @@ {% extends 'blog/partials/base.html' %} {% block content %} {% load static %} +{% load tz %}
- Cover Image -

{{ post.title }}

-

- Posted on {{ post.date | date:"M d, Y" }} by {{ post.author }} in {{ post.category }} -

-

Tags: - {% for tag in tags %} - {{ tag.name|title }}{% if not forloop.last %},{% endif %} - {% endfor %} -

-
-
{{ post.body | safe }}
+

+ {{ post.title }} +

+
+ {% with post.author.userprofile_set.first as userprofile %} +
+ {% endwith %} +
+ + {{ post.author.first_name }} {{ post.author.last_name }} + + posted in + + {{ post.category }} + + | + {% localtime on %}{{ post.date | date:"M d, Y" }}{% endlocaltime %} +
+
+
+
{{ post.first_paragraph | safe }}
+
+
{{ post.body | safe }}
+
-- cgit v1.2.3