summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/rating.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/shortcodes/rating.html')
-rw-r--r--layouts/shortcodes/rating.html34
1 files changed, 34 insertions, 0 deletions
diff --git a/layouts/shortcodes/rating.html b/layouts/shortcodes/rating.html
new file mode 100644
index 0000000..e6159ae
--- /dev/null
+++ b/layouts/shortcodes/rating.html
@@ -0,0 +1,34 @@
+{{- $rating := .Get 0 }}
+{{- $file := .Get 1 }}
+{{- $caption := .Inner }}
+
+<aside class="rating-box float-right">
+ <div class="poster">
+
+ {{- $path := printf "content_images/%s" $file}}
+ {{- $img := resources.Get $path }}
+ {{- $img1x := $img.Resize "170x webp" }}
+ {{- $img2x := $img.Resize "340x webp" }}
+
+ <img
+ alt="{{ $caption }}"
+ src="{{ $img1x.Permalink }}"
+ srcset="
+ {{ $img1x.Permalink }} 1x,
+ {{ $img2x.Permalink }} 2x
+ "
+ width="{{ $img1x.Width }}"
+ height="{{ $img1x.Height }}"
+ >
+
+ </div>
+ <div class="rating">
+ My rating:<br>
+
+ {{- range $i, $sequence := (seq 20) }}
+ {{- if le (mul $sequence 25) (mul $rating 100)}}&#9726;{{- else}}&#9725;{{- end }}
+ {{- end }}
+ <br>
+ <b>{{ $rating }}/5</b>
+ </div>
+</aside>