diff --git a/wikinote/__init__.py b/wikinote/__init__.py index 43c03f2..f4bb372 100644 --- a/wikinote/__init__.py +++ b/wikinote/__init__.py @@ -202,6 +202,9 @@ def tags_list(): @app.route('/tag/') 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']) diff --git a/wikinote/jinja2/tag_404.html b/wikinote/jinja2/tag_404.html new file mode 100644 index 0000000..b9edbd0 --- /dev/null +++ b/wikinote/jinja2/tag_404.html @@ -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 . +#} + +{% extends 'base.html' %} + +{% block title %}Tag: {{ name }} • WikiNote{% endblock %} + +{% block content %} + + +

{{ name }}

+ +
+ There are no indexed pages with the name {{ name }}. +
+{% endblock %}