Browse Source

Update RSS template & footer

Track3 2 years ago
parent
commit
4243498f32
4 changed files with 41 additions and 25 deletions
  1. 1 0
      assets/scss/partials/_comments.scss
  2. 2 0
      assets/scss/style.scss
  3. 1 1
      layouts/index.html
  4. 37 24
      layouts/writing/rss.xml

+ 1 - 0
assets/scss/partials/_comments.scss

@@ -18,6 +18,7 @@
 .isso-postbox {
   padding: .7em;
   background-color: var(--c-bg-alt);
+  border: 5px double var(--c-bg);
   label {
     font-size: .9em;
   }

+ 2 - 0
assets/scss/style.scss

@@ -60,6 +60,8 @@ pre {
   font-size: .9em;
   line-height: 1.2;
   white-space: pre;
+  color: var(--c-txt);
+  background-color: var(--c-bg-alt);
   code {
     padding: 0;
     margin: 0;

+ 1 - 1
layouts/index.html

@@ -32,7 +32,7 @@
 	</div>
 	<div id="home-footer">
 		<p>
-			&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a> &vert; <a href="https://status.ojbk.im/" target="_blank" title="服务状态">Status</a>
+			&copy; {{ now.Format "2006" }} <a href="{{ .Site.BaseURL }}">{{ .Site.Author.name }}</a>
 			{{- with (not (in (.Site.Language.Get "disableKinds") "RSS")) }} &#183; <a href="{{ "writing/index.xml" | absURL }}" target="_blank" title="rss"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-rss"><path d="M4 11a9 9 0 0 1 9 9"></path><path d="M4 4a16 16 0 0 1 16 16"></path><circle cx="5" cy="19" r="1"></circle></svg></a>{{ end }}
 		</p>
 	</div>

+ 37 - 24
layouts/writing/rss.xml

@@ -1,27 +1,40 @@
+{{- $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>
-		<link>{{ .Permalink }}</link>
-		<description>Recent {{ with .Title }}{{. | humanize}}{{ 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 "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 }}
-		<item>
-			<title>{{ .Title }}</title>
-			<link>{{ .Permalink }}</link>
-			<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 }}</guid>
-			<description>{{ .Summary | html }}</description>
+  <channel>
+    <title>{{ .Site.Title }}</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 "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 }}
+    <item>
+      <title>{{ .Title }}</title>
+      <link>{{ .Permalink }}</link>
+      <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 }}</guid>
+      <description>{{ .Summary | html }}</description>
 			<content type="html">{{ printf `<![CDATA[%s]]>` .Content | safeHTML }}</content>
-		</item>
-		{{ end }}
-	</channel>
+    </item>
+    {{ end }}
+  </channel>
 </rss>