mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 05:36:07 +01:00
Fix main RSS feed
This commit is contained in:
parent
fbe0aec3ea
commit
db22cddc10
1 changed files with 20 additions and 10 deletions
|
@ -1,14 +1,14 @@
|
|||
{{- $pctx := . -}}
|
||||
{{- if .IsHome -}}{{ $pctx = index .Site.Sections 0 }}{{- end -}}
|
||||
{{- $pages := slice -}}
|
||||
{{- if or $.IsHome $.IsSection -}}
|
||||
{{- $pages = $pctx.RegularPages -}}
|
||||
{{- if .IsHome -}}
|
||||
{{- $pages = where .Site.RegularPages "Type" "not in" (slice "memex" "timeless" "site-infra") -}}
|
||||
{{- else if $.IsSection -}}
|
||||
{{- $pages = .RegularPages -}}
|
||||
{{- else -}}
|
||||
{{- $pages = $pctx.Pages -}}
|
||||
{{- $pages = .Pages -}}
|
||||
{{- end -}}
|
||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||
{{- if ge $limit 1 -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- $pages = $pages | first $limit -}}
|
||||
{{- end -}}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
{{- printf "<?xml-stylesheet href=\"/rss.xsl\" type=\"text/xsl\"?>" | safeHTML }}
|
||||
|
@ -26,16 +26,26 @@
|
|||
{{- with .OutputFormats.Get "RSS" -}}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" (.Permalink | absURL) .MediaType | safeHTML }}
|
||||
{{- end -}}
|
||||
{{ range $pages }}
|
||||
{{ range $pages }}{{ $page := . }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<title>{{ .Title | default (delimit (slice "An untitled" (.Date.Format "January") (.Type | singularize)) " ") }}</title>
|
||||
<link>{{ .Permalink | absURL }}</link>
|
||||
{{ if .Page.Params.Audio }}<enclosure url="{{ .Permalink | absURL }}{{ .Page.Params.Audio }}" length="{{ (os.Stat (path.Join .File.Dir .Page.Params.Audio)).Size }}" type="audio/mpeg" />{{end}}
|
||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||
<guid>{{ .Permalink | absURL }}</guid>
|
||||
<description>{{ .Summary }}</description>
|
||||
<content:encoded>{{ .Content | html}}</content:encoded>
|
||||
<description>
|
||||
{{- with index .Params.Media 0 }}
|
||||
<img src="{{ path.Join $page.RelPermalink . | absURL }}" />
|
||||
{{ end -}}
|
||||
{{- .Summary -}}
|
||||
</description>
|
||||
<content:encoded>
|
||||
{{- range $i, $src := .Params.Media }}
|
||||
<img src="{{ path.Join $page.RelPermalink $src | absURL }}" />
|
||||
{{ end -}}
|
||||
{{- .Content | html -}}
|
||||
</content:encoded>
|
||||
</item>
|
||||
{{ end }}
|
||||
</channel>
|
||||
|
|
Loading…
Reference in a new issue