mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-08 17:15: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
|
||||
date: 2024-03-07T10:17:40.792Z
|
||||
publishDate: 2024-03-07T10:17:40.792Z
|
||||
references: {}
|
||||
tags:
|
||||
- ThisIsMyJam
|
||||
- music
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<figure class="film">
|
||||
<a href="{{ .url }}" target="_blank" title="Open film details">
|
||||
<figure class="film" itemscope itemtype="https://schema.org/Movie">
|
||||
<a href="{{ .url }}" target="_blank" title="Open film details" itemprop="url">
|
||||
{{ $title := .title }}
|
||||
{{ 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}}
|
||||
</a>
|
||||
|
||||
<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>
|
||||
</figure>
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
{{/* Return empty object while OpenLibrary is down. I need something more robust here! */}}
|
||||
{{ return dict }}
|
||||
{{/*
|
||||
{{- $path := .path -}}
|
||||
{{- $isbn := "" -}}
|
||||
{{- $key := "" -}}
|
||||
|
@ -85,4 +82,3 @@
|
|||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- return $book -}}
|
||||
*/}}
|
|
@ -1,11 +1,11 @@
|
|||
{{- define "partials/author-list.html" -}}
|
||||
{{- $authors := . -}}
|
||||
{{- 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 " -}}
|
||||
{{- 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>
|
||||
<a href="{{ $a.url }}" target="_blank" itemprop="url"><span itemprop="name">{{ $a.name }}</span></a>
|
||||
{{- if ne (add $i 1) (len $authors) -}}, {{ end -}}
|
||||
{{- end -}}
|
||||
</span>
|
||||
|
@ -16,21 +16,21 @@
|
|||
{{- $book := partial "openlibrary.obj" (dict "path" .Page.Path "id" (.Get 0)) -}}
|
||||
{{- with $book -}}
|
||||
{{- if and $showCover .cover -}}
|
||||
<figure class="book">
|
||||
<a href="{{ .url }}" target="_blank" title="Open book details">
|
||||
<figure class="book" itemscope itemtype="https://schema.org/Book">
|
||||
<a href="{{ .url }}" target="_blank" title="Open book details" itemprop="url">
|
||||
{{- $title := .title -}}
|
||||
{{- 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 -}}
|
||||
</a>
|
||||
|
||||
<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 -}}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- 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 -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
{{- range .links -}}
|
||||
{{- $u := urls.Parse . -}}
|
||||
|
||||
{{- if eq $u.Hostname "sopen.spotify.com" -}}
|
||||
{{- if eq $u.Hostname "open.spotify.com" -}}
|
||||
{{- $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 -}}
|
||||
|
||||
{{- else if eq $u.Hostname "smusic.apple.com" -}}
|
||||
{{- else if eq $u.Hostname "music.apple.com" -}}
|
||||
{{- $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 -}}
|
||||
|
||||
{{- else if and (eq $u.Hostname "soundcloud.com") (isset $data "soundcloudtrackid") -}}
|
||||
|
@ -28,11 +28,11 @@
|
|||
|
||||
{{- end -}}
|
||||
|
||||
<figure class="embed audio {{$klass}}">
|
||||
<figure class="embed audio {{$klass}}" itemscope itemtype="https://schema.org/MusicRecording">
|
||||
{{ $embed | safeHTML }}
|
||||
<figcaption>
|
||||
🎶 {{ $displayArtist }}{{ with $displayTitle }}{{ if $displayArtist }}: {{ end }}<em>{{ . }}</em>{{ end }}<br/>
|
||||
{{ with $musicbrainz }}<a href="{{ . }}" target="_blank" style="font-style:italic;">Listen elsewhere</a>{{ end }}
|
||||
🎶 <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;" itemprop="url">Listen elsewhere</a>{{ end }}
|
||||
</figcaption>
|
||||
</figure>
|
||||
{{- else -}}
|
||||
|
|
Loading…
Reference in a new issue