Skip to content

Instantly share code, notes, and snippets.

@miketweaver
Last active January 30, 2019 18:41
Show Gist options
  • Save miketweaver/193ff9330224db630e68fa211728d50c to your computer and use it in GitHub Desktop.
Save miketweaver/193ff9330224db630e68fa211728d50c to your computer and use it in GitHub Desktop.
{{ $altText := .Get "alt"}}
{{ $caption := .Get "caption"}}
{{ $source := .Get "source"}}
{{ with $.Page.Resources.GetMatch (.Get "name") }}
<div class="post-image">
<figure>
<a href="{{.RelPermalink}}">
<img
srcset="
{{ (.Resize "320x").RelPermalink }} 320w,
{{ (.Resize "600x").RelPermalink }} 600w,
{{ (.Resize "1200x").RelPermalink }} 2x"
src="{{ (.Resize "600x").RelPermalink }}" alt="{{$altText}}"/>
</a>
<figcaption><p>{{ $caption }}</p>{{ if $source }}<p><a href="{{ $source }}">source</a></p>{{ end }}</figcaption>
</figure>
</div>
{{ else }}
could not find image
{{ end }}
{{< bundle-image name="old_galileo.png" alt="A Photo of the Old Galileo." caption="This is how the Galileo looked in 2001 and how I remember it" source="https://web.archive.org/web/20190130014421/https://voyagerslog.blogspot.com/2016/03/a-tribute-to-first-galileo-as-she.html" >}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment