|
| 1 | +{{/* |
| 2 | + Home-page RSS feed, inspired from kubernetes/website's layouts/index.rss.xml: |
| 3 | + https://github.com/kubernetes/website/blob/main/layouts/index.rss.xml |
| 4 | + |
| 5 | + The item count is read from services.rss.limit in hugo.yaml rather than |
| 6 | + hardcoded. That key is 0 when unset and Hugo treats `first 0` as unlimited, |
| 7 | + so the fallback below keeps a missing key from restoring the whole-site feed |
| 8 | + this template exists to prevent. |
| 9 | + |
| 10 | + This site owns its feed template rather than inheriting one from the theme. |
| 11 | + Docsy shipped layouts/_default/list.rss.xml through v0.9.1 and removed it in |
| 12 | + v0.10.0 (google/docsy#1948); with no local template, Hugo fell back to its |
| 13 | + built-in RSS, which ranges over every regular page with no section filter and |
| 14 | + no item cap. kubernetes/website has never been exposed to that, having owned |
| 15 | + this file since it moved to Hugo in 2018: |
| 16 | + https://github.com/kubernetes/website/commit/7f3b633a |
| 17 | + |
| 18 | + Paired with the `outputs` block in hugo.yaml, which emits RSS for the home |
| 19 | + page only, mirroring: |
| 20 | + https://github.com/kubernetes/website/blob/main/hugo.toml#L84-L88 |
| 21 | + Section feeds are deliberately not generated. |
| 22 | +*/}} |
| 23 | +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> |
| 24 | + <channel> |
| 25 | + <title>{{ site.Title }} Blog</title> |
| 26 | + <link>{{ .Permalink }}</link> |
| 27 | + <description>The Kubernetes contributor blog is used by the project to communicate community reports, contributor news, and any updates that might be relevant to people contributing to Kubernetes.</description> |
| 28 | + <generator>Hugo -- gohugo.io</generator>{{ with site.LanguageCode }} |
| 29 | + <language>{{.}}</language>{{end}}{{ with site.Author.email }} |
| 30 | + <managingEditor>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with site.Author.email }} |
| 31 | + <webMaster>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with site.Copyright }} |
| 32 | + <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} |
| 33 | + <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} |
| 34 | + <image> |
| 35 | + <url>https://raw.githubusercontent.com/kubernetes/kubernetes/master/logo/logo.png</url> |
| 36 | + <title>The Kubernetes project logo</title> |
| 37 | + <link>{{ .Permalink }}</link> |
| 38 | + </image> |
| 39 | + {{ with .OutputFormats.Get "RSS" }} |
| 40 | + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} |
| 41 | + {{ end }} |
| 42 | + {{- $limit := site.Config.Services.RSS.Limit }} |
| 43 | + {{- if lt $limit 1 }}{{ $limit = 50 }}{{ end }} |
| 44 | + {{ range first $limit (where site.RegularPages "Type" "in" (slice "blog")) }} |
| 45 | + <item> |
| 46 | + <title>{{ .Title }}</title> |
| 47 | + <link>{{ .Permalink }}</link> |
| 48 | + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> |
| 49 | + {{ with site.Author.email }}<author>{{.}}{{ with site.Author.name }} ({{.}}){{end}}</author>{{end}} |
| 50 | + <guid>{{ .Permalink }}</guid> |
| 51 | + <description> |
| 52 | + {{ $img := (.Resources.ByType "image").GetMatch "*featured*" }} |
| 53 | + {{ with $img }} |
| 54 | + {{ $img := .Resize "640x" }} |
| 55 | + {{ printf "<![CDATA[<img src=\"%s\" width=\"%d\" height=\"%d\"/>]]>" $img.Permalink $img.Width $img.Height | safeHTML }} |
| 56 | + {{ end }} |
| 57 | + {{ .Content | transform.XMLEscape | safeHTML }} |
| 58 | + </description> |
| 59 | + </item> |
| 60 | + {{ end }} |
| 61 | + </channel> |
| 62 | +</rss> |
0 commit comments