]> juplo.de Git - website/commitdiff
WIP
authorKai Moritz <kai@juplo.de>
Sat, 20 Dec 2025 21:34:55 +0000 (22:34 +0100)
committerKai Moritz <kai@juplo.de>
Sat, 20 Dec 2025 21:46:49 +0000 (22:46 +0100)
hugo.yaml
layouts/blog/section.html
layouts/rss.xml [new file with mode: 0644]

index 4d9d6b771412175872c1cb6ee5619605e0e337d2..aacde1e6b7411f8453e7f2189d4c0b13336a16f7 100644 (file)
--- a/hugo.yaml
+++ b/hugo.yaml
@@ -1,4 +1,5 @@
 baseURL: https://example.org/
+copyright: mo
 languageCode: en-US
 mainSections:
   - blog
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..06c639b
--- /dev/null
@@ -0,0 +1,44 @@
+{{- $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" xmlns:content="http://purl.org/rss/1.0/modules/content/">
+  <channel>
+    <title>{{ site.Title }}</title>
+    <link>{{ .Permalink }}</link>
+    <description>{{ site.Description }}</description>
+    <generator>Hugo -- {{ hugo.Version }}</generator>
+    <language>{{ site.Language.LanguageCode }}</language>
+    <managingEditor>{{params.author.email}} ({{params.author.name}})</managingEditor>
+    <webMaster>{{params.author.email}} ({{params.author.name}})</webMaster>
+    <copyright>{{ . | markdownify | plainify | strings.TrimPrefix "© " }}</copyright>
+    <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 }}
+    {{- if and (ne .Layout `search`) (ne .Layout `archives`) }}
+    <item>
+      <title>{{ .Title }}</title>
+      <link>{{ .Permalink }}</link>
+      <pubDate>{{ .PublishDate.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
+      {{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
+      <guid>{{ .Permalink }}</guid>
+      <description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
+      {{- if and site.Params.ShowFullTextinRSS .Content }}
+      <content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
+      {{- end }}
+    </item>
+    {{- end }}
+    {{- end }}
+  </channel>
+</rss>