From efee2a4a4a973c7d2d8b42525069df01b2797271 Mon Sep 17 00:00:00 2001 From: Mitsuo Tokumori Date: Sun, 29 Oct 2023 06:11:16 -0500 Subject: Make truncate and add to long titles --- flaskr/__init__.py | 6 +++--- flaskr/templates/blog/index.html | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/flaskr/__init__.py b/flaskr/__init__.py index 3f068e8..f2a4584 100644 --- a/flaskr/__init__.py +++ b/flaskr/__init__.py @@ -24,9 +24,9 @@ def create_app(test_config=None): pass # Routes - @app.route('/hello') - def index(): - return 'Hello, World!' + # @app.route('/hello') + # def index(): + # return 'Hello, World!' # Register functions and blueprints from . import db diff --git a/flaskr/templates/blog/index.html b/flaskr/templates/blog/index.html index 0d3ed17..0fb2e80 100644 --- a/flaskr/templates/blog/index.html +++ b/flaskr/templates/blog/index.html @@ -13,7 +13,11 @@
-

{{ post['title'] }}

+ {% if post['title'].__len__() > 80 %} +

{{ post['title'][:80] }}

+ {% else %} +

{{ post['title'] }}

+ {% endif %}
by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}
{% if g.user['id'] == post['author_id'] %} -- cgit v1.2.3