Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions exampleSite/content/test-product/images/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
title: Images
description: Images
---
35 changes: 35 additions & 0 deletions exampleSite/content/test-product/images/image-grid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Image Grid
description: Image Grid usage
---

The `img` shortcode has support for the `grid` attribute.
The following values are supported:
- `wide`
- `last-third`
- `first-third`
- `first-two-thirds` (default)

``` go-template
{{</*img src="hero-graphic.webp" grid="wide"*/>}}
```


## Default
By default, and image will take up the first two-thirds of the grid, allowing for call out content to its right.
{{< img src="hero-graphic.webp">}}
{{<call-out sideline="true">}}
Here is an example of a callout to the side of an image.
{{</call-out>}}


## `wide`
Providing the "wide" option, will make the image take up the full grid.

{{< img src="hero-graphic.webp" grid="wide">}}


## `last-third`
Providing the "last-third" option, will make the image take up the last third of the grid, similar to a side call out.
This makes it possible to place an image to the right of text.
{{< img src="hero-graphic.webp" grid="last-third">}}
5 changes: 3 additions & 2 deletions layouts/shortcodes/img.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
{{- $grid := .Get "grid" | default "first-two-thirds" -}}
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }} data-grid="{{$grid}}">
{{- $src := .Get "src" -}}
{{- $isSVG := strings.HasSuffix $src ".svg" -}}
<img class="{{ if $isSVG }}figure-svg{{ else }}figure-bitmap{{ end }}" src="{{ .Get "src" | relURL }}"
Expand Down Expand Up @@ -26,4 +27,4 @@ <h4>{{ . }}</h4>
{{- end }}
</figcaption>
{{- end }}
</figure>
</figure>
Loading