diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 39eb64ce..8fd90ea6 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -30,9 +30,9 @@ jobs: build: runs-on: ubuntu-latest env: - HUGO_VERSION: 0.140.2 + HUGO_VERSION: 0.147.4 PAGEFIND_VERSION: 1.3.0 - TASK_VERSION: 3.40.1 + TASK_VERSION: 3.43.3 steps: - name: Install Hugo CLI run: | diff --git a/layouts/_default/list.opml.xml b/layouts/_default/list.opml.xml index 23ff5390..d76aed3f 100644 --- a/layouts/_default/list.opml.xml +++ b/layouts/_default/list.opml.xml @@ -8,7 +8,7 @@ {{ range .Pages -}} - + {{ end -}} diff --git a/layouts/partials/claps.html b/layouts/partials/claps.html index 8b08c022..63d07c5c 100644 --- a/layouts/partials/claps.html +++ b/layouts/partials/claps.html @@ -6,14 +6,16 @@ {{- partialCached "svg.html" (dict "name" $style) $style -}} {{- $url := printf "https://%s" site.Params.clapsHost -}} {{- $cacheKey := print $url (now.Format "-2006-01-02-15") -}} - {{- with resources.GetRemote $url (dict "key" $cacheKey) -}} + {{- with try (resources.GetRemote $url (dict "key" $cacheKey)) -}} {{- with .Err -}} {{- errorf "%s" . -}} - {{- else -}} + {{ else with .Value }} {{- $data := .Content | transform.Unmarshal -}} {{- $clapCount := (index $data $relperma) | default 0 -}} {{- $totalCount := add (int $interactionCount) (int $clapCount) -}} {{- with $totalCount }}{{ . }}{{ end -}} + {{ else }} + {{ errorf "Unable to get remote resource %q" $url }} {{- end -}} {{- else -}} {{- errorf "Unable to get all clap counts" -}} diff --git a/layouts/partials/interactions.html b/layouts/partials/interactions.html index 04f18064..1ad3a4f0 100644 --- a/layouts/partials/interactions.html +++ b/layouts/partials/interactions.html @@ -40,7 +40,7 @@ {{- $count := len $items -}} {{- if gt $count 0 -}}
  • - {{ partial "partials/reactionsvg.html" (dict "emoji" $thisEm) }} + {{ template "partials/reactionsvg.html" (dict "emoji" $thisEm) }} {{ $count }}
  • {{ end }} @@ -63,7 +63,7 @@ {{- range $thisEm, $items := $interactionMap -}} {{- if ne $thisEm "💬" -}}
  • - {{ partial "partials/reactionsvg.html" (dict "emoji" $thisEm "name" true) -}} + {{ template "partials/reactionsvg.html" (dict "emoji" $thisEm "name" true) -}} {{- range $i, $in := $items -}} {{ $in.author.name | replaceRE `(\?\x{200D}?){2,}` "" | strings.TrimSpace }} {{- if ne $i (sub (len $items) 1) }}, {{ end -}} diff --git a/layouts/partials/openlibrary.obj b/layouts/partials/openlibrary.obj index 751fcb31..3c42959c 100644 --- a/layouts/partials/openlibrary.obj +++ b/layouts/partials/openlibrary.obj @@ -14,14 +14,16 @@ {{- if not $key -}} {{- $query := (dict "type" "/type/edition" "isbn_13" $isbn) | jsonify -}} - {{- with resources.GetRemote (printf "https://openlibrary.org/api/things?query=%s" ($query)) -}} + {{- with try (resources.GetRemote (printf "https://openlibrary.org/api/things?query=%s" ($query))) -}} {{- with .Err -}} {{- errorf "Error grabbing Thing from OpenLibrary: %v" . -}} - {{- else -}} + {{- else with .Value -}} {{- $thing := .Content | transform.Unmarshal -}} {{- if and (eq $thing.status "ok") (ge (len $thing.result) 1) -}} {{- $key = index $thing.result 0 -}} {{- end -}} + {{- else -}} + {{- errorf "Error grabbing Thing from OpenLibrary" -}} {{- end -}} {{- else -}} {{- errorf "Failed to fetch ISBN data from OpenLibrary: %s" $isbn -}} @@ -29,26 +31,28 @@ {{- end -}} {{- if $key -}} - {{- with resources.GetRemote (printf "https://openlibrary.org/api/get?key=%s" $key) -}} + {{- with try (resources.GetRemote (printf "https://openlibrary.org/api/get?key=%s" $key)) -}} {{- with .Err -}} {{- errorf "Error grabbing Book data from OpenLibrary: %v" . -}} - {{- else -}} + {{- else with .Value -}} {{- $bookObj := .Content | transform.Unmarshal -}} {{- if eq $bookObj.status "ok" -}} {{- $isbn = index $bookObj.result.isbn_13 0 -}} {{- $authors := slice -}} {{- range $bookObj.result.authors -}} - {{- with resources.GetRemote (printf "https://openlibrary.org/api/get?key=%s" .key) -}} + {{- with try (resources.GetRemote (printf "https://openlibrary.org/api/get?key=%s" .key)) -}} {{- with .Err -}} {{- errorf "Error grabbing Author data from OpenLibrary: %v" . -}} - {{- else -}} + {{- else with .Value -}} {{- $authorObj := .Content | transform.Unmarshal -}} {{- if eq $authorObj.status "ok" -}} {{- $authors = $authors | append (dict "name" $authorObj.result.name "url" (printf "https://openlibrary.org%s" $authorObj.result.key)) -}} {{- else -}} {{- errorf "OpenLibrary response was %s while fetching author data: %s" $authorObj.status .key -}} {{- end -}} + {{- else -}} + {{- errorf "Error grabbing Author data from OpenLibrary" -}} {{- end -}} {{- else -}} {{- warnf "Failed to fetch Author data from OpenLibrary: %s" .key -}} @@ -64,9 +68,9 @@ {{- $bookFilename := replaceRE `[^a-z]+` "-" (lower $bookObj.result.title) -}} {{- $coverPath := replaceRE `(\.md)?$` (printf "/%s.jpg" $bookFilename) $path -}} - {{- with resources.GetRemote $coverURL -}} + {{- with try (resources.GetRemote $coverURL) -}} {{- with .Err -}} - {{- else -}} + {{- else with .Value -}} {{- $cover = .Content | resources.FromString $coverPath -}} {{- end -}} {{- end -}} @@ -76,6 +80,8 @@ {{- else -}} {{- errorf "OpenLibrary response was %s while fetching: %s" $bookObj $key -}} {{- end -}} + {{- else -}} + {{- errorf "Error grabbing Book data from OpenLibrary" -}} {{- end -}} {{- else -}} {{- errorf "Failed to fetch Book data data from OpenLibrary: %s" $key -}} diff --git a/layouts/partials/page-title.txt b/layouts/partials/page-title.txt index e77b5ff3..095d7321 100644 --- a/layouts/partials/page-title.txt +++ b/layouts/partials/page-title.txt @@ -8,7 +8,7 @@ {{- if $ref -}} Comments on '{{ $ref.name }}' {{- else -}} - {{- partial "partials/fallback-title.txt" . -}} + {{- template "partials/fallback-title.txt" . -}} {{- end -}} {{- else if .Params.likeOf -}} {{- $ref := partial "reference.obj" (dict "url" .Params.likeOf "references" .Params.references) -}} @@ -16,11 +16,11 @@ {{- with index (split $ref.name "|" | first 1) 0 -}} {{- . -}} {{- else -}} - {{- partial "partials/fallback-title.txt" . -}} + {{- template "partials/fallback-title.txt" . -}} {{- end -}} {{- else -}} - {{- partial "partials/fallback-title.txt" . -}} + {{- template "partials/fallback-title.txt" . -}} {{- end -}} {{- else -}} - {{- partial "partials/fallback-title.txt" . -}} + {{- template "partials/fallback-title.txt" . -}} {{- end -}} \ No newline at end of file diff --git a/layouts/shortcodes/book.html b/layouts/shortcodes/book.html index 5587eb66..5c969fa5 100644 --- a/layouts/shortcodes/book.html +++ b/layouts/shortcodes/book.html @@ -26,11 +26,11 @@
    - {{- partial "partials/author-list.html" .authors -}} + {{- template "partials/author-list.html" .authors -}}
    {{- else -}} {{ .title }} - {{- partial "partials/author-list.html" .authors -}} + {{- template "partials/author-list.html" .authors -}} {{- end -}} {{- end -}} diff --git a/layouts/shortcodes/topclaps.gmi b/layouts/shortcodes/topclaps.gmi index 9acc093f..90a1cc58 100644 --- a/layouts/shortcodes/topclaps.gmi +++ b/layouts/shortcodes/topclaps.gmi @@ -1,10 +1,10 @@ {{- $count := .Get 0 | default 5 -}} {{- $url := printf "https://%s" site.Params.clapsHost -}} {{- $cacheKey := print $url (now.Format "-2006-01-02-15") -}} -{{- with resources.GetRemote $url (dict "key" $cacheKey) -}} +{{- with try (resources.GetRemote $url (dict "key" $cacheKey)) -}} {{- with .Err -}} - {{- errorf "%s" . -}} - {{- else -}} + {{- errorf "Unable to get top claps: %v" . -}} + {{- else with .Value -}} {{- $data := .Content | transform.Unmarshal -}} {{- $claps := slice -}} {{- range $path, $count := $data -}} @@ -17,6 +17,8 @@ => {{.RelPermalink}} {{ with .Params.emoji }}{{ . }} {{ end}}{{ with .Title -}}{{ . }}{{ else }}{{ .Type | singularize | title }}{{ end }} ({{ $count }}) {{- end -}} {{- end }} + {{- else -}} + {{- errorf "Unable to get top claps" -}} {{- end -}} {{- else -}} {{- errorf "Unable to get all clap counts" -}} diff --git a/layouts/shortcodes/topclaps.html b/layouts/shortcodes/topclaps.html index bf2ea432..9166fcb9 100644 --- a/layouts/shortcodes/topclaps.html +++ b/layouts/shortcodes/topclaps.html @@ -1,10 +1,10 @@ {{- $count := .Get 0 | default 5 -}} {{- $url := printf "https://%s" site.Params.clapsHost -}} {{- $cacheKey := print $url (now.Format "-2006-01-02-15") -}} -{{- with resources.GetRemote $url (dict "key" $cacheKey) -}} +{{- with try (resources.GetRemote $url (dict "key" $cacheKey)) -}} {{- with .Err -}} - {{- errorf "%s" . -}} - {{- else -}} + {{- errorf "Unable to get top claps: %v" . -}} + {{- else with .Value -}} {{- $data := .Content | transform.Unmarshal -}} {{- $claps := slice -}} {{- range $path, $count := $data -}} @@ -37,6 +37,8 @@ } } + {{- else -}} + {{- errorf "Unable to get top claps" -}} {{- end -}} {{- else -}} {{- errorf "Unable to get all clap counts" -}}