From fb8b2afef89aba7a8e10fb81fa73612691ba2b97 Mon Sep 17 00:00:00 2001 From: Bill Stumbo Date: Fri, 5 Jun 2026 21:29:20 -0400 Subject: [PATCH 1/2] Update bibliographies to include additional metadaa. Metadata is encoded as JSON-LD and provides information for Google and other search engines. A first step in enabling richer data in our searches. --- layouts/_partials/bibliography-json-ld.html | 290 ++++++++++++++++++++ layouts/_partials/hooks/head-end.html | 1 + 2 files changed, 291 insertions(+) create mode 100644 layouts/_partials/bibliography-json-ld.html diff --git a/layouts/_partials/bibliography-json-ld.html b/layouts/_partials/bibliography-json-ld.html new file mode 100644 index 00000000..b466452f --- /dev/null +++ b/layouts/_partials/bibliography-json-ld.html @@ -0,0 +1,290 @@ +{{- /* + bibliography-json-ld.html + Emits a + +{{- else if .IsSection -}} + +{{- /* ── COLLECTION PAGE (bibliography index) ──────────────────────────── */ -}} +{{- $pages := .RegularPages -}} +{{- $pages = sort $pages "Date" "desc" -}} +{{- $pages = sort $pages "Title" "asc" -}} + +{{- $itemList := slice -}} +{{- range $i, $p := $pages -}} + {{- $itemList = append (dict + "@type" "ListItem" + "position" (add $i 1) + "name" $p.Title + "url" $p.Permalink + ) $itemList -}} +{{- end -}} + +{{- $desc := .Description | default "A bibliography of publications, patents, reports, and other artifacts related to the Interlisp programming environment." -}} + +{{- $ld := dict + "@context" "https://schema.org" + "@type" "CollectionPage" + "name" .Title + "url" .Permalink + "description" $desc + "inLanguage" "en-US" + "mainEntity" (dict + "@type" "ItemList" + "name" .Title + "numberOfItems" (len $pages) + "itemListElement" $itemList + ) +-}} + + + +{{- end -}} + +{{- end -}} diff --git a/layouts/_partials/hooks/head-end.html b/layouts/_partials/hooks/head-end.html index 9daa28c0..f800ce9f 100644 --- a/layouts/_partials/hooks/head-end.html +++ b/layouts/_partials/hooks/head-end.html @@ -1,2 +1,3 @@ +{{ partial "bibliography-json-ld.html" . }} From 3940d92b1e4c1ed7352355758eaee3c194e31002 Mon Sep 17 00:00:00 2001 From: Bill Stumbo Date: Thu, 18 Jun 2026 23:21:03 -0400 Subject: [PATCH 2/2] Clean up book metadata. - Remove incorrect usage of locationCreated field - Fix formatting of titles. Remove newline character at end of string --- layouts/_partials/bibliography-json-ld.html | 3 --- scripts/bibSplit.pl | 8 +++++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/layouts/_partials/bibliography-json-ld.html b/layouts/_partials/bibliography-json-ld.html index b466452f..b83b770f 100644 --- a/layouts/_partials/bibliography-json-ld.html +++ b/layouts/_partials/bibliography-json-ld.html @@ -172,9 +172,6 @@ {{- with .Params.publisher -}} {{- $ld = merge $ld (dict "publisher" (dict "@type" "Organization" "name" .)) -}} {{- end -}} - {{- with .Params.place -}} - {{- $ld = merge $ld (dict "locationCreated" .) -}} - {{- end -}} {{- end -}} {{- /* ── Chapter ──────────────────────────────────────────────────────── */ -}} diff --git a/scripts/bibSplit.pl b/scripts/bibSplit.pl index 8a9b77be..97356543 100755 --- a/scripts/bibSplit.pl +++ b/scripts/bibSplit.pl @@ -58,10 +58,12 @@ sub sanitize_text { my $type = $obj->{type} // ''; - # Titles can have colons and other special characters. Place YAML keyword on one line - # and follow it with the title indented on subsequent line + # Titles can have colons and other special characters. Use a YAML double-quoted scalar + # so the decoded value has no trailing newline (the literal-block `|` style would add one). my $itemTitle = sanitize_text($obj->{title} // ''); - my $title = $itemTitle eq '' ? "title: ''" : "title: |\n $itemTitle\n"; + (my $escapedTitle = $itemTitle) =~ s/\\/\\\\/g; + $escapedTitle =~ s/"/\\"/g; + my $title = $itemTitle eq '' ? "title: ''" : "title: \"$escapedTitle\""; # Abstracts can be multi-line and contain multiple paragraphs. Place YAML keyword on # one line and follow it with the abstract indented on subsequent lines.