aboutsummaryrefslogtreecommitdiffstats
path: root/template.go
diff options
context:
space:
mode:
authorFeuerfuchs <git@feuerfuchs.dev>2019-06-20 18:16:12 +0200
committerFeuerfuchs <git@feuerfuchs.dev>2019-06-20 18:16:12 +0200
commit6f07c75f2ae1c3b164b66c2d7ed5fde242f8a744 (patch)
tree1fab37a8902d9fb0746db6144f1a43d091cd70be /template.go
parentMake output about ignored robots.txt optional (diff)
downloadgopherproxy-6f07c75f2ae1c3b164b66c2d7ed5fde242f8a744.tar.gz
gopherproxy-6f07c75f2ae1c3b164b66c2d7ed5fde242f8a744.tar.bz2
gopherproxy-6f07c75f2ae1c3b164b66c2d7ed5fde242f8a744.zip
Add navigation header
Diffstat (limited to 'template.go')
-rw-r--r--template.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/template.go b/template.go
index 781d2bb..b1dbaf1 100644
--- a/template.go
+++ b/template.go
@@ -12,6 +12,28 @@ var tpltext = `<!doctype html>
12 </style> 12 </style>
13 </head> 13 </head>
14 <body> 14 <body>
15 <header class="header">
16 {{- $href := "" -}}
17 {{- $uriParts := split .URI "/" -}}
18 {{- $uriLast := $uriParts | last -}}
19 {{- $uriParts = $uriParts | pop -}}
20 {{- if eq $uriLast "" -}}
21 {{- $uriLast = $uriParts | last -}}
22 {{- $uriParts = $uriParts | pop -}}
23 {{- end -}}
24
25 {{- range $i, $part := $uriParts -}}
26 {{- if ne $i 1 -}}
27 {{- $href = printf "%s/%s" $href . -}}
28 {{- if ne $i 0 }} / {{ end -}}
29 <a href="{{ $href }}" class="header__uripart">{{ . }}</a>
30 {{- else -}}
31 {{- $href = printf "%s/1" $href -}}
32 {{- end -}}
33 {{- end -}}
34 {{- if ne (len $uriParts) 0 }} / {{ end -}}
35 <span class="header__uripart header__uripart--last">{{ $uriLast -}}</span>
36 </header>
15 <main class="wrap"> 37 <main class="wrap">
16 <pre class="content"> 38 <pre class="content">
17 {{- if .Lines -}} 39 {{- if .Lines -}}