Browse Source

new shortcodes

itix-theme
Nicolas Massé 5 years ago
parent
commit
16726d13b5
  1. 11
      layouts/shortcodes/attachedFigure.html
  2. 10
      layouts/shortcodes/figure.html

11
layouts/shortcodes/attachedFigure.html

@ -0,0 +1,11 @@
<!-- This shortcode renders an HTML figure based on a page resource -->
{{ $filename := .Get "src" }}
{{ $image := .Page.Resources.GetMatch (printf "%s" $filename) }}
<figure>
<img src="{{ $image.Permalink }}">
{{ with .Get "title" }}
<figcaption>
{{ . }}
</figcaption>
{{ end }}
</figure>

10
layouts/shortcodes/figure.html

@ -0,0 +1,10 @@
<!-- This shortcode renders an HTML figure based on a file dropped in the /public folder -->
{{ $url := .Get "src" }}
<figure>
<img src="{{ $url }}">
{{ with .Get "title" }}
<figcaption>
{{ . }}
</figcaption>
{{ end }}
</figure>
Loading…
Cancel
Save