website/layouts/_default/cve-feed.rss.xml

51 lines
1.9 KiB
XML

{{- $url := .Site.Params.cveFeedBucket -}}
{{- $feed := "" -}}
{{- with resources.GetRemote $url -}}
{{- if .Err -}}
{{- $message := printf "Failed to retrieve CVE data: %s" .Err -}}
{{- if eq hugo.Environment "production" -}}
{{- errorf $message -}}
{{- else -}}
{{- warnf $message -}}
{{- end -}}
{{- else -}}
{{- $feed = .Content | transform.Unmarshal -}}
{{- end -}}
{{- else -}}
{{- $message := printf "Unable to fetch CVE data from the specified URL: %q" $url -}}
{{- if eq hugo.Environment "production" -}}
{{- errorf $message -}}
{{- else -}}
{{- warnf $message -}}
{{- end -}}
{{- end -}}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ $feed.title }}</title>
<link>{{ .Site.BaseURL }}docs/reference/issues-security/official-cve-feed/</link>
<description>{{ $feed.description }}</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-US</language>
<copyright>{{ .Site.Params.Copyright_k8s }}</copyright>
<!-- Render last build date only if CVE feed is available, accommodating for offline builds. -->
{{- if ne $feed nil -}}
<lastBuildDate>{{ time.Format "Mon, 02 Jan 2006 15:04:05 -0700" $feed._kubernetes_io.updated_at | safeHTML }}</lastBuildDate>
{{- end -}}
{{ with .OutputFormats.Get "RSS" -}}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end -}}
{{ range $feed.items -}}
<item>
<title>{{ .id }}</title>
<link>{{ .url }}</link>
<pubDate>{{ time.Format "Mon, 02 Jan 2006 15:04:05 -0700" .date_published | safeHTML }}</pubDate>
<guid>{{ .external_url }}</guid>
<description>{{ htmlEscape .summary }}</description>
<category term="{{ .status }}" scheme="https://k8s.io/2024-06-27/cve-item-status" />
</item>
{{ end -}}
</channel>
</rss>