summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/rating.html
blob: a3ead5e50a8150843f774b6a44ac432671e778de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
{{- $rating := .Get 0 }}
{{- $file := .Get 1 }}
{{- $caption := .Inner }}

<aside class="rating-box">
  <div class="poster">
    
    {{- $path := printf "brain-rot/covers/%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 15) }}
      {{- if le (mul $sequence 25) (mul (sub $rating 1) 100)}}&#9726;{{- else}}&#9725;{{- end }}
    {{- end }}
    <br>
    <b>{{ $rating }}/5</b> 
  </div>
</aside>