Show page when tag not found
This commit is contained in:
parent
d60516420b
commit
badc2a452f
@ -202,6 +202,9 @@ def tags_list():
|
||||
|
||||
@app.route('/tag/<name>')
|
||||
def tag_view(name):
|
||||
if name not in index['tags']:
|
||||
return flask.render_template('tag_404.html', name=name)
|
||||
|
||||
pages = index['tags'][name]
|
||||
pages.sort(key=lambda p: p['kind'])
|
||||
pages.sort(key=lambda p: p['path'])
|
||||
|
36
wikinote/jinja2/tag_404.html
Normal file
36
wikinote/jinja2/tag_404.html
Normal file
@ -0,0 +1,36 @@
|
||||
{#
|
||||
WikiNote3
|
||||
Copyright © 2020 Lee Yingtong Li (RunasSudo)
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
#}
|
||||
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Tag: {{ name }} • WikiNote{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<nav class="breadcrumbs">
|
||||
<a href="/"><img src="{{ url_for('static', filename='img/icons/home.svg') }}"></a>
|
||||
›
|
||||
<a href="{{ url_for('tags_list') }}">Tags</a>
|
||||
›
|
||||
</nav>
|
||||
|
||||
<h1>{{ name }}</h1>
|
||||
|
||||
<div class="admonition error">
|
||||
There are no indexed pages with the name <em>{{ name }}</em>.
|
||||
</div>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user