diff options
author | Matt Stratton <matt.stratton@gmail.com> | 2018-03-08 02:20:24 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 02:20:24 +0300 |
commit | 20037c83a0aa5dd109fc3e247aa1c8513f247908 (patch) | |
tree | d73d4588a40a0a29d6fccd030f395436e656f328 /layouts | |
parent | cd21fcf8c1057d08b14fdadb7460c78c42829941 (diff) |
Update host code to be a partial (#166)
* Update host code to be a partial
Fixes #158
Signed-off-by: Matt Stratton <matt.stratton@gmail.com>
* Check for enable_jumbo exist for sidebar display
fixes #167
Signed-off-by: Matt Stratton <matt.stratton@gmail.com>
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/about/single.html | 56 | ||||
-rw-r--r-- | layouts/host/list.html | 110 | ||||
-rw-r--r-- | layouts/partials/hosts.html | 54 | ||||
-rw-r--r-- | layouts/partials/row.html | 5 |
4 files changed, 62 insertions, 163 deletions
diff --git a/layouts/about/single.html b/layouts/about/single.html index 2e18c61..2bd1bd5 100644 --- a/layouts/about/single.html +++ b/layouts/about/single.html @@ -24,58 +24,6 @@ </div> </div> - <div class = "row"> - <div class = "col-md-12"> - <h2>Hosts</h2> - </div> - </div> - <div class = "row"> - <div class = "col-md-12"> - {{ range where .Site.Pages "Type" "host" }} - {{- if not (in .File.BaseFileName "_index") -}} - <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 "host/%s" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ .Params.thumbnail }}" class="img-fluid" width="250px"></a> - {{- else -}} - <a href = "{{(printf "host/%s" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ .Params.thumbnail | absURL}}" class="img-fluid" width="250px"></a> - {{- end -}} - {{- else -}} - <a href = "{{(printf "host/%s" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ "img/host/default-host.png" | absURL }}" class="img-fluid" width="250px"/></a> - {{- end -}} - </div> - <div class= "col-md-6"> - <h3><a href = "{{(printf "host/%s" .File.BaseFileName) | absURL }}">{{ .Title }}</a></h3> - <p>{{ .Content | markdownify }}</p> - {{ with .Params.Website }} - <a href = "{{ . }}"><i class="fas fa-home fa-2x"></i></a> - {{ end }} - {{ with .Params.Twitter }} - <a href = "https://twitter.com/{{ . }}"><i class="fab fa-twitter-square fa-2x"></i></a> - {{ end }} - {{ with .Params.GitHub}} - <a href = "https://github.com/{{ . }}"><i class="fab fa-github-square fa-2x"></i></a> - {{ end }} - {{ with .Params.LinkedIn }} - <a href = "https://www.linkedin.com/in/{{ . }}"><i class="fab fa-linkedin fa-2x"></i></a> - {{ end }} - {{ with .Params.Facebook }} - <a href = "https://www.facebook.com/{{ . }}"><i class="fab fa-facebook-square fa-2x"></i></a> - {{ end }} - {{ with .Params.Pinterest }} - <a href = "https://www.pinterest.com/{{ . }}"><i class="fab fa-pinterest-square fa-2x"></i></a> - {{ end }} - {{ with .Params.Instagram }} - <a href = "https://www.instagram.com/{{ . }}"><i class="fab fa-instagram fa-2x"></i></a> - {{ end }} - {{ with .Params.YouTube }} - <a href = "https://www.youtube.com/{{ . }}"><i class="fab fa-youtube-square fa-2x"></i></a> - {{ end }} - </div> - </div> - {{- end -}} - {{ end }} - </div> - </div> + {{ partial "hosts.html" . }} + {{ end }} diff --git a/layouts/host/list.html b/layouts/host/list.html index 273eed8..c22776b 100644 --- a/layouts/host/list.html +++ b/layouts/host/list.html @@ -12,115 +12,7 @@ </div> </div> {{- end -}} -<div class = "row"> - <div class = "col"> - - {{ $paginator := .Paginate (where .Data.Pages "Type" "host") }} - {{ range $paginator.Pages }} - <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 "host/%s" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ .Params.thumbnail }}" class="img-fluid" width="250px"></a> - {{- else -}} - <a href = "{{(printf "host/%s" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ .Params.thumbnail | absURL}}" class="img-fluid" width="250px"></a> - {{- end -}} - {{- else -}} - <a href = "{{(printf "host/%s" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ "img/host/default-host.png" | absURL }}" class="img-fluid" width="250px"/></a> - {{- end -}} - </div> - <div class= "col-md-6"> - <h3><a href = "{{(printf "host/%s" .File.BaseFileName) | absURL }}">{{ .Title }}</a></h3> - <p>{{ .Content | markdownify }}</p> - {{ with .Params.Website }} - <a href = "{{ . }}"><i class="fas fa-home fa-2x"></i></a> - {{ end }} - {{ with .Params.Twitter }} - <a href = "https://twitter.com/{{ . }}"><i class="fab fa-twitter-square fa-2x"></i></a> - {{ end }} - {{ with .Params.GitHub}} - <a href = "https://github.com/{{ . }}"><i class="fab fa-github-square fa-2x"></i></a> - {{ end }} - {{ with .Params.LinkedIn }} - <a href = "https://www.linkedin.com/in/{{ . }}"><i class="fab fa-linkedin fa-2x"></i></a> - {{ end }} - {{ with .Params.Facebook }} - <a href = "https://www.facebook.com/{{ . }}"><i class="fab fa-facebook-square fa-2x"></i></a> - {{ end }} - {{ with .Params.Pinterest }} - <a href = "https://www.pinterest.com/{{ . }}"><i class="fab fa-pinterest-square fa-2x"></i></a> - {{ end }} - {{ with .Params.Instagram }} - <a href = "https://www.instagram.com/{{ . }}"><i class="fab fa-instagram fa-2x"></i></a> - {{ end }} - {{ with .Params.YouTube }} - <a href = "https://www.youtube.com/{{ . }}"><i class="fab fa-youtube-square fa-2x"></i></a> - {{ end }} - </div> - </div> - {{ 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"> -{{- 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">««</span></a> - </li> -{{- end -}} -<li class="{{ if not $paginator.HasPrev }}disabled {{ end }}page-item"> - <a href="{{ if $paginator.HasPrev }}{{ $paginator.Prev.URL }}{{ end }}" aria-label="Previous" class="page-link"><span aria-hidden="true">«</span></a> -</li> - - {{ 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">…</a></li> - {{ end }} - {{ end }} - {{- 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">»»</span></a> - </li> -{{- end -}} -</ul> -{{ end }} -</nav> -</div> -</div> -{{ end }} - +{{ partial "hosts.html" . }} {{ end }} diff --git a/layouts/partials/hosts.html b/layouts/partials/hosts.html new file mode 100644 index 0000000..e15b5d4 --- /dev/null +++ b/layouts/partials/hosts.html @@ -0,0 +1,54 @@ +<div class = "row"> + <div class = "col-md-12"> + <h2>Hosts</h2> + </div> + </div> + <div class = "row"> + <div class = "col-md-12"> + {{ range where .Site.Pages "Type" "host" }} + {{- if not (in .File.BaseFileName "_index") -}} + <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 "host/%s" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ .Params.thumbnail }}" class="img-fluid" width="250px"></a> + {{- else -}} + <a href = "{{(printf "host/%s" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ .Params.thumbnail | absURL}}" class="img-fluid" width="250px"></a> + {{- end -}} + {{- else -}} + <a href = "{{(printf "host/%s" .File.BaseFileName) | absURL }}"><img alt="{{ .Title }}" src="{{ "img/host/default-host.png" | absURL }}" class="img-fluid" width="250px"/></a> + {{- end -}} + </div> + <div class= "col-md-6"> + <h3><a href = "{{(printf "host/%s" .File.BaseFileName) | absURL }}">{{ .Title }}</a></h3> + <p>{{ .Content | markdownify }}</p> + {{ with .Params.Website }} + <a href = "{{ . }}"><i class="fas fa-home fa-2x"></i></a> + {{ end }} + {{ with .Params.Twitter }} + <a href = "https://twitter.com/{{ . }}"><i class="fab fa-twitter-square fa-2x"></i></a> + {{ end }} + {{ with .Params.GitHub}} + <a href = "https://github.com/{{ . }}"><i class="fab fa-github-square fa-2x"></i></a> + {{ end }} + {{ with .Params.LinkedIn }} + <a href = "https://www.linkedin.com/in/{{ . }}"><i class="fab fa-linkedin fa-2x"></i></a> + {{ end }} + {{ with .Params.Facebook }} + <a href = "https://www.facebook.com/{{ . }}"><i class="fab fa-facebook-square fa-2x"></i></a> + {{ end }} + {{ with .Params.Pinterest }} + <a href = "https://www.pinterest.com/{{ . }}"><i class="fab fa-pinterest-square fa-2x"></i></a> + {{ end }} + {{ with .Params.Instagram }} + <a href = "https://www.instagram.com/{{ . }}"><i class="fab fa-instagram fa-2x"></i></a> + {{ end }} + {{ with .Params.YouTube }} + <a href = "https://www.youtube.com/{{ . }}"><i class="fab fa-youtube-square fa-2x"></i></a> + {{ end }} + </div> + </div> + {{- end -}} + {{ end }} + </div> + </div>
\ No newline at end of file diff --git a/layouts/partials/row.html b/layouts/partials/row.html index bc38222..1aab16e 100644 --- a/layouts/partials/row.html +++ b/layouts/partials/row.html @@ -179,12 +179,17 @@ {{- end -}} </div> + {{- if isset .Site.Params "enable_jumbo" -}} {{- if ne .Site.Params.enable_jumbo "true" -}} <div class="col-md-4 sidebar_col"> {{- partial "sidebar.html" . -}} </div> {{- end -}} +{{- else -}} + <div class="col-md-4 sidebar_col"> + {{- partial "sidebar.html" . -}} + </div> {{- end -}} </div> |