diff --git a/layouts/partials/card.html b/layouts/partials/card.html index 654b4e3..5eee471 100644 --- a/layouts/partials/card.html +++ b/layouts/partials/card.html @@ -1,5 +1,20 @@
- {{ with .Params.image }}{{ $.Title }} cover{{ end }} + {{ with .Params.image }} + {{ $.Title }} cover + {{ else }} + {{ $bgColor := "#546e7a" }} + {{ if eq .Params.category "Books" }}{{ $bgColor = "#004d40" }}{{ end }} + {{ if eq .Params.category "Movies" }}{{ $bgColor = "#01579b" }}{{ end }} + {{ if eq .Params.category "TV Series" }}{{ $bgColor = "#4a148c" }}{{ end }} + {{ if eq .Params.category "Recipes" }}{{ $bgColor = "#b71c1c" }}{{ end }} + {{ if eq .Params.category "YouTube" }}{{ $bgColor = "#f44336" }}{{ end }} +
+
+
{{ substr .Title 0 1 }}
+
{{ .Title }}
+
+
+ {{ end }}
{{ .Title }}
{{ with .Params.rating }}
{{ partial "stars.html" (dict "rating" .) }} {{ . }}
{{ end }} {{ with .Params.likes }}
👍 {{ . }}
{{ end }} diff --git a/layouts/partials/stars.html b/layouts/partials/stars.html index 4e67c50..9e8b6c5 100644 --- a/layouts/partials/stars.html +++ b/layouts/partials/stars.html @@ -1,10 +1,30 @@ -{{/* Renders stars for rating (e.g. 4.5) */}} -{{ $max := 5 }} -{{ $full := int (math.Floor .rating) }} -{{ $half := ge (modf .rating 1) 0.25 }} -{{ $empty := sub $max (add $full (cond $half 1 0)) }} +{{/* Simple star display - no math functions */}} - {{ range seq 1 $full }}★{{ end }} - {{ if $half }}½{{ end }} - {{ range seq 1 $empty }}☆{{ end }} +{{ if eq .rating 5.0 }} + ★★★★★ +{{ else if eq .rating 4.8 }} + ★★★★★ +{{ else if eq .rating 4.5 }} + ★★★★½ +{{ else if eq .rating 4.2 }} + ★★★★☆ +{{ else if eq .rating 4.0 }} + ★★★★☆ +{{ else if eq .rating 3.5 }} + ★★★½☆ +{{ else if eq .rating 3.0 }} + ★★★☆☆ +{{ else if eq .rating 2.5 }} + ★★½☆☆ +{{ else if eq .rating 2.0 }} + ★★☆☆☆ +{{ else if eq .rating 1.5 }} + ★½☆☆☆ +{{ else if eq .rating 1.0 }} + ★☆☆☆☆ +{{ else if eq .rating 0.5 }} + ½☆☆☆☆ +{{ else }} + ☆☆☆☆☆ +{{ end }} diff --git a/static/img/midnight-library.jpg b/static/img/midnight-library.jpg new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/static/img/midnight-library.jpg @@ -0,0 +1 @@ +