The Blogroll on this site is dynamic, pulling in my RSS feeds from Miniflux. I use this partial below to render a list of public feeds by category.

It’s important to change $allowed_categories here in the script, and to set miniflux.url and miniflux.apiKey in your site config.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{{/*
    GetMinifluxFeeds
    Get a list of MiniFlux feeds by category
  
    @author @qcasey
  
    @context Page (.)
  
    @access public
  
    @example - Go Template
      {{ partialCached "func/GetMinifluxFeeds" . }}
*/}}
{{ $mf_url := .Site.Params.miniflux.url }}
{{ $mf_apiKey := .Site.Params.miniflux.apiKey }}
{{ $allowed_categories := (slice "Digital Gardens and Blogs" "News" "Releases") }}

{{ if (and $mf_url $mf_apiKey) }}
    {{ $categories := getJSON (printf "%s/v1/categories" $mf_url) (dict "X-Auth-Token" $mf_apiKey) }}

    {{ with $categories }}
        {{ $feeds := getJSON (printf "%s/v1/feeds" $mf_url) (dict "X-Auth-Token" $mf_apiKey) }}
        
        {{ if $feeds }}
            {{ range $categories }}
                {{ if in $allowed_categories .title }}
                    {{ $c := . }}
                    <h2 id="{{ $c.title | lower }}">{{ $c.title }}</h2>
                    <ul class="blogroll">
                    {{ range $feeds }}
                        {{ if eq .category.id $c.id }}
                            <li>
                                <a href="{{ .site_url }}">
                                {{ with .icon.feed_id }}
                                    {{ $icon := getJSON (printf "%s/v1/feeds/%.0f/icon" $mf_url .) (dict "X-Auth-Token" $mf_apiKey) }}
                                    {{ with $icon }}
                                    <img width="20" height="20" src="data:{{ .data }}" />
                                    {{ end }}
                                {{ end }}
                                {{ .title }}
                                </a>
                            </li>
                        {{ end }}
                    {{ end }}
                    </ul>
                {{ end }}
            {{ end }}
        {{ end }}
    {{ end }}
{{ end }}