修改rss订阅 最终版

This commit is contained in:
小赵同学 committed 2024-07-28 18:58:23 +08:00
1 parent 413c8c74c3
commit 0504b7b119
219 files changed
+36801 -18604

No files matched your search

+9 -5
View File
@@ -1,12 +1,14 @@
{{- /* Generate RSS v2 with full page content. */ -}}
{{- /* Upstream Hugo bug - RSS dates can be in future: https://github.com/gohugoio/hugo/issues/3918 */ -}}
{{- /* 定义页面上下文 */ -}}
{{- $page_context := cond .IsHome site . -}}
{{- $pages := $page_context.RegularPages -}}
{{- /* 过滤只包含类型为 'post' 的页面 */ -}}
{{- $pages = where $pages "Type" "post" -}}
{{- $limit := site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- $pages = first $limit $pages -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if ne .Title site.Title }}{{ with .Title }}{{.}} | {{ end }}{{end}}{{ site.Title }}</title>
@@ -32,7 +34,9 @@
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description>
<description><![CDATA[
{{ .Content | safeHTML }}
]]></description>
</item>
{{ end }}
</channel>