diff --git a/data/rblogs/test2.org.json b/data/rblogs/test2.org.json new file mode 100644 index 000000000..cb46211ec --- /dev/null +++ b/data/rblogs/test2.org.json @@ -0,0 +1,12 @@ +{ + "title": "Google", + "url": "https://google.com", + "photo_url": "https://assets.stickpng.com/images/580b57fcd9996e24bc43c51f.png", + "description": "", + "authors": [ + { + "name": "The whole world", + "social_media": [{}] + } + ] +} \ No newline at end of file diff --git a/data/rblogs/testing.com.json b/data/rblogs/testing.com.json index cb46211ec..db17b3a6e 100644 --- a/data/rblogs/testing.com.json +++ b/data/rblogs/testing.com.json @@ -1,11 +1,11 @@ { - "title": "Google", + "title": "Google test", "url": "https://google.com", - "photo_url": "https://assets.stickpng.com/images/580b57fcd9996e24bc43c51f.png", + "photo_url": "https://assets.stickpng.com/images/580b57fcd9996e24bc4f.png", "description": "", "authors": [ { - "name": "The whole world", + "name": "This should have no image", "social_media": [{}] } ] diff --git a/themes/hugo-rladies/layouts/rladies-blogs/single.html b/themes/hugo-rladies/layouts/rladies-blogs/single.html index 7e46ccb05..98fec8867 100644 --- a/themes/hugo-rladies/layouts/rladies-blogs/single.html +++ b/themes/hugo-rladies/layouts/rladies-blogs/single.html @@ -20,14 +20,18 @@ {{ end }} {{ $descr := $data.Get "descr" }} - {{ $grav := ( md5 $rb.url ) }} - {{ $data.Set "photo" (printf "https://www.gravatar.com/avatar/%s?s=100&d=identicon" $grav )}} + {{ $data.Set "photo" (printf "https://www.gravatar.com/avatar/%s?s=100&d=identicon" ( md5 $rb.url ) ) }} {{ with $rb.photo_url }} - {{ $image := resources.GetRemote . }} - {{ with $image }} - {{ $img := . }} - {{ $img := $img.Fill "300x300" }} - {{ $data.Set "photo" $img.RelPermalink }} + {{ with resources.GetRemote . }} + {{ with .Err }} + + {{ else }} + {{ $img := . }} + {{ $img := $img.Fill "300x300" }} + {{ $data.Set "photo" $img.RelPermalink }} + {{ end }} + {{ else }} + {{ warnf "Unable to get remote resource %q" . }} {{ end }} {{ end }}