Browse Source

[fix] proper src/href url handling

Adam Tauber 11 years ago
parent
commit
a4f89a7981

+ 3
- 3
searx/templates/about.html View File

@@ -2,9 +2,9 @@
2 2
 {% block content %}
3 3
 {% include 'github_ribbon.html' %}
4 4
 <div class="row">
5
-    <h1>About <a href="/">searx</a></h1>
5
+    <h1>About <a href="{{ url_for('index') }}">searx</a></h1>
6 6
 
7
-    <p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, aggregating the results of other <a href="/preferences">search engines</a> while not storing information about its users.
7
+    <p>Searx is a <a href="https://en.wikipedia.org/wiki/Metasearch_engine">metasearch engine</a>, aggregating the results of other <a href="{{ url_for('preferences') }}">search engines</a> while not storing information about its users.
8 8
     </p>
9 9
     <h2>Why use Searx?</h2>
10 10
     <ul>
@@ -60,7 +60,7 @@ Searx can be added to your browser's search bar; moreover, it can be set as the
60 60
 <p>See the <a href="https://github.com/asciimoo/searx/wiki/Installation">installation and setup</a> wiki page</p>
61 61
 
62 62
 <h3>How to debug engines?</h3>
63
-<p><a href="/stats">Stats page</a> contains some useful data about the engines used.</p>
63
+<p><a href="{{ url_for('stats') }}">Stats page</a> contains some useful data about the engines used.</p>
64 64
 
65 65
 </div>
66 66
 {% endblock %}

+ 3
- 3
searx/templates/base.html View File

@@ -6,19 +6,19 @@
6 6
     <meta name="keywords" content="searx, search, search engine, metasearch, meta search" />
7 7
     <meta name="viewport" content="width=device-width, maximum-scale=1.0, user-scalable=1" />
8 8
     <title>{% block title %}{% endblock %}searx</title>
9
-    <link rel="stylesheet" href="/static/css/style.css" type="text/css" media="screen" />
9
+    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css" media="screen" />
10 10
     <link rel="shortcut icon" href="{{ url_for('static', filename='img/favicon.png') }}?v=2" />
11 11
     {% block styles %}
12 12
     {% endblock %}
13 13
     {% block head %}
14
-    <link title="searx" type="application/opensearchdescription+xml" rel="search" href="/opensearch.xml"/>
14
+    <link title="searx" type="application/opensearchdescription+xml" rel="search" href="{{ url_for('opensearch') }}"/>
15 15
     {% endblock %}
16 16
 </head>
17 17
 <body>
18 18
 <div id="container">
19 19
 {% block content %}
20 20
 {% endblock %}
21
-<script src="/static/js/searx.js" ></script>
21
+<script src="{{ url_for('static', filename='js/searx.js') }}" ></script>
22 22
 </div>
23 23
 </body>
24 24
 </html>

+ 1
- 1
searx/templates/github_ribbon.html View File

@@ -1,3 +1,3 @@
1 1
 <a href="https://github.com/asciimoo/searx" class="github">
2
-    <img style="position: absolute; top: 0; right: 0; border: 0;" src="/static/img/github_ribbon.png" alt="Fork me on GitHub"  class="github"/>
2
+    <img style="position: absolute; top: 0; right: 0; border: 0;" src="{{ url_for('static', filename='img/github_ribbon.png') }}" alt="Fork me on GitHub"  class="github"/>
3 3
 </a>

+ 2
- 2
searx/templates/index.html View File

@@ -4,8 +4,8 @@
4 4
     <div class="title"><h1>searx</h1></div>
5 5
     {% include 'search.html' %}
6 6
     <p class="top_margin">
7
-        <a href="/about" class="hmarg">{{ _('about') }}</a>
8
-        <a href="/preferences" class="hmarg">{{ _('preferences') }}</a>
7
+        <a href="{{ url_for('about') }}" class="hmarg">{{ _('about') }}</a>
8
+        <a href="{{ url_for('preferences') }}" class="hmarg">{{ _('preferences') }}</a>
9 9
     </p>
10 10
 </div>
11 11
 {% endblock %}

+ 2
- 2
searx/templates/preferences.html View File

@@ -4,7 +4,7 @@
4 4
 <div class="row">
5 5
     <h2>{{ _('Preferences') }}</h2>
6 6
 
7
-    <form method="post" action="/preferences" id="search_form">
7
+    <form method="post" action="{{ url_for('preferences') }}" id="search_form">
8 8
     <fieldset>
9 9
         <legend>{{ _('Default categories') }}</legend>
10 10
         <p>
@@ -66,6 +66,6 @@
66 66
 
67 67
     <input type="submit" value="{{ _('save') }}" />
68 68
     </form>
69
-    <div class="right"><a href="/">{{ _('back') }}</a></div>
69
+    <div class="right"><a href="{{ url_for('index') }}">{{ _('back') }}</a></div>
70 70
 </div>
71 71
 {% endblock %}

+ 6
- 6
searx/templates/results.html View File

@@ -1,7 +1,7 @@
1 1
 {% extends "base.html" %}
2 2
 {% block title %}{{ q }} - {% endblock %}
3 3
 {% block content %}
4
-<div class="right"><a href="/preferences" id="preferences"><span>preferences</span></a></div>
4
+<div class="right"><a href="{{ url_for('preferences') }}" id="preferences"><span>preferences</span></a></div>
5 5
 <div class="small search">
6 6
     {% include 'search.html' %}
7 7
 </div>
@@ -10,8 +10,8 @@
10 10
         {% if suggestions %}
11 11
         <div id="suggestions"><span>{{ _('Suggestions') }}</span>
12 12
             {% for suggestion in suggestions %}
13
-            <form method="post" action="/">
14
-                <input type="hidden" name="q" value="{{suggestion}}">
13
+            <form method="post" action="{{ url_for('index') }}">
14
+                <input type="hidden" name="q" value="{{ suggestion }}">
15 15
                 <input type="submit" value="{{ suggestion }}" />
16 16
             </form>
17 17
             {% endfor %}
@@ -25,7 +25,7 @@
25 25
         <div id="apis">
26 26
         {{ _('Download results') }}
27 27
         {% for output_type in ('csv', 'json', 'rss') %}
28
-        <form method="post" action="/">
28
+        <form method="post" action="{{ url_for('index') }}">
29 29
             <div class="left">
30 30
             <input type="hidden" name="q" value="{{ q }}" />
31 31
             <input type="hidden" name="format" value="{{ output_type }}" />
@@ -52,7 +52,7 @@
52 52
     {% if paging %}
53 53
     <div id="pagination">
54 54
         {% if pageno > 1 %}
55
-            <form method="post" action="/">
55
+            <form method="post" action="{{ url_for('index') }}">
56 56
                 <div class="left">
57 57
                 <input type="hidden" name="q" value="{{ q }}" />
58 58
                 {% for category in selected_categories %}
@@ -63,7 +63,7 @@
63 63
                 </div>
64 64
             </form>
65 65
         {% endif %}
66
-        <form method="post" action="/">
66
+        <form method="post" action="{{ url_for('index') }}">
67 67
             <div class="left">
68 68
             {% for category in selected_categories %}
69 69
             <input type="hidden" name="category_{{ category }}" value="1"/>

+ 1
- 1
searx/templates/search.html View File

@@ -1,4 +1,4 @@
1
-<form method="post" action="/" id="search_form">
1
+<form method="post" action="{{ url_for('index') }}" id="search_form">
2 2
   <div id="search_wrapper">
3 3
     <input type="text" id="q" class="q" name="q" tabindex="1" autocomplete="off" {% if q %}value="{{ q }}"{% endif %}/>
4 4
     <input type="submit" value="search" id="search_submit" />