From bbde4caedf468c71c3aca6fc1327eace2d9afe95 Mon Sep 17 00:00:00 2001
From: fundor333
Date: Wed, 28 May 2025 13:07:13 +0200
Subject: [PATCH] Adds micro posts to the home page
Adds support for displaying microposts (e.g. Mastodon toots) on the home
page. This includes adding a new "secondarysections" parameter to the
configuration, updating the index layout to display these posts, and
adding a default comment section to the micro archetype.
---
archetypes/micro.md | 5 +++++
config/_default/params.yaml | 1 +
content/micro/2025/05/pocket-is-closing/index.md | 5 +++++
layouts/index.html | 14 ++++++++++++++
4 files changed, 25 insertions(+)
diff --git a/archetypes/micro.md b/archetypes/micro.md
index 01969543..637c1f8d 100644
--- a/archetypes/micro.md
+++ b/archetypes/micro.md
@@ -10,5 +10,10 @@ repost:
like:
rsvp:
bookmark:
+
+comments:
+ host: mastodon.social
+ username: fundor333
+ id:
---
diff --git a/config/_default/params.yaml b/config/_default/params.yaml
index 3de14b9d..73668b9c 100644
--- a/config/_default/params.yaml
+++ b/config/_default/params.yaml
@@ -10,6 +10,7 @@ defaultColor:
# the default value is set to 'auto'.
# You can take a look at layouts/index.html for more information.
mainSections: ["post", "photos", "weeknote"]
+secondarysections: ["micro"]
feedSections: ["post", "photos", "micro", "weeknote"]
commentSections: ["post", "photos", "micro", "weeknote"]
suggestionSections: ["post"]
diff --git a/content/micro/2025/05/pocket-is-closing/index.md b/content/micro/2025/05/pocket-is-closing/index.md
index 3d0cf5eb..e88c3bf1 100644
--- a/content/micro/2025/05/pocket-is-closing/index.md
+++ b/content/micro/2025/05/pocket-is-closing/index.md
@@ -12,6 +12,11 @@ repost:
like:
rsvp:
bookmark:
+
+comments:
+ host: mastodon.social
+ username: fundor333
+ id: 114581620705519039
---
#Pocket is closing and I had rework all the stuff I got into my personal #Django server.
diff --git a/layouts/index.html b/layouts/index.html
index 4011c9ae..bb5211ac 100644
--- a/layouts/index.html
+++ b/layouts/index.html
@@ -32,6 +32,20 @@
{{ end }}
{{ end }}
+ {{ T "home.recent_posts" }}
+ {{/* Show last 10 posts in reverse date order */}}
+ {{ $pagesToShow := where .Site.RegularPages "Type" "in" site.Params.secondarysections }}
+ {{ $posts := $pagesToShow.ByDate.Reverse }}
+ {{ range first 10 $posts }}
+ {{ partial "postCard" . }}
+ {{ end }}
+ {{ if gt (len $posts) 5 }}
+
+ {{ range $firstSection := (where .Site.Sections "Section" "in" (first 1 (.Site.Params.mainSections))) }}
+ {{ T "home.see_all_posts" }}
+ {{ end }}
+
+ {{ end }}
{{- partial "footer.html" . -}}