Rss конечная (надеюсь)
All checks were successful
/ site (push) Successful in 2s

This commit is contained in:
Артём 2024-08-09 18:57:55 +03:00
parent 64d1719fa0
commit 30c5e39a63
Signed by: SadmL
GPG key ID: EEFBB39006B28920
4 changed files with 59 additions and 34 deletions

View file

@ -65,12 +65,15 @@ DefaultContentLanguage = "ru"
# set title for the table of contents
# can be overridden in a page's front-matter
# TocTitle = "Содержание" # default
# TocTitle = "Содержание" # default
[params.author]
email = ""
name = "Сисадмин Линк"
[languages]
[languages.ru]
languageCode = 'ru'
languageName = 'RU'
languageCode = "ru"
languageName = "RU"
title = "Sadium"
[languages.ru.params]
writtenby = "Сисадмин Линк"
@ -117,4 +120,8 @@ DefaultContentLanguage = "ru"
[[languages.ru.menu.main]]
identifier = "uptime"
name = "[Uptime]"
url = "https://up.sadium.cyou"
url = "https://up.sadium.cyou"
[[languages.ru.menu.main]]
identifier = "uptime"
name = "[Uptime]"
url = "https://up.sadium.cyou"

View file

@ -1,40 +1,57 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- /* Deprecate site.Author.name in favor of site.Params.author.name */}}
{{- $authorName := "" }}
{{- with site.Params.author }}
{{- if reflect.IsMap . }}
{{- with .name }}
{{- $authorName = . }}
{{- end }}
{{- else }}
{{- $authorName = . }}
{{- end }}
{{- else }}
{{- with site.Author.name }}
{{- $authorName = . }}
{{- warnf "The author key in site configuration is deprecated. Use params.author.name instead." }}
{{- end }}
{{- end }}
{{- $pctx := . }}
{{- if .IsHome }}{{ $pctx = .Site }}{{ end }}
{{- $pages := slice }}
{{- if or $.IsHome $.IsSection }}
{{- $pages = $pctx.RegularPages }}
{{- else }}
{{- $pages = $pctx.Pages }}
{{- end }}
{{- $limit := .Site.Config.Services.RSS.Limit }}
{{- if ge $limit 1 }}
{{- $pages = $pages | first $limit }}
{{- end }}
{{- 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>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<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 }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "02.01.2006" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" -}}
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo</generator>
<language>{{ site.Language.LanguageCode }}</language>
<managingEditor>{{.}}{{ with $authorName }} ({{ . }}){{ end }}</managingEditor>
<webMaster>{{ . }}{{ with $authorName }} ({{ . }})</webMaster>{{ end }}{{ with .Site.Copyright }}
<copyright>{{ . }}</copyright>{{ end }}{{ if not .Date.IsZero }}
<lastBuildDate>{{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{- with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{- end -}}
{{ range $pages }}
{{- end }}
{{- range $pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "02.01.2006" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>
<guid>{{ .Permalink }}</guid>
<description>{{ .Content | html }}</description>
<content>{{ .Content | html }}</content>
<description>{{ .Content | transform.XMLEscape | safeHTML }}</description>
</item>
{{ end }}
{{- end }}
</channel>
</rss>

View file

@ -7,8 +7,8 @@
<div class="copyright">
<span>&nbsp;<a href="https://git.sadium.cyou/SadmL/sadium">Исходный код</a> ::</span>
<span><a href="/tos">Условия использования</a> ::</span>
<!-- <span>&nbsp;<a href="/posts/index.xml">RSS</a> ::</span> -->
<span>&nbsp;{{ now.Year }}</span>
<span>&nbsp;{{ now.Year }}&nbsp;&nbsp;</span>
<span><a href="/posts/index.xml"><img src="/img/rss.svg"></a></span>
{{ end }}
</div>
</div>

1
static/img/rss.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 16 16"><path fill="#ff6165" d="M14.5 0h-13C.675 0 0 .675 0 1.5v13c0 .825.675 1.5 1.5 1.5h13c.825 0 1.5-.675 1.5-1.5v-13c0-.825-.675-1.5-1.5-1.5M4.359 12.988c-.75 0-1.359-.603-1.359-1.353a1.36 1.36 0 0 1 2.718 0c0 .75-.609 1.353-1.359 1.353M7.772 13a4.75 4.75 0 0 0-1.397-3.381A4.74 4.74 0 0 0 3 8.219V6.263c3.713 0 6.738 3.022 6.738 6.737zm3.472 0c0-4.547-3.697-8.25-8.241-8.25V2.794c5.625 0 10.203 4.581 10.203 10.206h-1.963z"/></svg>

After

Width:  |  Height:  |  Size: 513 B