Put this template in a layout or a shortcode to render a list of entries from a Google Reader JSON feed as generated by FreshRSS.
Created
August 26, 2025 11:03
-
-
Save jsanz/e6ccb210d2adeb9378d8421fd18dd6fe to your computer and use it in GitHub Desktop.
[Hugo] Create a list from a Google Reader JSON feed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<section> | |
{{- $data := dict}} | |
{{- $url := .Params.greader_url }} | |
{{- $cacheKey := print $url (now.Format "2006-01-02") }} | |
{{- $opts := dict "key" $cacheKey }} | |
{{- with try (resources.GetRemote $url $opts) }} | |
{{- with .Err }} | |
{{- errorf "%s" . }} | |
{{- else with .Value }} | |
{{- $data = . | transform.Unmarshal }} | |
{{- with $data.items }} | |
<ul> | |
{{- range . }} | |
<li> | |
<a href=" | |
{{- with .canonical }} | |
{{- with index . 0 }} | |
{{- .href }} | |
{{- else }} | |
{{- $.guid }} | |
{{- end }} | |
{{- else }} | |
{{- .guid }} | |
{{- end }}"> | |
{{ .title }} | |
</a> | |
from <em>{{ .origin.title }}</em> | |
on {{ (.published | int | time | time.Format "2006-01-02") }} | |
</li> | |
{{- end }} | |
</ul> | |
{{- end }} | |
{{ else }} | |
{{ errorf "Unable to get remote resource %q" $url }} | |
{{- end }} | |
{{- end }} | |
</section> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment