Skip to content

Instantly share code, notes, and snippets.

@jsanz
Created August 26, 2025 11:03
Show Gist options
  • Save jsanz/e6ccb210d2adeb9378d8421fd18dd6fe to your computer and use it in GitHub Desktop.
Save jsanz/e6ccb210d2adeb9378d8421fd18dd6fe to your computer and use it in GitHub Desktop.
[Hugo] Create a list from a Google Reader JSON feed

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.

<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