diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 29586aa..c122e26 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -37,7 +37,7 @@ jobs: - name: Setup Hugo env: - HUGO_VERSION: 0.105.0 + HUGO_VERSION: 0.143.1 run: | curl -L "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.tar.gz" --output hugo.tar.gz tar -xvzf hugo.tar.gz diff --git a/static/data/toots/fosstodon-org-108222429500713598.json b/assets/data/toots/fosstodon-org-108222429500713598.json similarity index 100% rename from static/data/toots/fosstodon-org-108222429500713598.json rename to assets/data/toots/fosstodon-org-108222429500713598.json diff --git a/static/data/toots/fosstodon-org-108269796505838110.json b/assets/data/toots/fosstodon-org-108269796505838110.json similarity index 100% rename from static/data/toots/fosstodon-org-108269796505838110.json rename to assets/data/toots/fosstodon-org-108269796505838110.json diff --git a/static/data/toots/fosstodon-org-108334900197768307.json b/assets/data/toots/fosstodon-org-108334900197768307.json similarity index 100% rename from static/data/toots/fosstodon-org-108334900197768307.json rename to assets/data/toots/fosstodon-org-108334900197768307.json diff --git a/static/data/toots/mastodon-online-108307925251519968.json b/assets/data/toots/mastodon-online-108307925251519968.json similarity index 100% rename from static/data/toots/mastodon-online-108307925251519968.json rename to assets/data/toots/mastodon-online-108307925251519968.json diff --git a/config.toml b/config.toml index 4057c34..1a1a37a 100644 --- a/config.toml +++ b/config.toml @@ -3,7 +3,9 @@ languageCode = "en-us" title = "Brandon Rozek" theme = "pulp" enableGitInfo = true -ignoreErrors = ["error-remote-getjson"] + +[security.http] +mediaTypes = ['^application/json'] [taxonomies] series = "series" diff --git a/content/blog/displaying-a-toot-hugo.md b/content/blog/displaying-a-toot-hugo.md index 11781d3..df7da06 100644 --- a/content/blog/displaying-a-toot-hugo.md +++ b/content/blog/displaying-a-toot-hugo.md @@ -204,7 +204,17 @@ We'll have to add the following contents to `theme/layouts/shortcodes/displayOnl {{ $url := urls.Parse (.Get 0) }} {{ $status_id := index (last 1 (split $url.Path "/")) 0 }} {{ $api_url := printf "%s://%s/api/v1/statuses/%s" $url.Scheme $url.Host $status_id }} -{{ $dataJ := getJSON $api_url }} +{{ $dataJ := dict }} +{{ $url := $api_url }} +{{ with try (resources.GetRemote $url) }} + {{ with .Err }} + {{ errorf "Unable to get remote resource %s: %s" $url . }} + {{ else with .Value }} + {{ $dataJ = . | transform.Unmarshal }} + {{ else }} + {{ errorf "Unable to get remote resource %s" $url }} + {{ end }} +{{ end }} {{ with $dataJ }} {{ if ne .content "" }} diff --git a/content/blog/syndicating-hugo-to-medium.md b/content/blog/syndicating-hugo-to-medium.md index 8faf2ba..e8413c1 100644 --- a/content/blog/syndicating-hugo-to-medium.md +++ b/content/blog/syndicating-hugo-to-medium.md @@ -49,7 +49,7 @@ medium_enabled: false "icon": "{{ .Site.BaseURL }}img/{{ .Site.Params.avatar }}", "language": "en-US", "authors": [ - {{with $.Site.Author.name }} + {{with $.Site.Params.name }} { "name": "{{ . }}" } {{ end }} ], @@ -71,7 +71,7 @@ My `list.json.json` follows the [JSON Feed](https://jsonfeed.org/) specification "url": "{{ .Permalink }}", "title": {{ .Title | jsonify }}, "authors": [ - {{with $.Site.Author.name }} + {{with $.Site.Params.Author }} { "name": "{{ . }}" } {{ end }} ], diff --git a/content/paper/2006.01.md b/content/paper/2006.01.md index e453204..28ef53f 100644 --- a/content/paper/2006.01.md +++ b/content/paper/2006.01.md @@ -7,7 +7,7 @@ authors: [ "Veena Ravishankar", "Brandon Rozek" ] -date: 2020-06 +date: 2020-06-01 publish_date: "2020/6" conference: "International Workshop on Unification" firstpage: 58 diff --git a/content/paper/2207.01.md b/content/paper/2207.01.md index 2392ab2..e233100 100644 --- a/content/paper/2207.01.md +++ b/content/paper/2207.01.md @@ -7,7 +7,7 @@ authors: [ "Selmer Bringsjord", "Naveen Sundar Govindarajulu" ] -date: 2022-07 +date: 2022-07-01 publish_date: "2022/07" conference: "International Conference on Robot Ethics and Standards" isbn: "978-1-7396142-0-1" diff --git a/content/postroll/_content.gotmpl b/content/postroll/_content.gotmpl new file mode 100644 index 0000000..b95d5e7 --- /dev/null +++ b/content/postroll/_content.gotmpl @@ -0,0 +1,27 @@ +{{/* Get remote data. */}} +{{ $items := dict }} +{{ $url := "https://api.brandonrozek.com/postroll" }} +{{ with try (resources.GetRemote $url ) }} + {{ with .Err }} + {{ errorf "Unable to get remote resource %s: %s" $url . }} + {{ else with .Value }} + {{ $items = . | transform.Unmarshal }} + {{ else }} + {{ errorf "Unable to get remote resource %s" $url }} + {{ end }} +{{ end }} + +{{ range $items.Ok }} + {{ $content := dict "mediaType" "text/markdown" "value" .comment }} + {{ $dates := dict "date" (time.AsTime .dateadded) }} + {{ $params := dict "url" .url "author" .author }} + {{ $page := dict + "content" $content + "dates" $dates + "kind" "page" + "params" $params + "path" .title + "title" .title + }} + {{ $.AddPage $page }} +{{ end }} \ No newline at end of file diff --git a/content/postroll.md b/content/postroll/_index.md similarity index 100% rename from content/postroll.md rename to content/postroll/_index.md diff --git a/layouts/_default/postroll.html b/layouts/_default/postroll.html deleted file mode 100644 index 3a75922..0000000 --- a/layouts/_default/postroll.html +++ /dev/null @@ -1,35 +0,0 @@ -{{ define "main" }} -{{ partial "header.html" . }} -
-
- - {{ .Content }} - - {{ $items := getJSON "https://api.brandonrozek.com/postroll"}} - - {{ if not $items }} - {{ warnf "Failed to fetch postroll items from API." }} - {{ $items = dict }} - {{ end }} - - {{ with $items.Ok }}{{ range . }} -
-

{{ .title }} by {{ .author }}

-

{{ .comment }}

-

Added: {{ .dateadded }}

-
-
- {{ end }}{{ end }} - -
-
-{{ end }} diff --git a/layouts/_default/stats.html b/layouts/_default/stats.html index 31ffd6e..93421d8 100644 --- a/layouts/_default/stats.html +++ b/layouts/_default/stats.html @@ -81,7 +81,17 @@ Total Wikipedia Edits - {{ $data := getJSON "https://en.wikipedia.org/w/api.php?action=query&list=users&ususers=BrandonRozek&usprop=editcount&format=json" }} + {{ $data := dict }} + {{ $url := "https://en.wikipedia.org/w/api.php?action=query&list=users&ususers=BrandonRozek&usprop=editcount&format=json" }} + {{ with try (resources.GetRemote $url) }} + {{ with .Err }} + {{ errorf "Unable to get remote resource %s: %s" $url . }} + {{ else with .Value }} + {{ $data = .Content | transform.Unmarshal }} + {{ else }} + {{ errorf "Unable to get remote resource %s" $url }} + {{ end }} + {{ end }} {{ range first 1 $data.query.users }} {{ .editcount }} {{ end }} @@ -90,7 +100,17 @@ Total OpenStreetMap Edits - {{ $data := getJSON "https://api.openstreetmap.org/api/0.6/user/16068861.json" }} + {{ $data := dict }} + {{ $url := "https://api.openstreetmap.org/api/0.6/user/16068861.json" }} + {{ with try (resources.GetRemote $url) }} + {{ with .Err }} + {{ errorf "Unable to get remote resource %s: %s" $url . }} + {{ else with .Value }} + {{ $data = .Content | transform.Unmarshal }} + {{ else }} + {{ errorf "Unable to get remote resource %s" $url }} + {{ end }} + {{ end }} {{ $data.user.changesets.count }} diff --git a/layouts/index.html b/layouts/index.html index 5319bec..69f47f8 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -56,7 +56,18 @@

Recorded Walk: {{ .Title }}

{{ end }} - {{ $data := getJSON "https://en.wikipedia.org/w/api.php?action=query&format=json&list=usercontribs&ucuser=BrandonRozek&uclimit=1" }} + + {{ $data := dict }} + {{ $url := "https://en.wikipedia.org/w/api.php?action=query&format=json&list=usercontribs&ucuser=BrandonRozek&uclimit=1" }} + {{ with try (resources.GetRemote $url) }} + {{ with .Err }} + {{ errorf "Unable to get remote resource %s: %s" $url . }} + {{ else with .Value }} + {{ $data = .Content | transform.Unmarshal }} + {{ else }} + {{ errorf "Unable to get remote resource %s" $url }} + {{ end }} + {{ end }} {{ range first 1 $data.query.usercontribs }}

Last Wikipedia Edit: {{ .title }}

{{ end }} diff --git a/layouts/postroll/list.html b/layouts/postroll/list.html new file mode 100644 index 0000000..7c921b4 --- /dev/null +++ b/layouts/postroll/list.html @@ -0,0 +1,30 @@ +{{ define "main" }} +{{ partial "header.html" . }} +
+
+ + {{ .Content }} + + {{ range .Pages }} +
+

{{ .Title }} by {{ .Params.author }}

+

{{ .Content }}

+ {{ $singlePageDateFormat := .Site.Params.singlePageDateFormat | default "January 2, 2006"}} + {{ $pubdate := .Date.Format $singlePageDateFormat }} +

Added: {{ $pubdate }}

+
+
+ {{ end }} + +
+
+{{ end }} diff --git a/scripts/archive_toot.py b/scripts/archive_toot.py index 5ae7cdb..75b0ee7 100755 --- a/scripts/archive_toot.py +++ b/scripts/archive_toot.py @@ -11,7 +11,7 @@ import argparse import json import sys -SAVE_DIR = "static/data/toots" +SAVE_DIR = "assets/data/toots" # Grab arguments parser = argparse.ArgumentParser(description="Save a toot") diff --git a/themes/pulp b/themes/pulp index 615e03b..525b28e 160000 --- a/themes/pulp +++ b/themes/pulp @@ -1 +1 @@ -Subproject commit 615e03bca3167728bd91ad45de92e44b6fcede48 +Subproject commit 525b28e98b9ce21a431a5cca63bbfe72df8bf868