fix recent posts

This commit is contained in:
Yan Lin 2026-02-01 09:46:29 +01:00
parent 62f684a548
commit 72b8cf0132
3 changed files with 6 additions and 15 deletions

View file

@ -1,5 +1,5 @@
+++ +++
title = "Welcome" title = "Yan Lin's Blog"
+++ +++
My name is Yan Lin, and this is my personal blog where I occasionally post my thoughts and findings during research. My name is Yan Lin, and this is my personal blog where I occasionally post my thoughts and findings during research.

View file

@ -2,7 +2,6 @@
title = "Homelab" title = "Homelab"
sort_by = "date" sort_by = "date"
paginate_by = 10 paginate_by = 10
weight = 2
+++ +++
My experience and stories tinkering with home servers, personal cloud, etc. My experience and stories tinkering with home servers, personal cloud, etc.

View file

@ -8,19 +8,11 @@
<section class="recent-posts"> <section class="recent-posts">
<p style=" font-size: 1.1rem; font-weight: bold; ">Recent Posts</p> <p style=" font-size: 1.1rem; font-weight: bold; ">Recent Posts</p>
{% set root = get_section(path="_index.md") %} {% set root = get_section(path="_index.md") %}
{% set all_pages = [] %} {% set_global all_pages = [] %}
{% if root.subsections[0] is defined %} {% for subsection_path in root.subsections %}
{% set s0 = get_section(path=root.subsections[0]) %} {% set subsection = get_section(path=subsection_path) %}
{% set all_pages = all_pages | concat(with=s0.pages) %} {% set_global all_pages = all_pages | concat(with=subsection.pages) %}
{% endif %} {% endfor %}
{% if root.subsections[1] is defined %}
{% set s1 = get_section(path=root.subsections[1]) %}
{% set all_pages = all_pages | concat(with=s1.pages) %}
{% endif %}
{% if root.subsections[2] is defined %}
{% set s2 = get_section(path=root.subsections[2]) %}
{% set all_pages = all_pages | concat(with=s2.pages) %}
{% endif %}
<ul class="post-list"> <ul class="post-list">
{% for page in all_pages | sort(attribute="date") | reverse | slice(end=7) %} {% for page in all_pages | sort(attribute="date") | reverse | slice(end=7) %}
<li> <li>