Skip to content

Commit f7c3271

Browse files
committed
Use relURL for relative links
1 parent c4307de commit f7c3271

File tree

14 files changed

+61
-154
lines changed

14 files changed

+61
-154
lines changed

layouts/commands/list.html

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
{{ define "head" }}
2-
{{ $base := .Site.BaseURL }}
3-
{{ $parsed := urls.Parse $base }}
4-
{{ $path := $parsed.Path }}
5-
{{ if (eq $path "/") }}
6-
{{ .Scratch.Set "path" ""}}
7-
{{ else }}
8-
{{ .Scratch.Set "path" $path}}
9-
{{ end }}
10-
{{ $basePath := .Scratch.Get "path" }}
11-
<script src='{{ $basePath }}/js/commands-filters.js' defer></script>
2+
<script src='{{ relURL "js/commands-filters.js" }}' defer></script>
123
{{ end }}
134

145
{{ define "main" }}
156
{{ partial "path-scratch.html" }}
16-
{{ $basePath := .Scratch.Get "path" }}
177
<main class="docs w-full max-w-[1920px] mx-auto px-5 flex flex-col md:flex-row overflow-hidden">
188
{{ partial "docs-nav-collapsed.html" . }}
199
<div class="w-full py-12 md:px-4 xl:px-16 overflow-hidden">

layouts/commands/single.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{{ define "head" }}
2-
<script src='{{ relURL "" }}/js/cli.js' defer></script>
3-
<script src='{{ relURL "" }}/js/codetabs.js' defer></script>
2+
<script src='{{ relURL "js/cli.js" }}' defer></script>
3+
<script src='{{ relURL "js/codetabs.js" }}' defer></script>
44
{{ end }}
55

66
{{ define "main" }}

layouts/develop/single.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ define "head" }}
2-
<script src='{{ relURL "" }}/js/codetabs.js' defer></script>
2+
<script src='{{ relURL "js/codetabs.js" }}' defer></script>
33
{{ end }}
44

55
{{ define "main" }}

layouts/home.html

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,6 @@
11
{{ define "head" }}
22

3-
{{ $base := .Site.BaseURL }}
4-
{{ $parsed := urls.Parse $base }}
5-
{{ $path := $parsed.Path }}
6-
{{ if (eq $path "/") }}
7-
{{ .Scratch.Set "path" ""}}
8-
{{ else }}
9-
{{ .Scratch.Set "path" $path}}
10-
{{ end }}
11-
12-
<script src='{{ .Scratch.Get "path" }}/js/cli.js' defer></script>
3+
<script src='{{ relURL "js/cli.js" }}' defer></script>
134
{{ end }}
145

156
{{ define "main" }}
@@ -48,25 +39,25 @@ <h1 class="text-5xl font-medium">{{ .Title }}</h1>
4839
</button>
4940
<div id="dropdown" class="hidden lg:block border-t border-opacity-50 border-redis-ink-900 text-redis-pen-800">
5041
<ul class="p-6">
51-
<li><a class="py-2 hover:underline hover:text-redis-pen-600" href='{{ .Scratch.Get "path" }}/develop'>Develop with Redis</a></li>
52-
<li><a class="py-2 hover:underline hover:text-redis-pen-600" href='{{ .Scratch.Get "path" }}/integrate'>Libraries and tools</a></li>
53-
<li><a class="py-2 hover:underline hover:text-redis-pen-600" href='{{ .Scratch.Get "path" }}/operate'>Redis products</a></li>
54-
<li><a class="py-2 hover:underline hover:text-redis-pen-600" href='{{ .Scratch.Get "path" }}/commands'>Commands</a></li>
55-
<li><a class="py-2 hover:underline hover:text-redis-pen-600" href='{{ .Scratch.Get "path" }}/apis'>APIs</a></li>
42+
<li><a class="py-2 hover:underline hover:text-redis-pen-600" href='{{ relURL "develop" }}'>Develop with Redis</a></li>
43+
<li><a class="py-2 hover:underline hover:text-redis-pen-600" href='{{ relURL "integrate" }}'>Libraries and tools</a></li>
44+
<li><a class="py-2 hover:underline hover:text-redis-pen-600" href='{{ relURL "operate" }}'>Redis products</a></li>
45+
<li><a class="py-2 hover:underline hover:text-redis-pen-600" href='{{ relURL "commands" }}'>Commands</a></li>
46+
<li><a class="py-2 hover:underline hover:text-redis-pen-600" href='{{ relURL "apis" }}'>APIs</a></li>
5647
</ul>
5748
</div>
5849
</div>
5950
</nav>
6051
<nav class="hidden lg:block w-full lg:w-64 z-40 h-full leading-7">
6152
<div class="flex flex-col gap-4">
6253
<div class="flex flex-col border border-redis-ink-900 border-opacity-50 rounded-md">
63-
<a class="px-6 py-4 rounded-t-md hover:bg-redis-pen-200" href='{{ .Scratch.Get "path" }}/develop'>Develop with Redis</a>
64-
<a class="px-6 py-4 hover:bg-redis-pen-200 border-y border-redis-ink-900 border-opacity-50" href='{{ .Scratch.Get "path" }}/integrate'>Libraries and tools</a>
65-
<a class="px-6 py-4 rounded-b-md hover:bg-redis-pen-200" href='{{ .Scratch.Get "path" }}/operate'>Redis products</a>
54+
<a class="px-6 py-4 rounded-t-md hover:bg-redis-pen-200" href='{{ relURL "develop" }}'>Develop with Redis</a>
55+
<a class="px-6 py-4 hover:bg-redis-pen-200 border-y border-redis-ink-900 border-opacity-50" href='{{ relURL "integrate" }}'>Libraries and tools</a>
56+
<a class="px-6 py-4 rounded-b-md hover:bg-redis-pen-200" href='{{ relURL "operate" }}'>Redis products</a>
6657
</div>
6758
<div class="flex flex-col border border-redis-ink-900 border-opacity-50 rounded-md">
68-
<a class="px-6 py-4 rounded-t-md hover:bg-redis-pen-200 text-redis-red-600" href='{{ .Scratch.Get "path" }}/commands'>Commands</a>
69-
<a class="px-6 py-4 rounded-b-md hover:bg-redis-pen-200 border-t border-redis-ink-900 border-opacity-50" href='{{ .Scratch.Get "path" }}/apis'>APIs</a>
59+
<a class="px-6 py-4 rounded-t-md hover:bg-redis-pen-200 text-redis-red-600" href='{{ relURL "commands" }}'>Commands</a>
60+
<a class="px-6 py-4 rounded-b-md hover:bg-redis-pen-200 border-t border-redis-ink-900 border-opacity-50" href='{{ relURL "apis" }}'>APIs</a>
7061
</div>
7162
</div>
7263
</nav>

layouts/integrate/list.html

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
11
{{ define "head" }}
2-
{{ $base := .Site.BaseURL }}
3-
{{ $parsed := urls.Parse $base }}
4-
{{ $path := $parsed.Path }}
5-
{{ if (eq $path "/") }}
6-
{{ .Scratch.Set "path" ""}}
7-
{{ else }}
8-
{{ .Scratch.Set "path" $path}}
9-
{{ end }}
10-
{{ $basePath := .Scratch.Get "path" }}
11-
<script src='{{ $basePath }}/js/integrations-filters.js' defer></script>
2+
<script src='{{ relURL "js/integrations-filters.js" }}' defer></script>
123
{{ end }}
134

145
{{ define "main" }}
156
{{ partial "path-scratch.html" }}
16-
{{ $basePath := .Scratch.Get "path" }}
177
<main class="docs w-full max-w-[1920px] mx-auto px-5 flex flex-col md:flex-row overflow-hidden">
188
{{ partial "docs-nav-collapsed.html" . }}
199
<div class="py-12 md:px-4 xl:px-16 overflow-hidden">

layouts/integrate/single.html

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{{ define "head" }}
2-
{{ $base := .Site.BaseURL }}
3-
{{ $parsed := urls.Parse $base }}
4-
{{ $path := $parsed.Path }}
5-
{{ if (eq $path "/") }}
6-
{{ .Scratch.Set "path" ""}}
7-
{{ else }}
8-
{{ .Scratch.Set "path" $path}}
9-
{{ end }}
10-
{{ $basePath := .Scratch.Get "path" }}
11-
<script src='{{ $basePath }}/js/codetabs.js' defer></script>
2+
<script src='{{ relURL "js/codetabs.js" }}' defer></script>
123
{{ end }}
134

145
{{ define "main" }}

layouts/integration/list.html

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{{ define "head" }}
2-
{{ $base := .Site.BaseURL }}
3-
{{ $parsed := urls.Parse $base }}
4-
{{ $path := $parsed.Path }}
5-
{{ if (eq $path "/") }}
6-
{{ .Scratch.Set "path" ""}}
7-
{{ else }}
8-
{{ .Scratch.Set "path" $path}}
9-
{{ end }}
10-
{{ $basePath := .Scratch.Get "path" }}
11-
<script src='{{ $basePath }}/js/codetabs.js' defer></script>
2+
<script src='{{ relURL "js/codetabs.js" }}' defer></script>
123
{{ end }}
134

145
{{ define "main" }}

layouts/integration/single.html

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,5 @@
11
{{ define "head" }}
2-
{{ $base := .Site.BaseURL }}
3-
{{ $parsed := urls.Parse $base }}
4-
{{ $path := $parsed.Path }}
5-
{{ if (eq $path "/") }}
6-
{{ .Scratch.Set "path" ""}}
7-
{{ else }}
8-
{{ .Scratch.Set "path" $path}}
9-
{{ end }}
10-
{{ $basePath := .Scratch.Get "path" }}
11-
<script src='{{ $basePath }}/js/codetabs.js' defer></script>
2+
<script src='{{ relURL "js/codetabs.js" }}' defer></script>
123
{{ end }}
134

145
{{ define "main" }}

layouts/operate/single.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ define "head" }}
2-
<script src='{{ relURL "" }}/js/codetabs.js' defer></script>
2+
<script src='{{ relURL "js/codetabs.js" }}' defer></script>
33
{{ end }}
44

55
{{ define "main" }}

layouts/partials/docs-nav-collapsed.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
{{ $navRoot := cond (eq .Site.Home.Type "docs") .Site.Home .FirstSection -}}
44
<div id="sidebar" class="max-h-[calc(100vh-8rem)] border border-opacity-50 border-redis-ink-900 rounded-md flex flex-col">
55
{{ if in (slice "Develop" "Integrate" "Operate" "Commands") $navRoot.LinkTitle }}
6-
<a class='px-6 py-4 rounded-t-md hover:bg-redis-pen-200 {{ if eq $navRoot.LinkTitle "Develop" }} font-bold {{ end }}' href='{{ .Scratch.Get "path" }}/develop'>Develop with Redis</a>
7-
<a class='px-6 py-4 hover:bg-redis-pen-200 border-t border-redis-ink-900 border-opacity-50 {{ if eq $navRoot.LinkTitle "Integrate" }} font-bold {{ end }}' href='{{ .Scratch.Get "path" }}/integrate'>Libraries and tools</a>
8-
<a class='px-6 py-4 rounded-b-md hover:bg-redis-pen-200 border-t border-redis-ink-900 border-opacity-50 {{ if eq $navRoot.LinkTitle "Operate" }} font-bold {{ end }}' href='{{ .Scratch.Get "path" }}/operate'>Redis products</a>
6+
<a class='px-6 py-4 rounded-t-md hover:bg-redis-pen-200 {{ if eq $navRoot.LinkTitle "Develop" }} font-bold {{ end }}' href='{{ relURL "develop" }}'>Develop with Redis</a>
7+
<a class='px-6 py-4 hover:bg-redis-pen-200 border-t border-redis-ink-900 border-opacity-50 {{ if eq $navRoot.LinkTitle "Integrate" }} font-bold {{ end }}' href='{{ relURL "integrate" }}'>Libraries and tools</a>
8+
<a class='px-6 py-4 rounded-b-md hover:bg-redis-pen-200 border-t border-redis-ink-900 border-opacity-50 {{ if eq $navRoot.LinkTitle "Operate" }} font-bold {{ end }}' href='{{ relURL "operate" }}'>Redis products</a>
99
{{ else }}
1010
<a class='px-6 py-4 rounded-t-md hover:bg-redis-pen-200 font-bold' href="{{ $navRoot.RelPermalink }}">{{ $navRoot.LinkTitle }}</a>
1111
<div class="hidden md:block w-full py-6"></div>
1212
{{ end }}
1313
</div>
1414
{{ if in (slice "Commands" "Integrate") $navRoot.LinkTitle }}
1515
<div id="sidebar-cmd" class="max-h-[calc(100vh-8rem)] border border-opacity-50 border-redis-ink-900 rounded-md flex flex-col mt-4">
16-
<a class='px-6 py-4 hover:bg-redis-pen-200 text-redis-red-600 {{ if eq $navRoot.LinkTitle "Commands" }} font-bold {{ end }}' href='{{ .Scratch.Get "path" }}/commands'>Commands</a>
16+
<a class='px-6 py-4 hover:bg-redis-pen-200 text-redis-red-600 {{ if eq $navRoot.LinkTitle "Commands" }} font-bold {{ end }}' href='{{ relURL "commands" }}'>Commands</a>
1717
</div>
1818
{{ end }}
1919
</nav>

0 commit comments

Comments
 (0)