Finish up photostream grid and single layouts
This commit is contained in:
parent
1bf8c28f23
commit
a74703beb5
7 changed files with 355 additions and 0 deletions
20
layouts/photos/list.html
Normal file
20
layouts/photos/list.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
{{ define "main" }}
|
||||
<main class="main--list main--photostream">
|
||||
<header class="page-header">
|
||||
{{ partial "page_header.html" (dict "page" .) }}
|
||||
</header>
|
||||
|
||||
{{- .Content -}}
|
||||
|
||||
{{ range .Pages.ByDate.Reverse.GroupByDate "2006" }}
|
||||
<section class="photostream-grid">
|
||||
<header class="photostream-grid__date-heading">
|
||||
<h2>{{ .Key }}</h2>
|
||||
</header>
|
||||
{{ range .Pages }}
|
||||
{{ .Render "page_summary" }}
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ end }}
|
||||
</main>
|
||||
{{ end }}
|
19
layouts/photos/page_summary.html
Normal file
19
layouts/photos/page_summary.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
{{- $gridSize := $.Site.Params.photos.thumbnailSize -}}
|
||||
{{- $thumbnail := partial "photostream/thumbnail.html" (dict "Page" . "Width" $gridSize "Height" $gridSize) -}}
|
||||
{{- $thumbnail = $thumbnail.Crop (printf "%dx%d" $gridSize $gridSize) -}}
|
||||
{{- $altText := $thumbnail.Params.alt -}}
|
||||
{{- $linkTitle := .LinkTitle | markdownify -}}
|
||||
{{- $showsTitle := le (len $linkTitle) 18 -}}
|
||||
<article class="photostream-item">
|
||||
{{ if $showsTitle }}
|
||||
<h3 class="photostream-item__title">{{ $linkTitle }}</h3>
|
||||
{{ end }}
|
||||
<a href="{{ .RelPermalink }}"
|
||||
{{- if not $showsTitle }} title="{{ .Title | markdownify }}"{{ end }}>
|
||||
<img
|
||||
class="photostream-item__thumbnail"
|
||||
src="{{ $thumbnail.RelPermalink }}"
|
||||
{{- with $altText }} alt="{{ . }}"{{ end }}>
|
||||
</a>
|
||||
<time class="photostream-item__date">{{ .Date | time.Format "2006-01-02" }}</time>
|
||||
</article>
|
31
layouts/photos/single.html
Normal file
31
layouts/photos/single.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
{{ define "main" }}
|
||||
<main class="main--single photostream--single">
|
||||
<header class="page-header">
|
||||
{{ partial "page_header.html" (dict "page" .) }}
|
||||
</header>
|
||||
|
||||
{{- $images := partial "photostream/image-resources.html" . -}}
|
||||
{{- if eq (len $images) 0 -}}
|
||||
{{ errorf "Missing photo from photos page %q" .Path }}
|
||||
{{- end -}}
|
||||
|
||||
{{ if eq (len $images) 1 }}
|
||||
{{- $img := index $images 0 -}}
|
||||
<figure class="figure figure--image photostream__figure">
|
||||
<img
|
||||
src="{{ $img.RelPermalink }}"
|
||||
{{- with $img.Params.alt }} alt="{{ . }}" {{ end -}}>
|
||||
</figure>
|
||||
|
||||
{{ .Content -}}
|
||||
|
||||
{{- if .Params.photo_details | default .Params.photoDetails | default true -}}
|
||||
{{- partial "photostream/exif_table.html" $img.Exif -}}
|
||||
{{- end -}}
|
||||
{{ end }}{{/* if eq (len $images) 1 */}}
|
||||
|
||||
<footer class="page-footer">
|
||||
{{ partial "page/footer.html" . }}
|
||||
</footer>
|
||||
</main>
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue