diff --git a/exampleSite/content/test-product/images/_index.md b/exampleSite/content/test-product/images/_index.md new file mode 100644 index 00000000..88857843 --- /dev/null +++ b/exampleSite/content/test-product/images/_index.md @@ -0,0 +1,4 @@ +--- +title: Images +description: Images +--- diff --git a/exampleSite/content/test-product/images/image-grid.md b/exampleSite/content/test-product/images/image-grid.md new file mode 100644 index 00000000..9f723ef4 --- /dev/null +++ b/exampleSite/content/test-product/images/image-grid.md @@ -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 +{{}} +``` + + +## 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">}} +{{}} +Here is an example of a callout to the side of an image. +{{}} + + +## `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">}} diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html index 9cbc0dc7..15c4aadc 100644 --- a/layouts/shortcodes/img.html +++ b/layouts/shortcodes/img.html @@ -1,4 +1,5 @@ - +{{- $grid := .Get "grid" | default "first-two-thirds" -}} + {{- $src := .Get "src" -}} {{- $isSVG := strings.HasSuffix $src ".svg" -}} {{ . }} {{- end }} {{- end }} - \ No newline at end of file +