summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authormms <git@sapka.me>2024-11-11 21:33:47 +0100
committermms <git@sapka.me>2024-11-11 21:33:47 +0100
commit71e48e43cefa0b2830b8f167f5ca5d0a6dad738e (patch)
treec41fdcfacadf5278576711a5459fbff25cb38f83 /layouts
parent1436e6b4da3586f63220ba340e0e8b838385aaa4 (diff)
feat: book reviews
Diffstat (limited to 'layouts')
l---------layouts/partials/reviews/.#metrics.html1
-rw-r--r--layouts/partials/reviews/metrics.html28
-rw-r--r--layouts/partials/reviews/related.html23
-rw-r--r--layouts/reviews/list.html38
-rw-r--r--layouts/reviews/single.html22
l---------layouts/shortcodes/.#review-table.html1
-rw-r--r--layouts/shortcodes/review-table.html30
7 files changed, 143 insertions, 0 deletions
diff --git a/layouts/partials/reviews/.#metrics.html b/layouts/partials/reviews/.#metrics.html
new file mode 120000
index 0000000..8a2a5d0
--- /dev/null
+++ b/layouts/partials/reviews/.#metrics.html
@@ -0,0 +1 @@
+mms@voyager.local.23203:1731088680 \ No newline at end of file
diff --git a/layouts/partials/reviews/metrics.html b/layouts/partials/reviews/metrics.html
new file mode 100644
index 0000000..08c9c9a
--- /dev/null
+++ b/layouts/partials/reviews/metrics.html
@@ -0,0 +1,28 @@
+ <div class="poster">
+ {{- $path := .Params.image }}
+ {{- $img := resources.Get $path }}
+ {{- $img1x := $img.Resize "170x webp" }}
+ {{- $img2x := $img.Resize "340x webp" }}
+
+ <img
+ alt="Cover"
+ src="{{ $img1x.Permalink }}"
+ srcset="
+ {{ $img1x.Permalink }} 1x,
+ {{ $img2x.Permalink }} 2x
+ "
+ width="{{ $img1x.Width }}"
+ height="{{ $img1x.Height }}"
+ >
+ </div>
+
+ <div class="rating">
+{{ $rating := .Params.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>
diff --git a/layouts/partials/reviews/related.html b/layouts/partials/reviews/related.html
new file mode 100644
index 0000000..6432331
--- /dev/null
+++ b/layouts/partials/reviews/related.html
@@ -0,0 +1,23 @@
+{{ $page := .}}
+{{ $reviews := where .Site.RegularPages "Section" "eq" "reviews" }}
+<aside class="related">
+ <ul>
+ {{ range .Page.Params.related }}
+ {{ $related := slice .}}
+ <li class="related-item"><b>{{ . }}</b>
+ <ol class="related-titles">
+ {{- range (where $reviews ".Params.related" "intersect" $related) }}
+ <li>
+ {{ if (eq . $page) }}
+ {{ .Params.relatedName}}
+ {{ else }}
+ <a href="{{.Permalink}}"> {{ .Params.relatedName }} </a>
+ {{ end }}
+ </li>
+
+ {{ end }}
+ </ul>
+</li>
+{{ end }}
+</ul>
+</aside>
diff --git a/layouts/reviews/list.html b/layouts/reviews/list.html
new file mode 100644
index 0000000..b5a9643
--- /dev/null
+++ b/layouts/reviews/list.html
@@ -0,0 +1,38 @@
+{{ define "main" }}
+{{ $page := .Page }}
+<article>
+{{ .Content }}
+
+{{ range .Params.reviewSection}}
+<h2>{{ . }}</h2>
+
+ <table style=" width: 80%;
+ table-layout: fixed;
+ margin: 10px;
+ ">
+ <thead>
+ <tr>
+ <td><b>Title</b></td>
+ <td style="width: 50px;
+ text-align: center;
+ "><b>RTG</b></td>
+ </thead>
+ <tbody>
+ {{- range
+(where $page.Site.RegularPages ".Params.reviewSection" "intersect" (slice .)).ByTitle }}
+
+ <tr>
+ <td><a href="{{ .Permalink }}">{{ .Title }}</td>
+ <td style="
+ width: 50px;
+ text-align: center;
+ "
+ >{{ .Params.Rating}}</td>
+ </tr>
+ {{- end }}
+ </tbody>
+</table>
+ {{ end }}
+</article>
+
+{{ end }}
diff --git a/layouts/reviews/single.html b/layouts/reviews/single.html
new file mode 100644
index 0000000..8b8e1da
--- /dev/null
+++ b/layouts/reviews/single.html
@@ -0,0 +1,22 @@
+{{ define "main" }}
+<article class="reviews">
+
+ <aside class="right-panel">
+ {{ partial "reviews/metrics.html" . }}
+
+ {{ if .Page.Params.related}}
+ {{ partial "reviews/related.html" . }}
+ {{ end }}
+ </aside>
+ <h2> <a href="{{ .Page.Permalink }}"> {{ .Title }}</a></h2>
+ <hr>
+
+ {{ .Page.Content }}
+
+ <hr>
+ <time datetime="{{.PublishDate.Format "2006-01-02" }}">
+ Published:
+ {{ .PublishDate.Format "Monday, 2 Jan 2006" }}
+ </time>
+</article>
+{{- end }}
diff --git a/layouts/shortcodes/.#review-table.html b/layouts/shortcodes/.#review-table.html
new file mode 120000
index 0000000..8a2a5d0
--- /dev/null
+++ b/layouts/shortcodes/.#review-table.html
@@ -0,0 +1 @@
+mms@voyager.local.23203:1731088680 \ No newline at end of file
diff --git a/layouts/shortcodes/review-table.html b/layouts/shortcodes/review-table.html
new file mode 100644
index 0000000..4460525
--- /dev/null
+++ b/layouts/shortcodes/review-table.html
@@ -0,0 +1,30 @@
+
+ <table style="
+ border: 1px groove #000;
+ width: 100%;
+ table-layout: fixed;
+ ">
+ <thead>
+ <tr>
+ <td><b>Title</b></td>
+ <td style="
+ width: 50px;
+ text-align: center;
+ "
+ ><b>RTG</b></td>
+ </thead>
+ <tbody>
+ {{- range
+(where .Site.RegularPages ".Section" "intersect" (slice .Section)).ByTitle }}
+
+ <tr>
+ <td><a href="{{ .Permalink }}">{{ .Title }}</td>
+ <td style="
+ width: 50px;
+ text-align: center;
+ "
+ >{{ .Params.Rating}}</td>
+ </tr>
+ {{- end }}
+ </tbody>
+</table>