/
githubmirror
/
hugo
Обзор
Документация
Войти
/
githubmirror
/
hugo
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
docs/layouts/list.rss.xml
33 строки
1 KB
Bjørn Erik Pedersen
Merge commit 'c23d97904fd31ef745bece57133aa1b9275ec20c'
21 май 2026, 13:22
21 май 2026, 13:22
5f01b06
Код
Авторство
О чём код?
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>Hugo News</title> <description>Recent news about Hugo, a static site generator written in Go, optimized for speed and designed for flexibility.</description> <link>{{ .Permalink }}</link> <generator>Hugo {{ hugo.Version }}</generator> <language>{{ site.Language.Locale }}</language> {{- with site.Copyright }} <copyright>{{ . }}</copyright> {{- end }} {{- with .OutputFormats.Get "rss" }} {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} {{- end }} {{- $limit := cond (gt site.Config.Services.RSS.Limit 0) site.Config.Services.RSS.Limit 999 }} {{- $pages := "" }} {{- with site.GetPage "/news" }} {{- $pages = .Pages.ByPublishDate.Reverse | first $limit }} {{- else }} {{- errorf "The list.rss.xml layout was unable to find the 'news' page." }} {{- end }} <lastBuildDate>{{ (index $pages 0).PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate> {{- range $pages }} <item> <title>{{ .Title }}</title> <link>{{ or .Params.permalink .Permalink }}</link> <pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> <guid>{{ or .Params.permalink .Permalink }}</guid> <description>{{ .Summary | transform.XMLEscape | safeHTML }}</description> </item> {{- end }} </channel> </rss>