champorado
  • 2024-08-17 19:27:59 -0700 PDT
    champorado

    champorado

    2024.8.17

    Gallery

    added shortcodes for my gallery using hugo’s guide

    layouts/shortcodes/gallery.html

    <div class="{{ .Get "class" }}" style="width:32.5%;display:inline-block;vertical-align:top">
      {{ .Inner }}
    </div>
    

    layouts/shortcodes/img.html

    {{- $src := .Get "src" -}}
    {{- with .Parent -}}
      <img src="{{ $src }}" class="{{ .Get "class" }}-image">
    {{- else -}}
      <img src="{{ $src }}">
    {{- end -}}
    

    I call them with {{\< gallery class="content-gallery" >}} and then {{\< img src="art.png" >}} without the backslashes.

    2024-08-17 19:27:59 -0700 PDT 2024.8.17