Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zzossig/hugo-theme-zdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/shortcodes/featuredImage.html')
-rw-r--r--layouts/shortcodes/featuredImage.html14
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