Convert flickr shortcode to page layout
This commit is contained in:
parent
1438ce758a
commit
6b216f56a3
7 changed files with 41 additions and 37 deletions
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: Gallery
|
||||
image: https://c1.staticflickr.com/5/4433/36343562896_0226cc3535_k.jpg
|
||||
layout: flickr
|
||||
photoset: 72157683796439222
|
||||
---
|
||||
|
||||
{{% flickr 72157683796439222 %}}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: Gallery
|
||||
image: https://c2.staticflickr.com/8/7670/17115168179_1ef30ac6e9_b.jpg
|
||||
layout: flickr
|
||||
photoset: 72157651820386449
|
||||
---
|
||||
|
||||
{{% flickr 72157651820386449 %}}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
---
|
||||
title: Gallery
|
||||
image: https://c2.staticflickr.com/8/7674/17308375182_a172a341d6_h.jpg
|
||||
layout: flickr
|
||||
photoset: 72157651794923357
|
||||
---
|
||||
|
||||
{{% flickr 72157651794923357 %}}
|
||||
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
title: Student Robotics 2016
|
||||
linkTitle: 2016
|
||||
image: https://farm2.staticflickr.com/1466/26707090961_9b44a94f31_o_d.jpg
|
||||
layout: flickr
|
||||
photoset: 72157667801651676
|
||||
---
|
||||
|
||||
{{% flickr 72157667801651676 %}}
|
||||
|
|
|
@ -2,6 +2,6 @@
|
|||
title: Student Robotics 2017
|
||||
linkTitle: 2017
|
||||
image: https://farm3.staticflickr.com/2837/33771948196_bd306d2a8f_o_d.jpg
|
||||
layout: flickr
|
||||
photoset: 72157679850996831
|
||||
---
|
||||
|
||||
{{% flickr 72157679850996831 %}}
|
||||
|
|
31
layouts/_default/flickr.html
Normal file
31
layouts/_default/flickr.html
Normal file
|
@ -0,0 +1,31 @@
|
|||
{{ define "main" }}
|
||||
<div id="main">
|
||||
<div class="container">
|
||||
{{ partial "content.html" . }}
|
||||
|
||||
{{ $id := .Params.photoset }}
|
||||
{{ $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_l" }}
|
||||
{{ $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_l }}" 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>
|
||||
</div>
|
||||
</div>
|
||||
{{ end }}
|
|
@ -1,24 +0,0 @@
|
|||
{{ $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_l" }}
|
||||
{{ $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_l }}" 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>
|
||||
|
Loading…
Reference in a new issue