1+ {{- printf "<?xml version =\" 1.0\" encoding =\" utf-8\" standalone =\" yes\" ?>" | safeHTML }}
12<rss version =" 2.0" xmlns : atom =" http://www.w3.org/2005/Atom" >
23 <channel >
3- <title >{{ .Site.Title }} – {{ .Title }}</title >
4+ <title >Hugo News</title >
5+ <description >Recent news about Hugo, a static site generator written in Go, optimized for speed and designed for flexibility.</description >
46 <link >{{ .Permalink }}</link >
5- <description >Recent Hugo news from gohugo.io</description >
6- <generator >Hugo -- gohugo.io</generator >{{ with .Site.LanguageCode }}
7- <language >{{.}}</language >{{end}}{{ with .Site.Author.email }}
8- <managingEditor >{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor >{{end}}{{ with .Site.Author.email }}
9- <webMaster >{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster >{{end}}{{ with .Site.Copyright }}
10- <copyright >{{.}}</copyright >{{end}}{{ if not .Date.IsZero }}
11- <lastBuildDate >{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate >{{ end }}
12- <image >
13- <url >{{ "img/hugo.png" | absURL }}</url >
14- <title >GoHugo.io</title >
15- <link >{{ .Permalink }}</link >
16- </image >
17- {{ with .OutputFormats.Get "RSS" }}
18- {{ printf "<atom : link href =%q rel =\" self\" type =%q />" .Permalink .MediaType | safeHTML }}
19- {{ end }}
20- {{ range first 50 (where .Site.RegularPages "Type" "in" (slice "news" "showcase")) }}
21- <item >
22- <title >{{ .Section | title }}: {{ .Title }}</title >
23- <link >{{ .Permalink }}</link >
24- <pubDate >{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate >
25- {{ with .Site.Author.email }}<author >{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author >{{end}}
26- <guid >{{ .Permalink }}</guid >
27- <description >
28- {{ $img := (.Resources.ByType "image").GetMatch "*featured*" }}
29- {{ with $img }}
30- {{ $img := .Resize "640x" }}
31- {{ printf "<![CDATA[ <img src=\"%s\" width=\"%d\" height=\"%d\"/>]]> " $img.Permalink $img.Width $img.Height | safeHTML }}
32- {{ end }}
33- {{ .Content | html }}
34- </description >
35- </item >
36- {{ end }}
7+ <generator >Hugo {{ hugo.Version }}</generator >
8+ <language >{{ or site.Language.LanguageCode site.Language.Lang }}</language >
9+ {{- with site.Copyright }}
10+ <copyright >{{ . }}</copyright >
11+ {{- end }}
12+ {{- with .OutputFormats.Get "RSS" }}
13+ {{ printf "<atom : link href =%q rel =\" self\" type =%q />" .Permalink .MediaType | safeHTML }}
14+ {{- end }}
15+
16+ {{- $news_items := slice }}
17+
18+ {{- /* Get releases from GitHub. */}}
19+ {{- $u := "https://api.github.com/repos/gohugoio/hugo/releases" }}
20+ {{- $releases := partial "utilities/get-remote-data.html" $u }}
21+ {{- $releases = where $releases "draft" false }}
22+ {{- $releases = where $releases "prerelease" false }}
23+ {{- range $releases | first 20 }}
24+ {{- $summary := printf
25+ "Hugo %s was released on %s. See [release notes](%s) for details."
26+ .tag_name
27+ (.published_at | time.AsTime | time.Format "2 Jan 2006")
28+ .html_url
29+ }}
30+ {{- $ctx := dict
31+ "PublishDate" (.published_at | time.AsTime)
32+ "Title" (printf "Release %s" .name)
33+ "Permalink" .html_url
34+ "Section" "news"
35+ "Summary" ($summary | $.Page.RenderString)
36+ }}
37+ {{- $news_items = $news_items | append $ctx }}
38+ {{- end }}
39+
40+ {{- /* Get content pages from news section. */}}
41+ {{- range where site.RegularPages "Section" "news" }}
42+ {{- $ctx := dict
43+ "PublishDate" .PublishDate
44+ "Title" .Title
45+ "RelPermalink" .RelPermalink
46+ "Section" "news"
47+ "Summary" .Summary
48+ "Params" (dict "description" .Description)
49+ }}
50+ {{- $news_items = $news_items | append $ctx }}
51+ {{- end }}
52+ {{- /* Sort, limit, and render lastBuildDate. */}}
53+ {{- $limit := cond (gt site.Config.Services.RSS.Limit 1) site.Config.Services.RSS.Limit 999 }}
54+ {{- $news_items = sort $news_items "PublishDate" "desc" | first $limit }}
55+ <lastBuildDate >{{ (index $news_items 0).PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate >
56+
57+ {{- /* Render items. */}}
58+ {{- range $news_items }}
59+ <item >
60+ <title >{{ .Title }}</title >
61+ <link >{{ .Permalink }}</link >
62+ <pubDate >{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate >
63+ <guid >{{ .Permalink }}</guid >
64+ <description >{{ .Summary | transform.XMLEscape | safeHTML }}</description >
65+ </item >
66+ {{- end }}
3767 </channel >
38- </rss >
68+ </rss >
0 commit comments