diff options
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/_default/list.html | 2 | ||||
-rw-r--r-- | layouts/_default/summary.html | 3 | ||||
-rw-r--r-- | layouts/book/list.html | 33 | ||||
-rw-r--r-- | layouts/book/single.html | 15 | ||||
-rw-r--r-- | layouts/partials/site-actions.html | 18 |
5 files changed, 63 insertions, 8 deletions
diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 38ef025..c265f91 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html | |||
@@ -1,5 +1,5 @@ | |||
1 | {{ define "main" }} | 1 | {{ define "main" }} |
2 | <article style="width:70ch;"> | 2 | <article> |
3 | <h1>{{ .Title }}</h1> | 3 | <h1>{{ .Title }}</h1> |
4 | {{ if .Content }} | 4 | {{ if .Content }} |
5 | <p>{{ .Content }}</p> | 5 | <p>{{ .Content }}</p> |
diff --git a/layouts/_default/summary.html b/layouts/_default/summary.html index 0753995..5e4ac4b 100644 --- a/layouts/_default/summary.html +++ b/layouts/_default/summary.html | |||
@@ -4,6 +4,9 @@ | |||
4 | <a href="{{ .RelPermalink }}" class="link black dim"> | 4 | <a href="{{ .RelPermalink }}" class="link black dim"> |
5 | {{ .Title }} | 5 | {{ .Title }} |
6 | </a> | 6 | </a> |
7 | {{ if isset .Params "rating" }} | ||
8 | {{ .Params.rating }} | ||
9 | {{ end }} | ||
7 | </h1> | 10 | </h1> |
8 | <p> | 11 | <p> |
9 | {{ .Date | time.Format ":date_full" }} | 12 | {{ .Date | time.Format ":date_full" }} |
diff --git a/layouts/book/list.html b/layouts/book/list.html new file mode 100644 index 0000000..628d8b8 --- /dev/null +++ b/layouts/book/list.html | |||
@@ -0,0 +1,33 @@ | |||
1 | {{ define "main" }} | ||
2 | <article> | ||
3 | <h1>{{ .Title }}</h1> | ||
4 | {{ if .Content }} | ||
5 | <p>{{- .Content -}}</p> | ||
6 | {{ end }} | ||
7 | <section> | ||
8 | {{ if .IsSection }} | ||
9 | {{ range sort (.Paginator 3).Pages "Date" "desc" }} | ||
10 | {{ if ne .Layout "list" }} | ||
11 | <div>{{ .Render "summary" }}</div> | ||
12 | {{ end }} | ||
13 | {{ end }} | ||
14 | {{ else }} | ||
15 | {{ $metric := .Params.sortby }} | ||
16 | {{ $direction := "asc" }} | ||
17 | {{ if eq .Params.sortby "rating" }} | ||
18 | {{ $direction = "desc" }} | ||
19 | {{ end }} | ||
20 | {{ $pages := (where .Site.RegularPages "Type" "book") }} | ||
21 | {{ $pages = (where $pages "Layout" "!=" "list")}} | ||
22 | {{ if eq $direction "desc" }} | ||
23 | {{ $pages = (sort ($pages.ByParam $metric).Reverse) }} | ||
24 | {{ else }} | ||
25 | {{ $pages = (sort ($pages.ByParam $metric)) }} | ||
26 | {{ end }} | ||
27 | {{ range $pages }} | ||
28 | <div>{{ .Render "summary" }}</div> | ||
29 | {{ end }} | ||
30 | {{ end }} | ||
31 | </section> | ||
32 | </article> | ||
33 | {{ end }} \ No newline at end of file | ||
diff --git a/layouts/book/single.html b/layouts/book/single.html index 3ffb236..0bbd265 100644 --- a/layouts/book/single.html +++ b/layouts/book/single.html | |||
@@ -4,7 +4,20 @@ | |||
4 | <h4>{{ .Params.author }}</h4> | 4 | <h4>{{ .Params.author }}</h4> |
5 | <h6>{{ .Date | time.Format ":date_full" }}</h6> | 5 | <h6>{{ .Date | time.Format ":date_full" }}</h6> |
6 | {{ if isset .Params "image" }} | 6 | {{ if isset .Params "image" }} |
7 | <img src="{{ .Params.image }}" alt="Book cover of the book {{ .Title }}" /> | 7 | {{ with resources.GetRemote .Params.image }} |
8 | {{ with .Err }} | ||
9 | {{ errorf "%s" . }} | ||
10 | {{ else }} | ||
11 | <img | ||
12 | src="{{ .RelPermalink }}" | ||
13 | width="{{ .Width }}" | ||
14 | height="{{ .Height }}" | ||
15 | alt="Book cover of the book {{ .Title }}" | ||
16 | /> | ||
17 | {{ end }} | ||
18 | {{ else }} | ||
19 | {{ errorf "unable to get remote resource %q" .Params.image }} | ||
20 | {{ end }} | ||
8 | {{ end }} | 21 | {{ end }} |
9 | {{ if isset .Params "amazon" }} | 22 | {{ if isset .Params "amazon" }} |
10 | <p> | 23 | <p> |
diff --git a/layouts/partials/site-actions.html b/layouts/partials/site-actions.html index b9afa66..ac9013a 100644 --- a/layouts/partials/site-actions.html +++ b/layouts/partials/site-actions.html | |||
@@ -1,12 +1,18 @@ | |||
1 | <div id="actions" class="fixed flex row aligned right"> | 1 | <div id="actions" class="fixed flex row aligned right"> |
2 | <button id="darkmode">Dark Mode</button> | 2 | <button id="darkmode"> |
3 | <span class="icon" id="lightmode-icon"> | ||
4 | {{ partial "func/GetSvg" "Lightmode.svg" }} | ||
5 | </span> | ||
6 | <span class="icon hide" id="darkmode-icon"> | ||
7 | {{ partial "func/GetSvg" "Darkmode.svg" }} | ||
8 | </span> | ||
9 | </button> | ||
3 | <button id="fullscreen" class="flex row centered" title="fullscreen toggle"> | 10 | <button id="fullscreen" class="flex row centered" title="fullscreen toggle"> |
4 | <div class="icon" id="fullscreen-icon"> | 11 | <span class="icon" id="fullscreen-icon"> |
5 | {{ partial "func/GetSvg" "Fullscreen.svg" }} | 12 | {{ partial "func/GetSvg" "Fullscreen.svg" }} |
6 | </div> | 13 | </span> |
7 | <div class="icon hide" id="smallscreen-icon"> | 14 | <span class="icon hide" id="smallscreen-icon"> |
8 | {{ partial "func/GetSvg" "Smallscreen.svg" }} | 15 | {{ partial "func/GetSvg" "Smallscreen.svg" }} |
9 | </div> | 16 | </span> |
10 | or [/] | ||
11 | </button> | 17 | </button> |
12 | </div> \ No newline at end of file | 18 | </div> \ No newline at end of file |