Set base href, for the benefit of rendered pages with relative links.
Fixes #177
Jelmer Vernooij authored 8 years ago
Jelmer Vernooij committed 8 years ago
3 | 3 |
<link rel=stylesheet href={{ url_for('static', filename='pygments.css') }}>
|
4 | 4 |
<link rel=stylesheet href={{ url_for('static', filename='klaus.css') }}>
|
5 | 5 |
<link rel=icon type="image/png" href="{{ url_for('static', filename='favicon.png') }}" />
|
|
6 |
{% if base_href %}
|
|
7 |
<base href="{{ base_href }}"/>
|
|
8 |
{% endif %}
|
6 | 9 |
<title>{% block title %}{% endblock %} - {{ SITE_NAME }}</title>
|
7 | 10 |
|
8 | 11 |
<script src={{ url_for('static', filename='klaus.js') }}></script>
|
35 | 35 |
sort_key = lambda repo: repo.name
|
36 | 36 |
reverse = False
|
37 | 37 |
repos = sorted(current_app.repos.values(), key=sort_key, reverse=reverse)
|
38 | |
return render_template('repo_list.html', repos=repos)
|
|
38 |
return render_template('repo_list.html', repos=repos, base_href=None)
|
39 | 39 |
|
40 | 40 |
|
41 | 41 |
def robots_txt():
|
|
101 | 101 |
'path': path,
|
102 | 102 |
'blob_or_tree': blob_or_tree,
|
103 | 103 |
'subpaths': list(subpaths(path)) if path else None,
|
|
104 |
'base_href': None,
|
104 | 105 |
}
|
105 | 106 |
|
106 | 107 |
|
|
200 | 201 |
|
201 | 202 |
def make_template_context(self, *args):
|
202 | 203 |
super(IndexView, self).make_template_context(*args)
|
|
204 |
|
|
205 |
self.context['base_href'] = url_for(
|
|
206 |
'blob',
|
|
207 |
repo=self.context['repo'].name,
|
|
208 |
rev=self.context['rev'],
|
|
209 |
path=''
|
|
210 |
)
|
203 | 211 |
|
204 | 212 |
self.context['page'] = 0
|
205 | 213 |
history_length = 10
|