fix: always use relURL

This commit is contained in:
olOwOlo 2017-08-31 00:18:22 +08:00
parent 553d15e15f
commit 4a2676396c
8 changed files with 27 additions and 25 deletions

View file

@ -4,7 +4,7 @@
<div class="not-found"> <div class="not-found">
<h1 class="error-emoji"></h1> <h1 class="error-emoji"></h1>
<p class="error-text">/* 404 page not found. */</p> <p class="error-text">/* 404 page not found. */</p>
<p class="error-link"><a href="/">↑ Back Home ↑</a></p> <p class="error-link"><a href="{{ "/" | relURL }}">↑ Back Home ↑</a></p>
</div> </div>
<script> <script>
var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0]; var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0];

View file

@ -16,7 +16,7 @@
</div> </div>
<div class="categories-tags"> <div class="categories-tags">
{{ range $key, $value := $terms }} {{ range $key, $value := $terms }}
<a class="category-link" href="/{{ $name | urlize }}/{{ $value.Term | urlize }}/"> <a class="category-link" href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/">
{{ $value.Term }} {{ $value.Term }}
<span class="category-count">{{ len $value.Pages }}</span> <span class="category-count">{{ len $value.Pages }}</span>
</a> </a>
@ -34,7 +34,7 @@
</div> </div>
<div class="tag-cloud-tags"> <div class="tag-cloud-tags">
{{ range $key, $value := $terms }} {{ range $key, $value := $terms }}
<a href="/{{ $name | urlize }}/{{ $value.Term | urlize }}/"> <a href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/">
{{ $value.Term }} {{ $value.Term }}
<span class="tag-count">{{ len $value.Pages }}</span> <span class="tag-count">{{ len $value.Pages }}</span>
</a> </a>

View file

@ -43,19 +43,20 @@
{{ end -}} {{ end -}}
<!-- Favicon and Touch icons --> <!-- Favicon and Touch icons -->
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> <link rel="apple-touch-icon" sizes="180x180" href="{{ "apple-touch-icon.png" | relURL }}">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> <link rel="icon" type="image/png" sizes="32x32" href="{{ "favicon-32x32.png" | relURL }}">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> <link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | relURL }}">
<link rel="icon" href="/favicon.ico" /> <link rel="icon" href="{{ "favicon.ico" | relURL }}" />
<link rel="manifest" href="/manifest.json"> <link rel="manifest" href="{{ "manifest.json" | relURL }}">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> <link rel="mask-icon" href="{{ "safari-pinned-tab.svg" | relURL }}" color="#5bbad5">
<!-- Styles --> <!-- Styles -->
<link href="/dist/even.v{{ .Site.Params.version }}.css" rel="stylesheet"> {{ $themeVersion := .Site.Params.version }}
<link href="{{ relURL (printf "dist/even.v%s.css" $themeVersion) }}" rel="stylesheet">
{{ if .Site.Params.bootcdn -}} {{ if .Site.Params.bootcdn -}}
{{ if .Site.Params.fancybox }}<link href="https://cdn.bootcss.com/fancybox/3.1.20/jquery.fancybox.min.css" rel="stylesheet">{{ end }} {{ if .Site.Params.fancybox }}<link href="https://cdn.bootcss.com/fancybox/3.1.20/jquery.fancybox.min.css" rel="stylesheet">{{ end }}
{{ else -}} {{ else -}}
{{ if .Site.Params.fancybox }}<link href="/lib/fancybox/jquery.fancybox-3.1.20.min.css" rel="stylesheet">{{ end }} {{ if .Site.Params.fancybox }}<link href="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.css" | relURL }}" rel="stylesheet">{{ end }}
{{- end }} {{- end }}
{{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/spf13/hugo/blob/master/tpl/tplimpl/template_embedded.go#L158 */}} {{/* NOTE: These Hugo Internal Templates can be found starting at https://github.com/spf13/hugo/blob/master/tpl/tplimpl/template_embedded.go#L158 */}}
@ -66,6 +67,6 @@
<!-- Polyfill for old browsers --> <!-- Polyfill for old browsers -->
{{ `<!--[if lt IE 9]> {{ `<!--[if lt IE 9]>
<script src="//cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script> <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->` | safeHTML }} <![endif]-->` | safeHTML }}

View file

@ -1,5 +1,5 @@
<div class="logo-wrapper"> <div class="logo-wrapper">
<a href="/" class="logo">{{ .Site.Title }}</a> <a href="{{ "/" | relURL }}" class="logo">{{ .Site.Title }}</a>
</div> </div>
<nav class="site-navbar"> <nav class="site-navbar">

View file

@ -1,16 +1,17 @@
<!-- js --> <!-- js -->
<script src="/lib/highlight/highlight.pack.js"></script> {{ $themeVersion := .Site.Params.version }}
<script src="{{ "lib/highlight/highlight.pack.js" | relURL }}"></script>
{{ if .Site.Params.bootcdn -}} {{ if .Site.Params.bootcdn -}}
<!-- script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script --> <!-- script src="https://cdn.bootcss.com/highlight.js/9.12.0/highlight.min.js"></script -->
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script> <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.bootcss.com/slideout/1.0.1/slideout.min.js"></script> <script type="text/javascript" src="https://cdn.bootcss.com/slideout/1.0.1/slideout.min.js"></script>
{{ if .Site.Params.fancybox }}<script type="text/javascript" src="https://cdn.bootcss.com/fancybox/3.1.20/jquery.fancybox.min.js"></script>{{ end }} {{ if .Site.Params.fancybox }}<script type="text/javascript" src="https://cdn.bootcss.com/fancybox/3.1.20/jquery.fancybox.min.js"></script>{{ end }}
<script type="text/javascript" src="/dist/even.v{{ .Site.Params.version }}.js"></script> <script type="text/javascript" src="{{ relURL (printf "dist/even.v%s.js" $themeVersion) }}"></script>
{{ else -}} {{ else -}}
<script type="text/javascript" src="/lib/jquery/jquery-3.2.1.min.js"></script> <script type="text/javascript" src="{{ "lib/jquery/jquery-3.2.1.min.js" | relURL }}"></script>
<script type="text/javascript" src="/lib/slideout/slideout-1.0.1.min.js"></script> <script type="text/javascript" src="{{ "lib/slideout/slideout-1.0.1.min.js" | relURL }}"></script>
{{ if .Site.Params.fancybox }}<script type="text/javascript" src="/lib/fancybox/jquery.fancybox-3.1.20.min.js"></script>{{ end }} {{ if .Site.Params.fancybox }}<script type="text/javascript" src="{{ "lib/fancybox/jquery.fancybox-3.1.20.min.js" | relURL }}"></script>{{ end }}
<script type="text/javascript" src="/dist/even.v{{ .Site.Params.version }}.js"></script> <script type="text/javascript" src="{{ relURL (printf "dist/even.v%s.js" $themeVersion) }}"></script>
{{- end }} {{- end }}
{{ if and (and .Site.Params.mathjax (ne .Params.mathjax false)) (or .IsPage .IsHome) -}} {{ if and (and .Site.Params.mathjax (ne .Params.mathjax false)) (or .IsPage .IsHome) -}}

View file

@ -1,6 +1,6 @@
<div id="mobile-navbar" class="mobile-navbar"> <div id="mobile-navbar" class="mobile-navbar">
<div class="mobile-header-logo"> <div class="mobile-header-logo">
<a href="/" class="logo">{{ .Site.Title }}</a> <a href="{{ "/" | relURL }}" class="logo">{{ .Site.Title }}</a>
</div> </div>
<div class="mobile-navbar-icon"> <div class="mobile-navbar-icon">
<span></span> <span></span>

View file

@ -12,7 +12,7 @@
{{ with .Params.categories -}} {{ with .Params.categories -}}
<div class="post-category"> <div class="post-category">
{{ range . -}} {{ range . -}}
<a href="/categories/{{ . | urlize }}">{{ . }}</a> <a href="{{ "categories" | relURL }}/{{ . | urlize }}/">{{ . }}</a>
{{- end }} {{- end }}
</div> </div>
{{- end }} {{- end }}
@ -37,7 +37,7 @@
{{ with .Params.tags -}} {{ with .Params.tags -}}
<div class="post-tags"> <div class="post-tags">
{{ range . }} {{ range . }}
<a href="/tags/{{ . | urlize }}">{{ . }}</a> <a href="{{ "tags" | relURL }}/{{ . | urlize }}/">{{ . }}</a>
{{ end }} {{ end }}
</div> </div>
{{- end }} {{- end }}

View file

@ -9,7 +9,7 @@
{{ with .Params.categories -}} {{ with .Params.categories -}}
<div class="post-category"> <div class="post-category">
{{ range . -}} {{ range . -}}
<a href="/categories/{{ . | urlize }}">{{ . }}</a> <a href="{{ "categories" | relURL }}/{{ . | urlize }}/">{{ . }}</a>
{{- end }} {{- end }}
</div> </div>
{{- end }} {{- end }}