From 0894770f12b5bebf47d08195b682eec6ed126ed2 Mon Sep 17 00:00:00 2001 From: Michiel Scholten Date: Mon, 29 Aug 2016 13:49:29 +0200 Subject: [PATCH] Show url domain name along with 'no title' for items without title --- digimarks.py | 4 ++++ templates/bookmarks.html | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/digimarks.py b/digimarks.py index 7d323b2..a19d6b7 100644 --- a/digimarks.py +++ b/digimarks.py @@ -203,6 +203,10 @@ class Bookmark(db.Model): else: return None + def get_uri_domain(self): + parsed = urlparse(self.url) + return parsed.hostname + @classmethod def strip_url_params(cls, url): parsed = urlparse(url) diff --git a/templates/bookmarks.html b/templates/bookmarks.html index 6f031d7..ad4ce12 100644 --- a/templates/bookmarks.html +++ b/templates/bookmarks.html @@ -107,7 +107,7 @@ {% if bookmark.title %} {{ bookmark.title }} {% else %} - [ no title ] + {{ bookmark.get_uri_domain() }} (no title) {% endif %}