Browse Source

added navigations

master
Chris 6 years ago
parent
commit
91efca62cd
  1. 71
      layouts/years/term.html

71
layouts/years/term.html

@ -1,31 +1,60 @@
{{ define "main" }}
{{ $pages := .Pages }}
{{ $year := .Title}}
{{ $all_pages := where .Site.RegularPages "Type" "in" (slice "posts") }}
{{ $all_pages = sort $all_pages "Date" }}
{{ $nextYear := (int .Title) }}
{{ $pages := where .Site.RegularPages "Type" "in" (slice "posts") }}
{{ $pages = sort $pages "Date" }}
{{ $pages = first 1 $pages }}
{{ $next := printf "%s/%s" "years" .Title }}
{{ $previous_year := "" }}
{{ $next_year := "" }}
{{ range $all_pages }}
{{ if lt (dateFormat "2006" .Params.Date) $year }}
{{ $previous_year = dateFormat "2006" .Params.Date }}
{{ end }}
{{ end }}
{{ range ( sort $all_pages "Date" "desc" ) }}
{{ if gt (dateFormat "2006" .Params.Date) $year }}
{{ $next_year = dateFormat "2006" .Params.Date }}
{{ end }}
{{ end }}
{{ partial "navigation-bar.html" ( dict "context" . "items" (slice "years" ) )}}
{{ $next := printf "../%s" $next_year }}
{{ $previous := printf "../%s" $previous_year }}
<article class="cf pa3 pa4-m pa4-l">
<div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links nested-img mid-gray">
{{ $total_distance := 0 }}
{{ $total_ascent := 0 }}
{{ $total_nr_of_tours := 0 }}
{{ range .Pages }}
{{ $act_ascent:= int .Params.ascent_m }}
{{ $total_ascent = add $act_ascent $total_ascent }}
{{ $act_distance:= int .Params.distance_km }}
{{ $total_distance = add $act_distance $total_distance }}
{{ $total_nr_of_tours = add 1 $total_nr_of_tours }}
<div class="mw8 center flex justify-between">
<div>
{{ if ne $previous_year "" }}
<a href="{{ $previous }}" class="{{ .Site.Params.background_color_class | default "bg-black" }} tc link f5 grow no-underline dib hover-white white-80 pl3 pr3 pt2 pb2">
< {{ $previous_year }}
</a>
{{ end }}
</div>
<div>
{{ if ne $next_year "" }}
<a href="{{ $next }}" class="{{ .Site.Params.background_color_class | default "bg-black" }} tc link f5 grow no-underline dib hover-white white-80 pl3 pr3 pt2 pb2">
{{ $next_year }} >
</a>
{{ end }}
</div>
</div>
{{ $total_distance := 0 }}
{{ $total_ascent := 0 }}
{{ $total_nr_of_tours := 0 }}
{{ range .Pages }}
{{ $act_ascent:= int .Params.ascent_m }}
{{ $total_ascent = add $act_ascent $total_ascent }}
{{ $act_distance:= int .Params.distance_km }}
{{ $total_distance = add $act_distance $total_distance }}
{{ $total_nr_of_tours = add 1 $total_nr_of_tours }}
{{ end }}
<div class="measure-wide-l center f4 lh-copy nested-copy-line-height nested-links nested-img mid-gray">
<p>Touren des Jahres {{ .Title }}!</p>
{{ partial "statistic-summary.html" ( dict "total_nr" $total_nr_of_tours "distance" $total_distance "ascent" $total_ascent ) }}
</div>

Loading…
Cancel
Save