cach-radio/inc/themes/castanet/layouts/guest/list.html

163 lines
6.6 KiB
HTML
Raw Permalink Normal View History

2022-12-15 22:36:40 +01:00
{{ define "main" }}
<div class = "row">
<div class = "col-md-12">
<h1>Guests of {{ .Site.Title }}</h1>
</div>
</div>
{{ with .Content }}
<div clas = "row">
<div class = "col">
{{ . }}
</div>
</div>
{{- end -}}
<div class = "row">
<div class = "col">
{{ $paginator := .Paginate (where .Data.Pages.ByTitle "Type" "guest") }}
{{ range $paginator.Pages }}
{{- $.Scratch.Set "guest-name" .File.BaseFileName -}}
{{ $.Scratch.Set "hide-guest" "false" }}
{{- with .Params.guest_group -}}
{{ range first 1 (where $.Data.Pages "Params.guest_group" . ).ByDate.Reverse }}
{{ if ne ($.Scratch.Get "guest-name") .File.BaseFileName }}
{{ $.Scratch.Set "hide-guest" "true" }}
{{ end }}
{{ end }}
{{- end -}}
{{ if ne ($.Scratch.Get "hide-guest") "true"}}
<div class="row person_row">
<div class="col-md-3">
{{- if and (isset .Params "thumbnail") (ne .Params.thumbnail "") -}}
{{- if (eq (slicestr .Params.thumbnail 0 4) "http") -}}
<a href = "{{(printf "guest/%s/" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ .Params.thumbnail }}" class="img-fluid" width="250px"></a>
{{- else -}}
<a href = "{{(printf "guest/%s/" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ .Params.thumbnail | absURL}}" class="img-fluid" width="250px"></a>
{{- end -}}
{{- else -}}
<a href = "{{(printf "guest/%s/" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ "img/guest/default-guest.png" | absURL }}" class="img-fluid" width="250px"/></a>
{{- end -}}
</div>
<div class= "col-md-6">
<h3><a href = "{{(printf "guest/%s/" .File.BaseFileName) | absURL }}">{{ .Title }}</a> {{ with .Params.Pronouns }}({{ . }}){{ end }}</h3>
<p>{{ .Content }}</p>
{{ with .Params.Website }}
<a href = "{{ . }}"><i class="fas fa-home fa-2x"></i></a>
{{ end }}
{{ with .Params.Twitter }}
{{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-twitter-square fa-2x" "prefix" "https://twitter.com/" "text" "") }}
{{ end }}
{{ with .Params.GitHub}}
{{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-github-square fa-2x" "prefix" "https://github.com/" "text" "") }}
{{ end }}
{{ with .Params.LinkedIn }}
{{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-linkedin fa-2x" "prefix" "https://www.linkedin.com/in/" "text" "") }}
{{ end }}
{{ with .Params.Facebook }}
{{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-facebook-square fa-2x" "prefix" "https://www.facebook.com/" "text" "") }}
{{ end }}
{{ with .Params.Pinterest }}
{{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-pinterest-square fa-2x" "prefix" "https://www.pinterest.com/" "text" "") }}
{{ end }}
{{ with .Params.Instagram }}
{{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-instagram fa-2x" "prefix" "https://www.instagram.com/" "text" "") }}
{{ end }}
{{ with .Params.YouTube }}
{{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-youtube-square fa-2x" "prefix" "https://www.youtube.com/" "text" "") }}
{{ end }}
{{ with .Params.Twitch }}
{{ partial "social-link.html" (dict "context" . "aclass" "" "iclass" "fab fa-twitch fa-2x" "prefix" "https://twitch.tv/" "text" "") }}
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
</div>
</div>
{{ if gt $paginator.TotalPages 1 }}
<div class = "row">
<div class = "col">
<nav class="pagination justify-content-center">
{{ $pag := $.Paginator }}
{{ $window := $.Site.Params.paginateWindow | default 1 }}
{{ if gt $pag.TotalPages 1 }}
{{ $total := $pag.TotalPages }}
{{ $size := add 5 (add $window $window) }}
{{ $cur := $pag.PageNumber }}
{{ if gt $total $size }}
{{ if lt $cur (sub $size (add $window 1)) }}
{{ $.Scratch.Set "show" (seq 1 (sub $size 2)) }}
{{ else if lt (sub $total $cur) (sub $size (add $window 2)) }}
{{ $.Scratch.Set "show" (seq (add (sub $total $size) 3) $total) }}
{{ else }}
{{ $.Scratch.Set "show" (seq (sub $cur $window) (add $cur $window)) }}
{{ end }}
{{ $.Scratch.Add "show" 1 }}
{{ $.Scratch.Add "show" $total }}
{{ else }}
{{ $.Scratch.Set "show" (seq 1 $total) }}
{{ end }}
<ul class="pagination pagination-lg">
<!-- first page button -->
{{if $paginator.HasPrev }}
{{ if gt $paginator.PageNumber 2 }}
{{- with $paginator.First -}}
{{- $url := trim (string .URL) "/" | absURL -}}
<li class="page-item">
<a href="{{ $url }}" aria-label="First" class="page-link"><span aria-hidden="true">&laquo;&laquo;</span></a>
</li>
{{- end -}}
{{ end }}
{{ end }}
<!-- prev page button -->
{{- with $paginator.HasPrev -}}
<li class="page-item">
<a href="{{ $paginator.Prev.URL }}" class="page-link"> &laquo; </a>
</li>
{{ end }}
<!-- page # buttons -->
{{ range $pag.Pagers }}
{{ $cur := .PageNumber }}
{{- $url := trim (string .URL) "/" | absURL -}}
{{ if in ($.Scratch.Get "show") $cur }}
<li class = "{{ if eq . $pag }}active{{ end }} page-item"><a href="{{ .URL }}" class="page-link hidden-md-down">{{ .PageNumber }}</a></li>
{{ else if in (slice 2 (sub $total 1)) $cur }}
<li class="disabled page-item"><a name="" class="page-link hidden-md-down">&hellip;</a></li>
{{ end }}
{{ end }}
<!-- next page button -->
{{- with $paginator.HasNext -}}
<li class="page-item">
<a href="{{ $paginator.Next.URL }}" class="page-link"> &raquo; </a>
</li>
{{ end }}
<!-- last page button -->
{{ if lt $paginator.PageNumber (sub $paginator.TotalPages 1) }}
{{- with $paginator.Last -}}
{{- $url := trim (string .URL) "/" | absURL -}}
<li class="page-item">
<a href="{{ $url }}" aria-label="Last" class="page-link"><span aria-hidden="true">&raquo;&raquo;</span></a>
</li>
{{- end -}}
{{ end }}
</ul>
{{ end }}
</nav>
</div>
</div>
{{ end }}
{{ end }}