diff options
author | olOwOlo <26087907+olOwOlo@users.noreply.github.com> | 2017-08-31 00:18:22 +0800 |
---|---|---|
committer | olOwOlo <26087907+olOwOlo@users.noreply.github.com> | 2017-08-31 00:18:22 +0800 |
commit | 4a2676396cb0a991dae12018be96462b3eec27f5 (patch) | |
tree | 7cdf0c3d2b254bf84a9a46d2068c3d1fc5c2c602 | |
parent | 553d15e15f3affdfda48686469309e01f2b994f7 (diff) |
fix: always use relURL
-rw-r--r-- | layouts/404.html | 2 | ||||
-rw-r--r-- | layouts/_default/terms.html | 4 | ||||
-rw-r--r-- | layouts/partials/head.html | 23 | ||||
-rw-r--r-- | layouts/partials/header.html | 2 | ||||
-rw-r--r-- | layouts/partials/scripts.html | 13 | ||||
-rw-r--r-- | layouts/partials/slideout.html | 2 | ||||
-rw-r--r-- | layouts/post/single.html | 4 | ||||
-rw-r--r-- | layouts/post/summary.html | 2 |
8 files changed, 27 insertions, 25 deletions
diff --git a/layouts/404.html b/layouts/404.html index 81a37e9..50e1860 100644 --- a/layouts/404.html +++ b/layouts/404.html @@ -4,7 +4,7 @@ <div class="not-found"> <h1 class="error-emoji"></h1> <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> <script> var errorEmojiContainer = document.getElementsByClassName('error-emoji')[0]; diff --git a/layouts/_default/terms.html b/layouts/_default/terms.html index e48d39b..fbf0045 100644 --- a/layouts/_default/terms.html +++ b/layouts/_default/terms.html @@ -16,7 +16,7 @@ </div> <div class="categories-tags"> {{ 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 }} <span class="category-count">{{ len $value.Pages }}</span> </a> @@ -34,7 +34,7 @@ </div> <div class="tag-cloud-tags"> {{ range $key, $value := $terms }} - <a href="/{{ $name | urlize }}/{{ $value.Term | urlize }}/"> + <a href="{{ $name | urlize | relURL }}/{{ $value.Term | urlize }}/"> {{ $value.Term }} <span class="tag-count">{{ len $value.Pages }}</span> </a> diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 0310b16..0a93efb 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -43,19 +43,20 @@ {{ end -}} <!-- Favicon and Touch icons --> -<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> -<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> -<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> -<link rel="icon" href="/favicon.ico" /> -<link rel="manifest" href="/manifest.json"> -<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> +<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" | relURL }}"> +<link rel="icon" type="image/png" sizes="16x16" href="{{ "favicon-16x16.png" | relURL }}"> +<link rel="icon" href="{{ "favicon.ico" | relURL }}" /> +<link rel="manifest" href="{{ "manifest.json" | relURL }}"> +<link rel="mask-icon" href="{{ "safari-pinned-tab.svg" | relURL }}" color="#5bbad5"> -<!-- Styles --> -<link href="/dist/even.v{{ .Site.Params.version }}.css" rel="stylesheet"> +<!-- Styles --> +{{ $themeVersion := .Site.Params.version }} +<link href="{{ relURL (printf "dist/even.v%s.css" $themeVersion) }}" rel="stylesheet"> {{ 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 }} {{ 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 }} {{/* 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 --> {{ `<!--[if lt IE 9]> - <script src="//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/html5shiv/3.7.3/html5shiv.min.js"></script> + <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> <![endif]-->` | safeHTML }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index a8a555a..f41fdac 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,5 +1,5 @@ <div class="logo-wrapper"> - <a href="/" class="logo">{{ .Site.Title }}</a> + <a href="{{ "/" | relURL }}" class="logo">{{ .Site.Title }}</a> </div> <nav class="site-navbar"> diff --git a/layouts/partials/scripts.html b/layouts/partials/scripts.html index d1eefa8..b206dc8 100644 --- a/layouts/partials/scripts.html +++ b/layouts/partials/scripts.html @@ -1,16 +1,17 @@ <!-- 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 -}} <!-- 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/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 }} - <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 -}} - <script type="text/javascript" src="/lib/jquery/jquery-3.2.1.min.js"></script> - <script type="text/javascript" src="/lib/slideout/slideout-1.0.1.min.js"></script> - {{ if .Site.Params.fancybox }}<script type="text/javascript" src="/lib/fancybox/jquery.fancybox-3.1.20.min.js"></script>{{ end }} - <script type="text/javascript" src="/dist/even.v{{ .Site.Params.version }}.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" | relURL }}"></script> + {{ 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="{{ relURL (printf "dist/even.v%s.js" $themeVersion) }}"></script> {{- end }} {{ if and (and .Site.Params.mathjax (ne .Params.mathjax false)) (or .IsPage .IsHome) -}} diff --git a/layouts/partials/slideout.html b/layouts/partials/slideout.html index 4ec6344..0ebf0c2 100644 --- a/layouts/partials/slideout.html +++ b/layouts/partials/slideout.html @@ -1,6 +1,6 @@ <div id="mobile-navbar" class="mobile-navbar"> <div class="mobile-header-logo"> - <a href="/" class="logo">{{ .Site.Title }}</a> + <a href="{{ "/" | relURL }}" class="logo">{{ .Site.Title }}</a> </div> <div class="mobile-navbar-icon"> <span></span> diff --git a/layouts/post/single.html b/layouts/post/single.html index 81c0939..62c317c 100644 --- a/layouts/post/single.html +++ b/layouts/post/single.html @@ -12,7 +12,7 @@ {{ with .Params.categories -}} <div class="post-category"> {{ range . -}} - <a href="/categories/{{ . | urlize }}">{{ . }}</a> + <a href="{{ "categories" | relURL }}/{{ . | urlize }}/">{{ . }}</a> {{- end }} </div> {{- end }} @@ -37,7 +37,7 @@ {{ with .Params.tags -}} <div class="post-tags"> {{ range . }} - <a href="/tags/{{ . | urlize }}">{{ . }}</a> + <a href="{{ "tags" | relURL }}/{{ . | urlize }}/">{{ . }}</a> {{ end }} </div> {{- end }} diff --git a/layouts/post/summary.html b/layouts/post/summary.html index 8a4e774..bb55d5f 100644 --- a/layouts/post/summary.html +++ b/layouts/post/summary.html @@ -9,7 +9,7 @@ {{ with .Params.categories -}} <div class="post-category"> {{ range . -}} - <a href="/categories/{{ . | urlize }}">{{ . }}</a> + <a href="{{ "categories" | relURL }}/{{ . | urlize }}/">{{ . }}</a> {{- end }} </div> {{- end }} |