Skip to content

Commit a30bbd9

Browse files
committed
Use relative_url on everything
1 parent d53046c commit a30bbd9

File tree

13 files changed

+82
-68
lines changed

13 files changed

+82
-68
lines changed

404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<a class="not-found-link" href="javascript:history.back()">
3838
{% fa_svg fas.fa-arrow-left %} 返回上一页
3939
</a>
40-
<a class="not-found-link" href="/">
40+
<a class="not-found-link" href="{ '/' | relative_url }">
4141
镜像列表 {% fa_svg fas.fa-arrow-right %}
4242
</a>
4343
</div>

_includes/footer.html

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,12 @@ <h4>Contact Us</h4>
3434
<h4>Sponsor</h4>
3535
<div class="img-responsive thuhidden">
3636
{% for sponsor in site.sponsor %}
37-
<img src="/static/img/{{ site.sponsors[sponsor].logo }}.png" srcset="/static/img/{{ site.sponsors[sponsor].logo }}.png 1x, /static/img/{{ site.sponsors[sponsor].logo }}@2x.png 2x, /static/img/{{ site.sponsors[sponsor].logo }}@3x.png 3x, /static/img/{{ site.sponsors[sponsor].logo }}@4x.png 4x" alt="{{ site.sponsors[sponsor].short }}" />
37+
<img src="{{ '/static/img/' | append: site.sponsors[sponsor].logo | append: '.png' | relative_url }}" srcset="
38+
{{ '/static/img/' | append: site.sponsors[sponsor].logo | append: '.png' | relative_url }} 1x,
39+
{{ '/static/img/' | append: site.sponsors[sponsor].logo | append: '@2x.png' | relative_url }} 2x,
40+
{{ '/static/img/' | append: site.sponsors[sponsor].logo | append: '@3x.png' | relative_url }} 3x,
41+
{{ '/static/img/' | append: site.sponsors[sponsor].logo | append: '@4x.png' | relative_url }} 4x"
42+
alt="{{ site.sponsors[sponsor].short }}" />
3843
{% endfor %}
3944
</div>
4045
{% assign first_sponsor = site.sponsors[site.sponsor.first] %}
@@ -51,7 +56,12 @@ <h4>Sponsor</h4>
5156
{% endif %}
5257
</div>
5358
<div class="col-lg-4 col-md-4{% if page.legacy %} col-xs-4{% endif %}">
54-
<img class="img-responsive thuhidden center-block" style="margin-top:5%" src="/static/img/logo-white.png" srcset="/static/img/logo-white.png 1x, /static/img/[email protected] 2x, /static/img/[email protected] 3x, /static/img/[email protected] 4x" />
59+
<img class="img-responsive thuhidden center-block" style="margin-top:5%"
60+
src="{{ '/static/img/logo-white.png' | relative_url }}" srcset="
61+
{{ '/static/img/logo-white.png' | relative_url }} 1x,
62+
{{ '/static/img/[email protected]' | relative_url }} 2x,
63+
{{ '/static/img/[email protected]' | relative_url }} 3x,
64+
{{ '/static/img/[email protected]' | relative_url }} 4x" />
5565
</div>
5666
</div><!--/row -->
5767
</div><!--/container -->

_includes/head.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<meta name="description" content="{{ page_desc }}">
1010
<meta name="keywords" content="镜像站,镜像源,Linux,软件源,开源">
1111
<meta name="author" content="{{ site.author }}">
12-
<link rel="shortcut icon" href="/static/img/favicon.png">
12+
<link rel="shortcut icon" href="{{ '/static/img/favicon.png' | relative_url}}">
1313

1414
<!-- Open Graph metadata -->
1515
<meta property="og:title" content="{{ page_title }}" />
@@ -29,19 +29,19 @@
2929

3030
<title>{{ page_title }}</title>
3131
{% unless include.nostyle %}
32-
<link rel="stylesheet" href="/static/css/bootstrap.min.css?{{ site.data['hash'] }}">
33-
<link rel="stylesheet" href="/static/css/bootstrap-select.min.css?{{ site.data['hash'] }}">
34-
<link rel="stylesheet" href="/static/css/style.css?{{ site.data['hash'] }}">
35-
<script src="/static/js/jquery.min.js?{{ site.data['hash'] }}"></script>
36-
<script src="/static/js/bootstrap.min.js?{{ site.data['hash'] }}"></script>
37-
<script src="/static/js/bootstrap-select.min.js?{{ site.data['hash'] }}"></script>
32+
<link rel="stylesheet" href="{{ 'static/css/bootstrap.min.css?' | append: site.data['hash'] | relative_url }}">
33+
<link rel="stylesheet" href="{{ 'static/css/bootstrap-select.min.css?' | append: site.data['hash'] | relative_url }}">
34+
<link rel="stylesheet" href="{{ 'static/css/style.css?' | append: site.data['hash'] | relative_url }}">
35+
<script src="{{ 'static/js/jquery.min.js?' | append: site.data['hash'] | relative_url }}"></script>
36+
<script src="{{ 'static/js/bootstrap.min.js?' | append: site.data['hash'] | relative_url }}"></script>
37+
<script src="{{ 'static/js/bootstrap-select.min.js?' | append: site.data['hash'] | relative_url }}"></script>
3838
{% unless page.legacy %}
39-
<script src="/static/js/vue.min.js?{{ site.data['hash'] }}"></script>
40-
<script src="/static/js/timeago.min.js?{{ site.data['hash'] }}"></script>
39+
<script src="{{ 'static/js/vue.min.js?' | append: site.data['hash'] | relative_url }}"></script>
40+
<script src="{{ 'static/js/timeago.min.js?' | append: site.data['hash'] | relative_url }}"></script>
4141
{% endunless %}
42-
<script src="/static/js/markup.min.js?{{ site.data['hash'] }}"></script>
43-
<script src="/static/js/webfont.js?{{ site.data['hash'] }}"></script>
44-
<script src="/static/js/thuhidden.js?{{ site.data['hash'] }}"></script>
42+
<script src="{{ 'static/js/markup.min.js?' | append: site.data['hash'] | relative_url }}"></script>
43+
<script src="{{ 'static/js/webfont.js?' | append: site.data['hash'] | relative_url }}"></script>
44+
<script src="{{ 'static/js/thuhidden.js?' | append: site.data['hash'] | relative_url }}"></script>
4545
{% if page.legacy %}
4646
<style>
4747
.container {

_includes/legacy_notes.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111
<p>Bonjour! </p>
1212
<p>宜しくお願い致します。</p>
1313
<p>&nbsp;</p>
14-
<p>我们检测到您当前的浏览器不能正常显示我们的主页,请更新您的浏览器,并启用 Javascript,或者访问我们的<a href="/legacy_index">代用页面</a></p>
15-
<p>Your browser is not compatible with our website. Please upgrade and enable Javascript, or visit our <a href="/legacy_index">alternative page</a>.</p>
16-
<p>Votre navigateur n'est pas compatible avec notre site web. Mettez à niveau et activez Javascript, ou visitez notre <a href="/legacy_index">page alternative</a>.</p>
17-
<p>お使いのブラウザは当サイトとの互換性はありません。ブラウザを更新しJavaScriptを有効にするか、或いはこちらの<a href="/legacy_index">代用ページ</a>をご利用ください。</p>
14+
<p>我们检测到您当前的浏览器不能正常显示我们的主页,请更新您的浏览器,并启用 Javascript,或者访问我们的<a href="{{ '/legacy_index' | relative_url}}">代用页面</a></p>
15+
<p>Your browser is not compatible with our website. Please upgrade and enable Javascript, or visit our <a href="{{ '/legacy_index' | relative_url}}">alternative page</a>.</p>
16+
<p>Votre navigateur n'est pas compatible avec notre site web. Mettez à niveau et activez Javascript, ou visitez notre <a href="{{ '/legacy_index' | relative_url}}">page alternative</a>.</p>
17+
<p>お使いのブラウザは当サイトとの互換性はありません。ブラウザを更新しJavaScriptを有効にするか、或いはこちらの<a href="{{ '/legacy_index' | relative_url}}">代用ページ</a>をご利用ください。</p>
1818
</div>
1919
</div>
2020
{% endraw %}

_includes/nav.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<span class="icon-bar"></span>
1010
</button>
1111
{% endunless %}
12-
<a class="navbar-brand" href="/">
12+
<a class="navbar-brand" href="{{ '/' | relative_url}}">
1313
<span class="thuhidden">
1414
{% if site.logo %}
1515
<picture>
@@ -18,21 +18,21 @@
1818
{% else %}
1919
<source
2020
{% endif %}
21-
srcset="/static/img/logo-small-dark.png 1x,
22-
/static/img/[email protected] 2x,
23-
/static/img/[email protected] 3x,
24-
/static/img/[email protected] 4x"
21+
srcset="{{ '/static/img/logo-small-dark.png'}} 1x,
22+
{{ '/static/img/[email protected]' | relative_url}} 2x,
23+
{{ '/static/img/[email protected]' | relative_url}} 3x,
24+
{{ '/static/img/[email protected]' | relative_url}} 4x"
2525
{% if site.issue %}
2626
alt=""/>
2727
{% else %}
2828
media="(prefers-color-scheme: dark)"/>
2929
{% endif %}
3030
{% unless site.issue %}
31-
<img src="/static/img/logo-small.png"
32-
srcset="/static/img/logo-small.png 1x,
33-
/static/img/[email protected] 2x,
34-
/static/img/[email protected] 3x,
35-
/static/img/[email protected] 4x"
31+
<img src="{{ '/static/img/logo-small.png' | relative_url}}"
32+
srcset="{{ '/static/img/logo-small.png' | relative_url}} 1x,
33+
{{ '/static/img/[email protected]' | relative_url}} 2x,
34+
{{ '/static/img/[email protected]' | relative_url}} 3x,
35+
{{ '/static/img/[email protected]' | relative_url}}4x"
3636
alt=""/>
3737
{% endunless %}
3838
</picture>

_includes/status-pic.html

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
<div class="col-md-6 col-xs-12">
22
<picture class="thumbnail">
3+
34
<source
4-
srcset="/static/status/{{include.name}}-day-dark.png 1x,
5-
/static/status/{{include.name}}[email protected] 2x,
6-
/static/status/{{include.name}}[email protected] 3x,
7-
/static/status/{{include.name}}[email protected] 4x"
5+
srcset="{{ '/static/status/' | append: include.name | append: '-day-dark.png' | relative_url }} 1x,
6+
{{ '/static/status/' | append: include.name | append: '[email protected]' | relative_url }} 2x,
7+
{{ '/static/status/' | append: include.name | append: '[email protected]' | relative_url }} 3x,
8+
{{ '/static/status/' | append: include.name | append: '[email protected]' | relative_url }} 4x"
89
media="(prefers-color-scheme: dark)" />
9-
<img class="img-responsive" src="/static/status/{{include.name}}-day.png"
10-
srcset="/static/status/{{include.name}}-day.png 1x,
11-
/static/status/{{include.name}}[email protected] 2x,
12-
/static/status/{{include.name}}[email protected] 3x,
13-
/static/status/{{include.name}}[email protected] 4x"
10+
<img class="img-responsive" src="{{ '/static/status/' | append: include.name | append: '-day.png' | relative_url }}"
11+
srcset="{{ '/static/status/' | append: include.name | append: '-day.png' | relative_url }} 1x,
12+
{{ '/static/status/' | append: include.name | append: '[email protected]' | relative_url }} 2x,
13+
{{ '/static/status/' | append: include.name | append: '[email protected]' | relative_url }} 3x,
14+
{{ '/static/status/' | append: include.name | append: '[email protected]' | relative_url }} 4x"
1415
/>
1516
</picture>
1617
</div>

_layouts/help.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<div class="col-sm-2 hidden-xs">
2525
<ul class="nav nav-pills nav-stacked" id="help-nav">
2626
{% for h in help_pages %}
27-
<li{% if h.mirrorid == page.mirrorid or h.redirect_help_id == page.mirrorid %} class="active"{%endif%} id="toc-{{h.mirrorid}}"><a href="{{h.url}}">{{h.mirrorid}}</a></li>
27+
<li{% if h.mirrorid == page.mirrorid or h.redirect_help_id == page.mirrorid %} class="active"{%endif%} id="toc-{{h.mirrorid}}"><a href="{{h.url | relative_url}}">{{h.mirrorid}}</a></li>
2828
{% endfor %}
2929
</ul>
3030
</div><!-- sidenave -->
@@ -52,8 +52,8 @@
5252
{% include footer.html %}
5353
</body>
5454

55-
<script src="/static/js/highlight.min.js?{{ site.data['hash'] }}"></script>
56-
<script src="/static/js/help.js?{{ site.data['hash'] }}"></script>
55+
<script src="{{ 'static/js/highlight.min.js?' | append: site.data['hash'] | relative_url }}"></script>
56+
<script src="{{ 'static/js/help.js?' | append: site.data['hash'] | relative_url }}"></script>
5757

5858
</html>
5959
<!--

_layouts/index.html

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
<h1>{{ site.school }}开源软件镜像站</h1>
1717
<h3>暂时无法提供服务</h3>
1818
<div class="pull-right">
19-
<img src="/static/img/candle.jpg"
20-
srcset="/static/img/candle.jpg 1x,
21-
/static/img/[email protected] 2x"
19+
<img src="{{ '/static/img/candle.jpg' | relative_url }}"
20+
srcset="{{ '/static/img/candle.jpg' | relative_url }} 1x,
21+
{{ '/static/img/[email protected]' | relative_url }} 2x"
2222
/>
2323
</div>
2424
<div class="clearfix"></div>
@@ -51,14 +51,14 @@ <h3 id="mirror-title">{% fa_svg fas.fa-cube %} 镜像列表 </h3>
5151
{{mirs}}
5252
<tr class="row status-{{status}}">
5353
<td>
54-
<a class="mirror-item-label" href="{{url}}" title="{{description}}">
54+
<a class="mirror-item-label" href="{{ url | relative_url }}" title="{{description}}">
5555
{{name}}
5656
</a>
5757
{{if is_new}}
5858
<span class="label label-new">new</span>
5959
{{/if}}
6060
{{if help_url}}
61-
<a href="{{help_url}}"><i aria-hidden="true" class="question-circle" title="Help">{% endraw %}{% fa_svg fas.fa-circle-question %}{% raw %}</i><span class="sr-only">[Help]</span></a>
61+
<a href="{{ help_url | relative_url }}"><i aria-hidden="true" class="question-circle" title="Help">{% endraw %}{% fa_svg fas.fa-circle-question %}{% raw %}</i><span class="sr-only">[Help]</span></a>
6262
{{/if}}
6363
</td>
6464
<td>
@@ -68,16 +68,18 @@ <h3 id="mirror-title">{% fa_svg fas.fa-cube %} 镜像列表 </h3>
6868
{{/mirs}}
6969
{% endraw %}
7070
{% else %}
71-
{% raw %}
7271
<tr v-for="mir in filteredMirrorList" :class="['row', 'status-'+mir.status]" :key="mir.name">
7372
<td class="col-md-8">
7473
<a class="mirror-item-label" data-toggle="popover" data-trigger="hover" data-placement="right"
75-
:data-content="mir.description" :href="getURL(mir)" :aria-label="mir.name + ', ' + mir.description">
76-
{{mir.name}}
74+
:data-content="mir.description" :href="'{{ site.baseurl }}' + getURL(mir)" :aria-label="mir.name + ', ' + mir.description">
75+
{% raw %}
76+
{{mir.name}}
77+
{% endraw %}
7778
<span class="label label-new" v-if='mir.is_new'>new</span>
78-
<a v-if='mir.help_url' :href="mir.help_url"><i aria-hidden="true" class="question-circle" title="Help">{% endraw %}{% fa_svg fas.fa-circle-question %}{% raw %}</i><span class="sr-only">[Help]</span></a>
79-
<a v-if='mir.github_release' href="javascript:void(0)"><i aria-hidden="true" title="GitHub Release">{% endraw %}{% fa_svg fab.fa-github %}{% raw %}</i><span class="sr-only">[GitHub Release]</span></a>
80-
</td>
79+
<a v-if='mir.help_url' :href="'{{ site.baseurl }}' + mir.help_url"><i aria-hidden="true" class="question-circle" title="Help">{% fa_svg fas.fa-circle-question %}</i><span class="sr-only">[Help]</span></a>
80+
<a v-if='mir.github_release' href="javascript:void(0)"><i aria-hidden="true" title="GitHub Release">{% fa_svg fab.fa-github %}</i><span class="sr-only">[GitHub Release]</span></a>
81+
</td>
82+
{% raw %}
8183
<td class="col-md-4">
8284
{{mir.last_update}}<span v-if="mir.show_status" :class="['label', 'label-status', mir.label, 'hidden-xs']">{{mir.status}}</span>
8385
</td>
@@ -107,10 +109,10 @@ <h3 id="mirror-title">{% fa_svg fas.fa-cube %} 镜像列表 </h3>
107109
<h4>{% fa_svg fas.fa-bullhorn %} 新闻公告 </h4>
108110
<ul>
109111
{% for news in site.categories.news limit: 3%}
110-
<li><a href="/news/#{{news.slug}}"><strong>{{news.date | date: "%Y-%m-%d"}}</strong> {{news.title}}</a></li>
112+
<li><a href="{{ '/news/#' | append: news.slug | relative_url }}"><strong>{{news.date | date: "%Y-%m-%d"}}</strong> {{news.title}}</a></li>
111113
{% endfor %}
112114
</ul>
113-
<div class="text-right"><a href="/news/"> more {% fa_svg fas.fa-angles-right %} </a></div>
115+
<div class="text-right"><a href="{{ '/news/' | relative_url }}"> more {% fa_svg fas.fa-angles-right %} </a></div>
114116
</div>
115117
<div class="thuhidden {%if site.issue%}col-md-4{%endif%}">
116118
<h4> {% fa_svg fas.fa-link %} 域名选择 </h4>
@@ -144,10 +146,10 @@ <h4> {% fa_svg far.fa-envelope %} 联系我们 </h4>
144146
<div {%if site.issue%}class="col-md-2"{%endif%}>
145147
<h4> {% fa_svg fas.fa-arrow-up-right-from-square %} 相关链接 </h4>
146148
<ul>
147-
<li><a href="/help/">使用帮助</a></li>
149+
<li><a href="{{ '/help/' | relative_url }}">使用帮助</a></li>
148150
{% unless site.issue %}
149-
<li><a href="/status/#server-status">服务器状态</a></li>
150-
<li><a href="/status/#syncing-status">同步状态</a></li>
151+
<li><a href="{{ '/status/#server-status' | relative_url }}">服务器状态</a></li>
152+
<li><a href="{{ '/status/#syncing-status' | relative_url }}">同步状态</a></li>
151153
{% endunless %}
152154
<li class="thuhidden"><a href="https://tuna.moe/">清华大学 TUNA 协会</a></li>
153155
<li><a href="https://github.com/tuna/tunasync">镜像管理器源码</a></li>
@@ -215,7 +217,7 @@ <h3>{{selected.distro}}</h3>
215217
{% raw %}
216218
{% endraw %}
217219
{% unless page.legacy or site.issue %}
218-
<script src="/static/js/index.js?{{ site.data['hash'] }}"></script>
220+
<script src="{{ 'static/js/index.js?' | append: site.data['hash'] | relative_url }}"></script>
219221
{% endunless %}
220222
</html>
221223
<!--

fancy-index/after.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</body>
1818
{% raw %}
1919
{% endraw %}
20-
<script src="/static/js/index.js?{{ site.data['hash'] }}"></script>
20+
<script src="{{ 'static/js/index.js?' | append: site.data['hash'] | relative_url }}"></script>
2121
{% raw %}
2222
<script>
2323
document.getElementById("list").setAttribute("class", "table");

static/js/help.es6

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ $(document).ready(() => {
1414
for (const target_selector of target_selectors) {
1515
const template_selector = $(target_selector).data("template");
1616
const select_selectors = $(target_selector).data("select").split(",");
17-
let url = "/" + window.mirrorId
17+
let url = "{{ '/' | relative_url }}" + window.mirrorId
1818
if (window.mirrorId.endsWith(".git")) {
19-
url = "/git/" + window.mirrorId
19+
url = "{{ '/git/' | relative_url }}" + window.mirrorId
2020
}
2121
const template_data = {
2222
"mirror": "{{ site.hostname }}" + url,
@@ -49,7 +49,7 @@ $(document).ready(() => {
4949
window.location = `${window.location.protocol}//${window.location.host}${help_url}`;
5050
});
5151

52-
$.getJSON("/static/tunasync.json", (statusData) => {
52+
$.getJSON("{{ '/static/tunasync.json' | relative_url }}", (statusData) => {
5353
// remove help items for disabled/removed mirrors
5454
let availableMirrorIds = new Set(statusData.map(x => x.name));
5555
globalOptions.unlisted_mirrors.forEach(elem => {
@@ -58,7 +58,7 @@ $(document).ready(() => {
5858
console.log(window.mirrorId);
5959
if (!availableMirrorIds.has(window.mirrorId)) {
6060
if ({{ site.hide_mirrorz }}) {
61-
location.href = "/404-help-hidden.html"; // this will break 404 issue submission
61+
location.href = "{{ '/404-help-hidden.html' | relative_url }}"; // this will break 404 issue submission
6262
} else {
6363
location.href = "{{ site.mirrorz_help_link }}" + window.mirrorId; // TODO: convert this to mirrorz cname
6464
}

0 commit comments

Comments
 (0)