{{ define "main" }} {{ $rss := "" }} {{ with resources.GetRemote "https://medium.com/feed/jaegertracing" }} {{ with .Err }} {{ errorf "%s" . }} {{ else }} {{ $rss = . | transform.Unmarshal }} {{ end }} {{ end }} {{/* Parse image links */}} {{ $defaultImgLink := "/img/jaeger-icon-color.png" }} {{ warnf "Downloaded RSS feed for: %v" $rss.channel.title }} {{ $posts := first 20 $rss.channel.item }} {{ $imgLinks := slice }} {{ range $k, $v := $posts }} {{ $imgLink := $defaultImgLink }} {{ $content := index $v "encoded" }} {{ with strings.FindRESubmatch "]+src=\"([^\">]+)\"" $content 1 }} {{ if . }} {{/* If image found in post */}} {{ $findMatch := index . 0 }} {{/* Choose the first image */}} {{ with $findMatch }} {{ $findGroup := index . 1 }} {{ if . }} {{/* If src link found */}} {{ $imgLink = $findGroup }} {{ end }} {{ end }} {{ end }} {{ end }} {{ $imgLinks = $imgLinks | append $imgLink }} {{ warnf "Post: %v" $v.title }} {{ end }} {{ partial "home/hero.html" (dict "posts" $posts "title" site.Title "tagline" site.Params.tagline "latestVersion" site.Params.latest) }} {{ partial "home/why.html" . }} {{ partial "home/features.html" . }} {{ partial "home/articles.html" (dict "posts" $posts "imgLinks" $imgLinks) }} {{ partial "home/contributing.html" . }} {{ partial "home/cncf.html" . }} {{ end }}