Include all photos as links in the RSS and Atom feeds, instead of just the thumbnail
- Move photo_thumbnail.html to photos/thumbnail.html - Add a photos/list.html partial that returns a list of photos for the current page - Use the template above everywhere we need a list of photos for the page
This commit is contained in:
parent
ab172e1e9e
commit
e263b3cb41
7 changed files with 21 additions and 13 deletions
25
layouts/partials/photos/thumbnail.html
Normal file
25
layouts/partials/photos/thumbnail.html
Normal file
|
@ -0,0 +1,25 @@
|
|||
{{- $thumbnailResource := .Page.Resources.GetMatch
|
||||
(index .Page.Params "thumbnail" | default "[tT]humbnail*")
|
||||
| default (index (.Page.Resources.ByType "image") 0) -}}
|
||||
|
||||
{{- if not $thumbnailResource -}}
|
||||
{{- errorf "No thumbnail available for %s" .Page.Permalink }}
|
||||
{{- end -}}
|
||||
|
||||
{{ $orientation := partial "images/orientation_angle.html" $thumbnailResource }}
|
||||
|
||||
{{ $targetWidth := 0 }}
|
||||
{{ if isset . "Width" }}{{ $targetWidth = .Width }}{{ else }}{{ $targetWidth = $thumbnailResource.Width }}{{ end }}
|
||||
{{ $targetHeight := 0 }}
|
||||
{{ if isset . "Height" }}{{ $targetHeight = .Height }}{{ else }}{{ $targetHeight = $thumbnailResource.Height }}{{ end }}
|
||||
|
||||
{{ $thumbnail := false }}
|
||||
{{ if not (and (eq $orientation 0)
|
||||
(eq $targetWidth $thumbnailResource.Width)
|
||||
(eq $targetHeight $thumbnailResource.Height)) }}
|
||||
{{ $thumbnail = $thumbnailResource.Fit (printf "%dx%d r%d" $targetWidth $targetHeight (sub 360 $orientation)) }}
|
||||
{{ else }}
|
||||
{{ $thumbnail = $thumbnailResource }}
|
||||
{{ end }}
|
||||
|
||||
{{ return $thumbnail }}
|
Loading…
Add table
Add a link
Reference in a new issue