github.com/neohugo/neohugo@v0.123.8/tpl/tplimpl/embedded/templates/_default/rss.xml (about)

     1  {{- /* Deprecate site.Author.email in favor of site.Params.author.email */}}
     2  {{- $authorEmail := "" }}
     3  {{- with site.Params.author }}
     4    {{- if reflect.IsMap . }}
     5      {{- with .email }}
     6        {{- $authorEmail = . }}
     7      {{- end }}
     8    {{- end }}
     9  {{- else }}
    10    {{- with site.Author.email }}
    11      {{- $authorEmail = . }}
    12      {{- warnf "The author key in site configuration is deprecated. Use params.author.email instead." }}
    13    {{- end }}
    14  {{- end }}
    15  
    16  {{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
    17  {{- $authorName := "" }}
    18  {{- with site.Params.author }}
    19    {{- if reflect.IsMap . }}
    20      {{- with .name }}
    21        {{- $authorName = . }}
    22      {{- end }}
    23    {{- else }}
    24      {{- $authorName  = . }}
    25    {{- end }}
    26  {{- else }}
    27    {{- with site.Author.name }}
    28      {{- $authorName = . }}
    29      {{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
    30    {{- end }}
    31  {{- end }}
    32  
    33  {{- $pctx := . }}
    34  {{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
    35  {{- $pages := slice }}
    36  {{- if or $.IsHome $.IsSection }}
    37  {{- $pages = $pctx.RegularPages }}
    38  {{- else }}
    39  {{- $pages = $pctx.Pages }}
    40  {{- end }}
    41  {{- $limit := .Site.Config.Services.RSS.Limit }}
    42  {{- if ge $limit 1 }}
    43  {{- $pages = $pages | first $limit }}
    44  {{- end }}
    45  {{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
    46  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    47    <channel>
    48      <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
    49      <link>{{ .Permalink }}</link>
    50      <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>
    51      <generator>Hugo -- gohugo.io</generator>
    52      <language>{{ site.Language.LanguageCode }}</language>{{ with $authorEmail }}
    53      <managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>{{ end }}{{ with $authorEmail }}
    54      <webMaster>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</webMaster>{{ end }}{{ with .Site.Copyright }}
    55      <copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
    56      <lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
    57      {{- with .OutputFormats.Get "RSS" }}
    58      {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
    59      {{- end }}
    60      {{- range $pages }}
    61      <item>
    62        <title>{{ .Title }}</title>
    63        <link>{{ .Permalink }}</link>
    64        <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
    65        {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
    66        <guid>{{ .Permalink }}</guid>
    67        <description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>
    68      </item>
    69      {{- end }}
    70    </channel>
    71  </rss>