]> juplo.de Git - website/commitdiff
`section`-Template für den Blog überarbeitet und RSS-Ausgabe hinzugefügt
authorKai Moritz <kai@juplo.de>
Sat, 20 Dec 2025 21:34:55 +0000 (22:34 +0100)
committerKai Moritz <kai@juplo.de>
Mon, 22 Dec 2025 21:58:21 +0000 (22:58 +0100)
hugo.yaml
layouts/blog/section.html
layouts/rss.xml [new file with mode: 0644]

index 3add8ce0ac3f052f7430e0d21c32e22e66bfdfed..51f32cde6f66b72bdad369b4aa4fe234ef67f31a 100644 (file)
--- a/hugo.yaml
+++ b/hugo.yaml
@@ -1,4 +1,5 @@
 baseURL: https://example.org/
+copyright: Kai Moritz
 languageCode: en-US
 mainSections:
   - blog
@@ -8,4 +9,8 @@ module:
   hugoVersion:
     extended: false
     min: 0.152.0
+params:
+  author:
+    email: kai@juplo.de
+    name: Kai Moritz
 title: Thymeleaf-Theme for Thymeroot
index acac1bb47ca3c1d09edd1baa006f697ffbcdb8db..4dc240e59cf92c3c9dec11f9ceb7538639de3088 100644 (file)
@@ -1,45 +1,21 @@
 {{- define "title" }}
   <h1>
-    {{ .Title }}
-    {{- if (.Param "ShowRssButtonInSectionTermList") }}
-    {{- $rss := (.OutputFormats.Get "rss") }}
-    {{- if (eq .Kind `page`) }}
-    {{- $rss = (.Parent.OutputFormats.Get "rss") }}
-    {{- end }}
-    {{- with $rss }}
+    {{- with .OutputFormats.Get "rss" }}
     <a href="{{ .RelPermalink }}" title="RSS" aria-label="RSS">
-      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"
+      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4"
         stroke-linecap="round" stroke-linejoin="round" height="23">
         <path d="M4 11a9 9 0 0 1 9 9" />
         <path d="M4 4a16 16 0 0 1 16 16" />
         <circle cx="5" cy="19" r="1" />
       </svg>
+      Archive of all Blog-Articles
     </a>
-    {{- end }}
-    {{- end }}
   </h1>
-  {{- if .Description }}
-  <div class="post-description">
-    {{ .Description }}
-  </div>
   {{- end }}
 {{- end }}{{/* end title */}}
 
 {{- define "main" }}
-{{- range .Pages.GroupByPublishDate "2006" }}
-{{- if ne .Key "0001" }}
-<div class="archive-year">
-  {{- $year := replace .Key "0001" "" }}
-  <h2 class="archive-year-header" id="{{ $year }}">
-    <a class="archive-header-link" href="#{{ $year }}">
-      {{- $year -}}
-    </a>
-  </h2>
-  {{- range .Pages.GroupByDate "January" }}
-  <div class="archive-month">
-    <div class="archive-posts">
-      {{- range .Pages }}
-      {{- if eq .Kind "page" }}
+{{- range .RegularPagesRecursive }}
       <div class="archive-entry">
         <h3 class="archive-entry-title entry-hint-parent">
           <a class="entry-link" aria-label="post link to {{ .Title | plainify }}" href="{{ .Permalink }}">{{- .Title | markdownify }}</a>
           {{- partial "post_meta.html" . -}}
         </div>
       </div>
-      {{- end }}
-      {{- end }}
-    </div>
-  </div>
-  {{- end }}
-</div>
-{{- end }}
 {{- end }}
 {{- end }}{{/* end main */}}
diff --git a/layouts/rss.xml b/layouts/rss.xml
new file mode 100644 (file)
index 0000000..70b7340
--- /dev/null
@@ -0,0 +1,27 @@
+{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
+  <channel>
+    <title>{{ site.Title }}</title>
+    <link>{{ .Permalink }}</link>
+    <description>{{ site.Params.description }}</description>
+    <generator>Hugo -- {{ hugo.Version }}</generator>
+    <language>{{ site.Language.LanguageCode }}</language>
+    <managingEditor>{{site.Params.author.email}} ({{site.Params.author.name}})</managingEditor>
+    <webMaster>{{site.Params.author.email}} ({{site.Params.author.name}})</webMaster>
+    <copyright>{{ site.Copyright | markdownify | plainify | strings.TrimPrefix "© " }}</copyright>
+    <lastBuildDate>{{ site.Lastmod.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>
+    <atom:link href="{{ .Permalink }}" rel="self" type="rss" />
+    {{- range .RegularPagesRecursive }}
+    <item>
+      <title>{{ .Title }}</title>
+      <link>{{ .Permalink }}</link>
+      <pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
+      <author>{{site.Params.author.email}} ({{site.Params.author.name}})</author>
+      <guid>{{ .Permalink }}</guid>
+      {{ with .Description }}
+      <description>{{ . }}</description>
+      {{ end -}}
+    </item>
+    {{- end }}
+  </channel>
+</rss>