diff options
| author | Mitsuo Tokumori <[email protected]> | 2023-10-29 06:11:16 -0500 |
|---|---|---|
| committer | Mitsuo Tokumori <[email protected]> | 2023-10-29 06:11:16 -0500 |
| commit | efee2a4a4a973c7d2d8b42525069df01b2797271 (patch) | |
| tree | dc865f808a991da0594f16bfbe2127331b050e9d | |
| parent | cafc557c6820e1808b1e4cf71f58ff99b97ca545 (diff) | |
| download | ustayml-efee2a4a4a973c7d2d8b42525069df01b2797271.tar.gz ustayml-efee2a4a4a973c7d2d8b42525069df01b2797271.tar.bz2 ustayml-efee2a4a4a973c7d2d8b42525069df01b2797271.zip | |
Make truncate and add <abbr> to long titles
| -rw-r--r-- | flaskr/__init__.py | 6 | ||||
| -rw-r--r-- | 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 @@ <article class="post"> <header> <div> - <h1>{{ post['title'] }}</h1> + {% if post['title'].__len__() > 80 %} + <h1><abbr title="{{ post['title'] }}">{{ post['title'][:80] }}</abbr></h1> + {% else %} + <h1>{{ post['title'] }}</h1> + {% endif %} <div class="about">by {{ post['username'] }} on {{ post['created'].strftime('%Y-%m-%d') }}</div> </div> {% if g.user['id'] == post['author_id'] %} |
