shithub: hugo

Download patch

ref: 8d5132229f7b12aef2483d19ed3c7fdc5c2b6a91
parent: 0eb76b0863666ee99b8643a37bcb46eb1c4a8043
author: Cameron Moore <moorereason@gmail.com>
date: Sat Feb 25 12:12:08 EST 2017

docs: Update RSS docs with rssLimit changes

Side effect: remove unnecessary XML templates from example blog site.

Fixes #3065

--- a/docs/content/templates/rss.md
+++ b/docs/content/templates/rss.md
@@ -58,16 +58,21 @@
 
     [author]
         name = "My Name Here"
+        email = "sample@domain.tld"
 
+### Limiting the Number of Items
 
+By default, the RSS feed is limited to **15** items.
+You may override the default by using the `rssLimit` [site configuration variable](/overview/configuration/).
+
 ## The Embedded rss.xml
 This is the default RSS template that ships with Hugo. It adheres to the [RSS 2.0 Specification][RSS 2.0].
 
     <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
       <channel>
-        <title>{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}</title>
+        <title>{{ if eq  .Title  .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
         <link>{{ .Permalink }}</link>
-        <description>Recent content {{ with .Title }}in {{.}} {{ end }}on {{ .Site.Title }}</description>
+        <description>Recent content {{ if ne  .Title  .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
         <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
         <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
         <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
@@ -74,8 +79,8 @@
         <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
         <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
         <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
-        <atom:link href="{{.URL}}" rel="self" type="application/rss+xml" />
-        {{ range first 15 .Data.Pages }}
+        <atom:link href="{{.Permalink}}" rel="self" type="application/rss+xml" />
+        {{ range .Data.Pages }}
         <item>
           <title>{{ .Title }}</title>
           <link>{{ .Permalink }}</link>
--- a/examples/blog/layouts/rss.xml
+++ /dev/null
@@ -1,20 +1,0 @@
-<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
-  <channel>
-      <title>{{ .Title }} on {{ .Site.Title }} </title>
-    <link>{{ .Permalink }}</link>
-    <language>en-US</language>
-    <author>Enthusiastic Hugo User</author>
-    <rights>Copyright (c) 2014, Enthusiastic Hugo User; all rights reserved.</rights>
-    <updated>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 MST" }}</updated>
-    {{ range first 15 .Data.Pages }}
-    <item>
-      <title>{{ .Title }}</title>
-      <link>{{ .Permalink }}</link>
-      <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 MST" }}</pubDate>
-      <author>Enthusiastic Hugo User</author>
-      <guid>{{ .Permalink }}</guid>
-      <description>{{ .Content | html }}</description>
-    </item>
-    {{ end }}
-  </channel>
-</rss>
\ No newline at end of file
--- a/examples/blog/layouts/sitemap.xml
+++ /dev/null
@@ -1,10 +1,0 @@
-<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
-  {{ range .Data.Pages }}
-  <url>
-        <loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
-        <lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
-    <changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
-    <priority>{{ .Sitemap.Priority }}</priority>{{ end }}
-  </url>
-  {{ end }}
-</urlset>
--