From 30c5e39a631a43a3924e35d9ede53bfa1fa6cb51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC?= Date: Fri, 9 Aug 2024 18:57:55 +0300 Subject: [PATCH] =?UTF-8?q?Rss=20=D0=BA=D0=BE=D0=BD=D0=B5=D1=87=D0=BD?= =?UTF-8?q?=D0=B0=D1=8F=20(=D0=BD=D0=B0=D0=B4=D0=B5=D1=8E=D1=81=D1=8C)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config.toml | 15 ++++++-- layouts/_default/rss.xml | 73 ++++++++++++++++++++++-------------- layouts/partials/footer.html | 4 +- static/img/rss.svg | 1 + 4 files changed, 59 insertions(+), 34 deletions(-) create mode 100644 static/img/rss.svg diff --git a/config.toml b/config.toml index 8c57b73..20d1347 100755 --- a/config.toml +++ b/config.toml @@ -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" \ No newline at end of file + url = "https://up.sadium.cyou" + [[languages.ru.menu.main]] + identifier = "uptime" + name = "[Uptime]" + url = "https://up.sadium.cyou" \ No newline at end of file diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml index cb41a68..29e13b3 100644 --- a/layouts/_default/rss.xml +++ b/layouts/_default/rss.xml @@ -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 "" | safeHTML }} - {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} + {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ .Site.Title }}{{ end }} {{ .Permalink }} - Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }} - Hugo -- gohugo.io{{ with .Site.LanguageCode }} - {{.}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Author.email }} - {{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}}{{ with .Site.Copyright }} - {{.}}{{end}}{{ if not .Date.IsZero }} - {{ .Date.Format "02.01.2006" | safeHTML }}{{ end }} - {{- with .OutputFormats.Get "RSS" -}} + Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{ . }} {{ end }}{{ end }}on {{ .Site.Title }} + Hugo + {{ site.Language.LanguageCode }} + {{.}}{{ with $authorName }} ({{ . }}){{ end }} + {{ . }}{{ with $authorName }} ({{ . }}){{ end }}{{ with .Site.Copyright }} + {{ . }}{{ end }}{{ if not .Date.IsZero }} + {{ (index $pages.ByLastmod.Reverse 0).Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}{{ end }} + {{- with .OutputFormats.Get "RSS" }} {{ printf "" .Permalink .MediaType | safeHTML }} - {{- end -}} - {{ range $pages }} + {{- end }} + {{- range $pages }} {{ .Title }} {{ .Permalink }} - {{ .Date.Format "02.01.2006" | safeHTML }} - {{ with .Site.Author.email }}{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}{{end}} + {{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }} + {{ . }}{{ with $authorName }} ({{ . }}){{ end }} {{ .Permalink }} - {{ .Content | html }} - {{ .Content | html }} + {{ .Content | transform.XMLEscape | safeHTML }} - {{ end }} + {{- end }} + diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index e6b751f..017d13d 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -7,8 +7,8 @@ diff --git a/static/img/rss.svg b/static/img/rss.svg new file mode 100644 index 0000000..d9a6227 --- /dev/null +++ b/static/img/rss.svg @@ -0,0 +1 @@ + \ No newline at end of file