mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 01:35:56 +01:00
Add Schema.org itemprops
Also re-enables openlibrary parsing.
This commit is contained in:
parent
51dcfb243c
commit
ffd9ef9447
5 changed files with 18 additions and 23 deletions
|
@ -3,7 +3,6 @@ title: Peach (by salute) is my jam
|
||||||
type: like
|
type: like
|
||||||
date: 2024-03-07T10:17:40.792Z
|
date: 2024-03-07T10:17:40.792Z
|
||||||
publishDate: 2024-03-07T10:17:40.792Z
|
publishDate: 2024-03-07T10:17:40.792Z
|
||||||
references: {}
|
|
||||||
tags:
|
tags:
|
||||||
- ThisIsMyJam
|
- ThisIsMyJam
|
||||||
- music
|
- music
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<figure class="film">
|
<figure class="film" itemscope itemtype="https://schema.org/Movie">
|
||||||
<a href="{{ .url }}" target="_blank" title="Open film details">
|
<a href="{{ .url }}" target="_blank" title="Open film details" itemprop="url">
|
||||||
{{ $title := .title }}
|
{{ $title := .title }}
|
||||||
{{ with .cover }}
|
{{ with .cover }}
|
||||||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="The poster for the film {{ $title }}">
|
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="The poster for the film {{ $title }}" itemprop="image">
|
||||||
{{ end}}
|
{{ end}}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<figcaption>
|
<figcaption>
|
||||||
<a href="{{ .url }}" target="_blank" title="Open film details">{{ .title }}</a> ({{ .year }})
|
<a href="{{ .url }}" target="_blank" title="Open film details" itemprop="url"><span itemprop="name">{{ .title }}</span></a> (<span itemprop="datePublished">{{ .year }}</span>)
|
||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
{{/* Return empty object while OpenLibrary is down. I need something more robust here! */}}
|
|
||||||
{{ return dict }}
|
|
||||||
{{/*
|
|
||||||
{{- $path := .path -}}
|
{{- $path := .path -}}
|
||||||
{{- $isbn := "" -}}
|
{{- $isbn := "" -}}
|
||||||
{{- $key := "" -}}
|
{{- $key := "" -}}
|
||||||
|
@ -85,4 +82,3 @@
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- return $book -}}
|
{{- return $book -}}
|
||||||
*/}}
|
|
|
@ -1,11 +1,11 @@
|
||||||
{{- define "partials/author-list.html" -}}
|
{{- define "partials/author-list.html" -}}
|
||||||
{{- $authors := . -}}
|
{{- $authors := . -}}
|
||||||
{{- if and (ne $authors nil) (gt (len $authors) 0) -}}
|
{{- if and (ne $authors nil) (gt (len $authors) 0) -}}
|
||||||
<span class="authors list">
|
<span class="authors list" itemprop="author" itemscope itemtype="https://schema.org/Person">
|
||||||
{{- " by " -}}
|
{{- " by " -}}
|
||||||
{{- range $i, $a := $authors -}}
|
{{- range $i, $a := $authors -}}
|
||||||
{{- if and (ne $i 0) (eq (add $i 1) (len $authors)) -}}and {{ end -}}
|
{{- if and (ne $i 0) (eq (add $i 1) (len $authors)) -}}and {{ end -}}
|
||||||
<a href="{{ $a.url }}" target="_blank">{{ $a.name }}</a>
|
<a href="{{ $a.url }}" target="_blank" itemprop="url"><span itemprop="name">{{ $a.name }}</span></a>
|
||||||
{{- if ne (add $i 1) (len $authors) -}}, {{ end -}}
|
{{- if ne (add $i 1) (len $authors) -}}, {{ end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</span>
|
</span>
|
||||||
|
@ -16,21 +16,21 @@
|
||||||
{{- $book := partial "openlibrary.obj" (dict "path" .Page.Path "id" (.Get 0)) -}}
|
{{- $book := partial "openlibrary.obj" (dict "path" .Page.Path "id" (.Get 0)) -}}
|
||||||
{{- with $book -}}
|
{{- with $book -}}
|
||||||
{{- if and $showCover .cover -}}
|
{{- if and $showCover .cover -}}
|
||||||
<figure class="book">
|
<figure class="book" itemscope itemtype="https://schema.org/Book">
|
||||||
<a href="{{ .url }}" target="_blank" title="Open book details">
|
<a href="{{ .url }}" target="_blank" title="Open book details" itemprop="url">
|
||||||
{{- $title := .title -}}
|
{{- $title := .title -}}
|
||||||
{{- with .cover -}}
|
{{- with .cover -}}
|
||||||
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="The cover of the book {{ $title }}">
|
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="The cover of the book {{ $title }}" itemprop="image">
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<figcaption>
|
<figcaption>
|
||||||
<cite><a href="{{ .url }}" target="_blank" title="Open book details">{{ .title }}</a></cite>
|
<cite><a href="{{ .url }}" target="_blank" title="Open book details" itemprop="url"><span itemprop="name">{{ .title }}</span></a></cite>
|
||||||
{{- partial "partials/author-list.html" .authors -}}
|
{{- partial "partials/author-list.html" .authors -}}
|
||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
<cite><a href="{{ .url }}" target="_blank" title="Open book details">{{ .title }}</a></cite>
|
<cite><a href="{{ .url }}" target="_blank" title="Open book details" itemprop="name">{{ .title }}</a></cite>
|
||||||
{{- partial "partials/author-list.html" .authors -}}
|
{{- partial "partials/author-list.html" .authors -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
{{- range .links -}}
|
{{- range .links -}}
|
||||||
{{- $u := urls.Parse . -}}
|
{{- $u := urls.Parse . -}}
|
||||||
|
|
||||||
{{- if eq $u.Hostname "sopen.spotify.com" -}}
|
{{- if eq $u.Hostname "open.spotify.com" -}}
|
||||||
{{- $klass = "spotify" -}}
|
{{- $klass = "spotify" -}}
|
||||||
{{- $embed = printf "<iframe src='https://open.spotify.com/embed%s' height='80' frameBorder='0' allowfullscreen=' allow='autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture' loading='lazy'></iframe>" $u.Path -}}
|
{{- $embed = printf "<iframe src='https://open.spotify.com/embed%s' height='80' frameBorder='0' allowfullscreen allow='autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture' loading='lazy'></iframe>" $u.Path -}}
|
||||||
{{- break -}}
|
{{- break -}}
|
||||||
|
|
||||||
{{- else if eq $u.Hostname "smusic.apple.com" -}}
|
{{- else if eq $u.Hostname "music.apple.com" -}}
|
||||||
{{- $klass = "apple-music" -}}
|
{{- $klass = "apple-music" -}}
|
||||||
{{- $embed = printf "<iframe allow='autoplay *; encrypted-media *; fullscreen *; clipboard-write' frameborder='0' height='160' style='width:100%%;max-width:660px;overflow:hidden;border-radius:10px;' sandbox='allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation' src='https://embed.music.apple.com%s'></iframe>" $u.Path -}}
|
{{- $embed = printf "<iframe allow='autoplay *; encrypted-media *; fullscreen *; clipboard-write' frameborder='0' height='160' style='width:100%;max-width:660px;overflow:hidden;border-radius:10px;' sandbox='allow-forms allow-popups allow-same-origin allow-scripts allow-storage-access-by-user-activation allow-top-navigation-by-user-activation' src='https://embed.music.apple.com%s'></iframe>" $u.Path -}}
|
||||||
{{- break -}}
|
{{- break -}}
|
||||||
|
|
||||||
{{- else if and (eq $u.Hostname "soundcloud.com") (isset $data "soundcloudtrackid") -}}
|
{{- else if and (eq $u.Hostname "soundcloud.com") (isset $data "soundcloudtrackid") -}}
|
||||||
|
@ -28,11 +28,11 @@
|
||||||
|
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
<figure class="embed audio {{$klass}}">
|
<figure class="embed audio {{$klass}}" itemscope itemtype="https://schema.org/MusicRecording">
|
||||||
{{ $embed | safeHTML }}
|
{{ $embed | safeHTML }}
|
||||||
<figcaption>
|
<figcaption>
|
||||||
🎶 {{ $displayArtist }}{{ with $displayTitle }}{{ if $displayArtist }}: {{ end }}<em>{{ . }}</em>{{ end }}<br/>
|
🎶 <span itemprop="byArtist" itemscope itemtype="https://schema.org/MusicGroup"><span itemprop="name">{{ $displayArtist }}</span></span>{{ with $displayTitle }}{{ if $displayArtist }}: {{ end }}<em itemprop="name">{{ . }}</em>{{ end }}<br/>
|
||||||
{{ with $musicbrainz }}<a href="{{ . }}" target="_blank" style="font-style:italic;">Listen elsewhere</a>{{ end }}
|
{{ with $musicbrainz }}<a href="{{ . }}" target="_blank" style="font-style:italic;" itemprop="url">Listen elsewhere</a>{{ end }}
|
||||||
</figcaption>
|
</figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
|
|
Loading…
Reference in a new issue