diff options
Diffstat (limited to 'layouts/shortcodes/featuredImage.html')
-rw-r--r-- | layouts/shortcodes/featuredImage.html | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/layouts/shortcodes/featuredImage.html b/layouts/shortcodes/featuredImage.html new file mode 100644 index 0000000..b7c8a1d --- /dev/null +++ b/layouts/shortcodes/featuredImage.html @@ -0,0 +1,14 @@ +{{ $imgSrc := false }} +{{ $params := $.Page.Params }} + +{{ if $params.image }} + {{ $imgSrc = $params.image }} +{{ else if $params.featured_image }} + {{ $imgSrc = (print "images/" $params.featured_image) }} +{{ end }} + +{{ if $imgSrc }} + <div class="featured-image__wrapper"> + <img src="{{ $imgSrc | relURL }}" alt="{{ (.Get "alt") | default "Featured Image" }}" class="featured-image" style="width: {{ with (.Get "width") }}{{ . }}px{{ end }};height: {{ with (.Get "height") }}{{ . }}px{{ end }};"> + </div> +{{ end }}
\ No newline at end of file |