1
Fork 0
theorangeone.net-legacy/layouts/shortcodes/flickr.html

24 lines
1 KiB
HTML

{{ $id := .Get 0 }}
{{ $query := querify "format" "json" "nojsoncallback" "1" "api_key" .Site.Data.flickr.api_key }}
{{ $method := querify "method" "flickr.photosets.getPhotos" "user_id" .Site.Data.flickr.user_id "photoset_id" $id "extras" "url_o" }}
{{ $photoset_orig:= (getJSON "https://api.flickr.com/services/rest/?" $query "&" $method).photoset }}
{{ $method := querify "method" "flickr.photosets.getPhotos" "user_id" .Site.Data.flickr.user_id "photoset_id" $id "extras" "url_sq" }}
{{ $photoset_thumb := (getJSON "https://api.flickr.com/services/rest/?" $query "&" $method).photoset }}
<div id="light-gallery" class="row">
{{ range $index, $element := $photoset_orig.photo }}
{{ $thumb := (index $photoset_thumb.photo $index).url_sq }}
<a href="{{ $element.url_o }}" title="{{ $element.title }}" class="col-2">
<img src="{{ $thumb }}" alt="{{ $element.title }}"/>
</a>
{{ end }}
</div>
<h4>
<a href="{{ .Site.Data.social.accounts.flickr.link }}sets/{{ $id }}/">
View entire <i>{{ $photoset_orig.title }}</i> album on Flickr
</a>
</h4>