Browse Source

Use relative url

Track3 2 years ago
parent
commit
9c76ec252f

+ 4 - 4
layouts/404.html

@@ -1,20 +1,20 @@
 {{ define "head" }}
 	{{ if .Site.Params.bgImg -}}
-	<style>:root{ --bg-img: url({{.Site.Params.bgImg | absURL}});}</style>
+	<style>:root{ --bg-img: url({{.Site.Params.bgImg | relURL}});}</style>
 	{{- end -}}
 	{{.Scratch.Set "pageClass" "error-404"}}
 {{ end }}
 
 {{ define "main" }}
 	<p class="img-404">
-		<img src="{{ "img/404.png" | absURL }}" alt="Nothing Found">
+		<img src="{{ "img/404.png" | relURL }}" alt="Nothing Found">
 	</p>
 	<div class="banner-404">
 		<h1>404</h1>
 		<p>Oops, page not found…</p>
 		<p class="btn-404">
-			<a href="{{.Site.BaseURL}}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>&nbsp;Home</a>
-			<a href="{{ "writing" | absURL }}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-archive"><polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line></svg>&nbsp;Archives</a>
+			<a href="{{"" | relURL}}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home"><path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path><polyline points="9 22 9 12 15 12 15 22"></polyline></svg>&nbsp;Home</a>
+			<a href="{{ "writing" | relURL }}"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-archive"><polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line></svg>&nbsp;Archives</a>
 		</p>
 	</div>
 {{ end }}

+ 3 - 3
layouts/_default/baseof.html

@@ -24,10 +24,10 @@
 	<link rel="dns-prefetch" href="//pb.zak.ee">
 	<link rel="dns-prefetch" href="//gravatar.loli.net">
 	{{ range .AlternativeOutputFormats -}}
-	{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .Permalink $.Site.Title | safeHTML }}
+	{{ printf `<link rel="%s" type="%s" href="%s" title="%s" />` .Rel .MediaType.Type .RelPermalink $.Site.Title | safeHTML }}
 	{{ end -}}
 	{{ $style := resources.Get "scss/style.scss" | resources.ExecuteAsTemplate "css/style.css" . | toCSS | minify | fingerprint -}}
-	<link rel="stylesheet" href="{{ $style.Permalink }}" {{ printf "integrity=%q" $style.Data.Integrity | safeHTMLAttr }}>
+	<link rel="stylesheet" href="{{ $style.RelPermalink }}" {{ printf "integrity=%q" $style.Data.Integrity | safeHTMLAttr }}>
 	{{- .Scratch.Set "pageClass" ""}}
 	{{ block "head" . -}}{{- end }}
 	<script async defer data-website-id="7330213f-48d1-46e2-b669-758ccca4ba47" src="https://analytics.zak.ee/umami.js" data-domains="zak.ee"></script>
@@ -41,7 +41,7 @@
 	</div>
 	<div id="bg-img"></div>
 	{{ $script := resources.Get "js/main.js" | minify | fingerprint -}}
-	<script src="{{ $script.Permalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }}></script>
+	<script src="{{ $script.RelPermalink }}" {{ printf "integrity=%q" $script.Data.Integrity | safeHTMLAttr }}></script>
 	<script src="/js/instant.page-5.1.1.js" type="module" integrity="sha384-MWfCL6g1OTGsbSwfuMHc8+8J2u71/LA8dzlIN3ycajckxuZZmF+DNjdm7O6H3PSq"></script>
 </body>
 

+ 2 - 2
layouts/_default/list.html

@@ -5,7 +5,7 @@
 {{ define "main" }}
 	<main id="site-main" class="wrapper">
 		<div class="title-area">
-			<a id="home-btn" title="{{.Site.Title}}" href="{{.Site.BaseURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
+			<a id="home-btn" title="{{.Site.Title}}" href="{{"" | relURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
 			<h1 id="page-title" class="title-area-l">{{ .Title }}</h1>
 		</div>
 		{{- if .Content }}
@@ -19,7 +19,7 @@
 			<ul class="posts-list">
 				{{- range .Pages }}
 				<li class="post-item">
-					<a href="{{.Permalink}}">
+					<a href="{{.RelPermalink}}">
 						<span class="post-title">{{.Title}}</span>
 						<span class="post-day">{{ .Date.Format .Site.Params.dateformShort }}</span>
 					</a>

+ 2 - 2
layouts/_default/single.html

@@ -1,7 +1,7 @@
 {{ define "head" }}
 	{{ if .Params.images -}}
 		{{- range first 1 .Params.images -}}
-		<style>:root{ --bg-img: url({{. | absURL}});}</style>
+		<style>:root{ --bg-img: url({{. | relURL}});}</style>
 		{{- end -}}
 	{{- end -}}
 {{ end }}
@@ -13,7 +13,7 @@
 {{ define "main" }}
 	<main id="site-main" class="wrapper">
 		<div class="title-area">
-			<a id="home-btn" title="{{.Site.Title}}" href="{{.Site.BaseURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
+			<a id="home-btn" title="{{.Site.Title}}" href="{{"" | relURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
 			<h1 id="page-title" class="title-area-l">{{ .Title }}</h1>
 		</div>
 		<div class="content">

+ 3 - 3
layouts/gallery/list.html

@@ -5,7 +5,7 @@
 {{ define "main" }}
 	<main id="site-main" class="wrapper">
 		<div class="title-area">
-			<a id="home-btn" title="{{.Site.Title}}" href="{{.Site.BaseURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
+			<a id="home-btn" title="{{.Site.Title}}" href="{{"" | relURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
 			<h1 id="page-title" class="title-area-l">{{ .Title }}</h1>
 		</div>
 		{{- if .Content }}
@@ -17,7 +17,7 @@
 		<div class="album">
 			<div class="sidebar">
 				<h2 class="album-title">
-					{{ $abulmLink := .Permalink -}}
+					{{ $abulmLink := .RelPermalink -}}
 					<a href="{{ $abulmLink }}">{{.Title}}</a>
 				</h2>
 				<p class="album-info">{{ time.Format .Site.Params.dateform .Params.shot_date }}</p>
@@ -25,7 +25,7 @@
 			</div>
 			<a href="{{ $abulmLink }}" class="album-row">
 				{{- range .Params.images -}}
-				<div class="img-tile"><img src="{{. | absURL}}" loading="lazy"></div>
+				<div class="img-tile"><img src="{{. | relURL}}" loading="lazy"></div>
 				{{- end -}}
 			</a>
 		</div>

+ 3 - 3
layouts/gallery/single.html

@@ -7,7 +7,7 @@
 		<article>
 			<header class="post-header">
 				<div class="title-area">
-					<a id="home-btn" title="{{.Site.Title}}" href="{{.Site.BaseURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
+					<a id="home-btn" title="{{.Site.Title}}" href="{{"" | relURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
 					<div class="title-area-l">
 						<h1 id="page-title">{{ .Title }}</h1>
 					</div>
@@ -32,12 +32,12 @@
 		<div class="post-nav">
 			{{ $list := (where site.RegularPages "Type" "in" "gallery") }}
 			{{- with ($list.ByParam "shot_date").Reverse.Next . }}
-			<a class="next-post" href="{{ .Permalink }}">
+			<a class="next-post" href="{{ .RelPermalink }}">
 				<span class="post-nav-label"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>&nbsp;Newer</span><br><span>{{ .Title }}</span>
 			</a>
 			{{- end }}
 			{{- with ($list.ByParam "shot_date").Reverse.Prev . }}
-			<a class="prev-post" href="{{ .Permalink }}">
+			<a class="prev-post" href="{{ .RelPermalink }}">
 				<span class="post-nav-label">Older&nbsp;<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg></span><br><span>{{ .Title }}</span>
 			</a>
 			{{- end }}

+ 2 - 2
layouts/index.html

@@ -1,6 +1,6 @@
 {{ define "head" }}
 	{{ if .Site.Params.bgImg -}}
-	<style>:root{ --bg-img: url({{.Site.Params.bgImg | absURL}});}</style>
+	<style>:root{ --bg-img: url({{.Site.Params.bgImg | relURL}});}</style>
 	{{- end -}}
 	{{.Scratch.Set "pageClass" "home"}}
 {{ end }}
@@ -24,7 +24,7 @@
 				{{ range first 3 (where site.RegularPages "Type" "in" "writing") -}}
 				<li>
 					<span>{{ .Date.Format .Site.Params.dateformNum }} </span>
-					<a href="{{.Permalink}}">{{.Title}}</a>
+					<a href="{{.RelPermalink}}">{{.Title}}</a>
 				</li>
 				{{ end }}
 			</ul>

+ 1 - 1
layouts/partials/footer.html

@@ -2,7 +2,7 @@
 		<div class="footer-inner">
 			<div class="footer-l">
 				<nav class="site-nav">
-					<a href="{{.Site.BaseURL}}">Home</a><span>&#47;</span>
+					<a href="{{"" | relURL}}">Home</a><span>&#47;</span>
 					{{- range .Site.Menus.main -}}
 					<a href="{{ .URL }}">{{ .Name }}</a><span>&#47;</span>
 					{{- end }}

+ 1 - 1
layouts/partials/header.html

@@ -1,6 +1,6 @@
 	<header id="site-header">
 		<div id="site-branding">
-			<a href="{{.Site.BaseURL}}">{{ .Site.Title }}</a>
+			<a href="{{"" | relURL}}">{{ .Site.Title }}</a>
 		</div>
 		<nav id="site-nav">
 			{{- $currentPage := . }}

+ 5 - 5
layouts/writing/single.html

@@ -1,7 +1,7 @@
 {{ define "head" }}
 	{{ if .Params.images -}}
 		{{- range first 1 .Params.images -}}
-		<style>:root{ --bg-img: url({{. | absURL}});}</style>
+		<style>:root{ --bg-img: url({{. | relURL}});}</style>
 		{{- end -}}
 	{{- end -}}
 {{ end }}
@@ -15,7 +15,7 @@
 		<article>
 			<header class="post-header">
 				<div class="title-area">
-					<a id="home-btn" title="{{.Site.Title}}" href="{{.Site.BaseURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
+					<a id="home-btn" title="{{.Site.Title}}" href="{{"" | relURL}}"><img src="/apple-touch-icon.png" width="180" height="180" alt="Logo"></a>
 					<div class="title-area-l">
 						<div id="post-header-date">{{ .Date.Format .Site.Params.dateform }}</div>
 						<h1 id="page-title">{{ .Title }}</h1>
@@ -40,7 +40,7 @@
 				<p>
 					<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-tag meta-icon"><path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path><line x1="7" y1="7" x2="7" y2="7"></line></svg>
 					{{- range . -}}
-					<span class="tag"><a href="{{ "tags/" | absURL }}{{ . | urlize }}">{{.}}</a></span>
+					<span class="tag"><a href="{{ "tags/" | relURL }}{{ . | urlize }}">{{.}}</a></span>
 					{{- end }}
 				</p>
 				{{- end }}
@@ -53,12 +53,12 @@
 		</article>
 		<div class="post-nav">
 			{{- with .NextInSection }}
-			<a class="next-post" href="{{ .Permalink }}">
+			<a class="next-post" href="{{ .RelPermalink }}">
 				<span class="post-nav-label"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-left"><line x1="19" y1="12" x2="5" y2="12"></line><polyline points="12 19 5 12 12 5"></polyline></svg>&nbsp;Newer</span><br><span>{{ .Title }}</span>
 			</a>
 			{{- end }}
 			{{- with .PrevInSection }}
-			<a class="prev-post" href="{{ .Permalink }}">
+			<a class="prev-post" href="{{ .RelPermalink }}">
 				<span class="post-nav-label">Older&nbsp;<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right"><line x1="5" y1="12" x2="19" y2="12"></line><polyline points="12 5 19 12 12 19"></polyline></svg></span><br><span>{{ .Title }}</span>
 			</a>
 			{{- end }}