mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 22:16:07 +01:00
Add two quotes & fix books
This commit is contained in:
parent
74a674d8a6
commit
679aa7890f
6 changed files with 67 additions and 52 deletions
|
@ -285,23 +285,8 @@
|
|||
height: auto;
|
||||
}
|
||||
|
||||
.authors {
|
||||
&:has(a)::before {
|
||||
content: ' by ';
|
||||
}
|
||||
a {
|
||||
&::after {
|
||||
content: ', ';
|
||||
}
|
||||
|
||||
&:nth-last-child(2)::after {
|
||||
content: ', and ';
|
||||
}
|
||||
|
||||
&:last-child::after {
|
||||
content: '';
|
||||
}
|
||||
}
|
||||
.authors.list {
|
||||
display:block;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
10
content/notes/adventure.md
Normal file
10
content/notes/adventure.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
title: "Adventure"
|
||||
date: 2022-01-29T10:49:39Z
|
||||
tags:
|
||||
- quote
|
||||
---
|
||||
|
||||
> \[They] flock, beckoned by adventure \[…] it calls to those who care more for living than for their lives.
|
||||
|
||||
From {{< openlibrary "9781534430990" false >}}.
|
10
content/notes/good-morning.md
Normal file
10
content/notes/good-morning.md
Normal file
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
title: "Good morning"
|
||||
date: 2021-11-21T20:50:00Z
|
||||
tags:
|
||||
- quote
|
||||
---
|
||||
|
||||
What a beautiful quote from {{< openlibrary "9781786699602" false >}}:
|
||||
|
||||
> \[…] greeting even our dearest with abbreviations like ‘Good morning’ when the true thought in our breast is ‘Every day you step into my life, you make it brighter, and if you left the world, something in me would starve for you forever, as when some barrier rises to shade a plant, which still has light enough to grow some but will never again taste the unbroken sun.’
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
date: "2022-02-14T11:50:50Z"
|
||||
tags:
|
||||
- imported
|
||||
- from-twitter
|
||||
in_reply_to: ../1493190833918644224
|
||||
---
|
||||
[@mhudack](https://twitter.com/mhudack) No collaboration that I know of though ☹️
|
|
@ -1,17 +1,32 @@
|
|||
<figure class="book">
|
||||
<a href="{{ .url }}" target="_blank" title="Open book details">
|
||||
{{ $title := .title }}
|
||||
{{ with .cover }}
|
||||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="The cover of the book {{ $title }}">
|
||||
{{ end}}
|
||||
</a>
|
||||
{{- define "partials/author-list.html" -}}
|
||||
{{- $authors := . -}}
|
||||
{{- if and (ne $authors nil) (gt (len $authors) 0) -}}
|
||||
<span class="authors list">
|
||||
{{ " by " }}
|
||||
{{- range $i, $a := $authors -}}
|
||||
{{- if and (ne $i 0) (eq (add $i 1) (len $authors)) -}}and {{ end -}}
|
||||
<a href="{{ $a.url }}" target="_blank">{{ $a.name }}</a>
|
||||
{{- if ne (add $i 1) (len $authors) -}}, {{ end -}}
|
||||
{{- end -}}
|
||||
</span>
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
<figcaption>
|
||||
<a href="{{ .url }}" target="_blank" title="Open book details">{{ .title }}</a><br />
|
||||
<span class="authors">
|
||||
{{ range .authors }}
|
||||
<a href="{{ .url }}" target="_blank">{{ .name }}</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- if .cover -}}
|
||||
<figure class="book">
|
||||
<a href="{{ .url }}" target="_blank" title="Open book details">
|
||||
{{- $title := .title -}}
|
||||
{{- with .cover -}}
|
||||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="The cover of the book {{ $title }}">
|
||||
{{- end -}}
|
||||
</a>
|
||||
|
||||
<figcaption>
|
||||
<a href="{{ .url }}" target="_blank" title="Open book details">{{ .title }}</a>
|
||||
{{- partial "partials/author-list.html" .authors -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
<a href="{{ .url }}" target="_blank" title="Open book details">{{ .title }}</a>
|
||||
{{- partial "partials/author-list.html" .authors -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{{ $path := .Page.Path }}
|
||||
{{ $isbn := "" }}
|
||||
{{ $key := "" }}
|
||||
{{ $showCover := ne (.Get 1) false }}
|
||||
|
||||
{{ with .Get 0 }}
|
||||
{{ if eq (len .) 13 }}
|
||||
|
@ -53,18 +54,20 @@
|
|||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ $coverURL := (printf "https://covers.openlibrary.org/b/isbn/%s-M.jpg" $isbn)}}
|
||||
{{ if not $isbn }}
|
||||
{{ $coverURL = printf "https://covers.openlibrary.org/b/id/%.0f-M.jpg" (index $bookObj.result.covers 0) }}
|
||||
{{ end }}
|
||||
|
||||
{{- $bookFilename := replaceRE `[^a-z]+` "-" (lower $bookObj.result.title) -}}
|
||||
{{- $coverPath := replaceRE `(\.md)?$` (printf "/%s.jpg" $bookFilename) $path -}}
|
||||
{{ $cover := "" }}
|
||||
{{ with resources.GetRemote $coverURL }}
|
||||
{{ with .Err }}
|
||||
{{ else }}
|
||||
{{ $cover = .Content | resources.FromString $coverPath }}
|
||||
{{ if $showCover }}
|
||||
{{ $coverURL := (printf "https://covers.openlibrary.org/b/isbn/%s-M.jpg" $isbn)}}
|
||||
{{ if not $isbn }}
|
||||
{{ $coverURL = printf "https://covers.openlibrary.org/b/id/%.0f-M.jpg" (index $bookObj.result.covers 0) }}
|
||||
{{ end }}
|
||||
|
||||
{{- $bookFilename := replaceRE `[^a-z]+` "-" (lower $bookObj.result.title) -}}
|
||||
{{- $coverPath := replaceRE `(\.md)?$` (printf "/%s.jpg" $bookFilename) $path -}}
|
||||
{{ with resources.GetRemote $coverURL }}
|
||||
{{ with .Err }}
|
||||
{{ else }}
|
||||
{{ $cover = .Content | resources.FromString $coverPath }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
|
|
Loading…
Reference in a new issue