new: dev: favicon for entry

This commit is contained in:
rachmadaniHaryono 2018-05-01 17:55:44 +08:00
parent 8e0c02751d
commit b659a8bd02
2 changed files with 5 additions and 0 deletions

View File

@ -530,6 +530,8 @@ def create_app(config_filename=None):
"""Shell context definition.""" """Shell context definition."""
return {'app': app, 'bukudb': bukudb} return {'app': app, 'bukudb': bukudb}
app.jinja_env.filters['netloc'] = lambda x: urlparse(x).netloc # pylint: disable=no-member
Bootstrap(app) Bootstrap(app)
# routing # routing
app.add_url_rule('/api/tags', 'get_tags', get_tags, methods=['GET']) app.add_url_rule('/api/tags', 'get_tags', get_tags, methods=['GET'])

View File

@ -60,6 +60,9 @@
{% for item in bookmarks %} {% for item in bookmarks %}
<tr> <td style="overflow-wrap: break-word;"> <tr> <td style="overflow-wrap: break-word;">
<h3> <h3>
{% if item.url|netloc %}
<img src='http://www.google.com/s2/favicons?domain={{item.url|netloc}}'/>
{% endif %}
<a href="{{item.url}}">{{item.title}}</a> <a href="{{item.url}}">{{item.title}}</a>
<a href="{{url_for('bookmark_api-html', id=item.id)}}"> <a href="{{url_for('bookmark_api-html', id=item.id)}}">
<span class="glyphicon glyphicon-pencil" aria-hidden="true"></span> <span class="glyphicon glyphicon-pencil" aria-hidden="true"></span>