Pārlūkot izejas kodu

add custom 404 page

Noemi Vanyi 8 gadus atpakaļ
vecāks
revīzija
0056c4035e

+ 7
- 0
searx/templates/courgette/404.html Parādīt failu

@@ -0,0 +1,7 @@
1
+{% extends "courgette/base.html" %}
2
+{% block content %}
3
+<div class="center">
4
+    <h1>{{ _('Page not found') }}</h1>
5
+    <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6
+</div>
7
+{% endblock %}

+ 7
- 0
searx/templates/default/404.html Parādīt failu

@@ -0,0 +1,7 @@
1
+{% extends "default/base.html" %}
2
+{% block content %}
3
+<div class="center">
4
+    <h1>{{ _('Page not found') }}</h1>
5
+    <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6
+</div>
7
+{% endblock %}

+ 7
- 0
searx/templates/oscar/404.html Parādīt failu

@@ -0,0 +1,7 @@
1
+{% extends "oscar/base.html" %}
2
+{% block content %}
3
+<div class="text-center">
4
+    <h1>{{ _('Page not found') }}</h1>
5
+    <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6
+</div>
7
+{% endblock %}

+ 7
- 0
searx/templates/pix-art/404.html Parādīt failu

@@ -0,0 +1,7 @@
1
+{% extends "pix-art/base.html" %}
2
+{% block content %}
3
+<div class="center">
4
+    <h1>{{ _('Page not found') }}</h1>
5
+    <p>{{ _('Go to <a href="/">search page</a>.') }}</p>
6
+</div>
7
+{% endblock %}

+ 5
- 0
searx/webapp.py Parādīt failu

@@ -715,6 +715,11 @@ def config():
715 715
                     'default_theme': settings['ui']['default_theme']})
716 716
 
717 717
 
718
+@app.errorhandler(404)
719
+def page_not_found(e):
720
+    return render('404.html')
721
+
722
+
718 723
 def run():
719 724
     app.run(
720 725
         debug=settings['general']['debug'],

+ 5
- 0
tests/robot/test_basic.robot Parādīt failu

@@ -9,6 +9,11 @@ Front page
9 9
     Page Should Contain  about
10 10
     Page Should Contain  preferences
11 11
 
12
+404 page
13
+    Go To  http://localhost:11111/no-such-page
14
+    Page Should Contain  Page not found
15
+    Page Should Contain  Go to search page
16
+
12 17
 About page
13 18
     Click Element  link=about
14 19
     Page Should Contain  Why use Searx?