diff options
Diffstat (limited to 'template.go')
| -rw-r--r-- | template.go | 22 |
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 -}} |
