summaryrefslogtreecommitdiff
path: root/layouts/_default/featured.html
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-05-16 15:21:10 +0800
committerEltrac <hi@guhub.cn>2025-05-16 15:21:10 +0800
commit90e305c8addbb3f814e219633e9b3d75c2d921da (patch)
treecc5a087f948460f27c60c1101b43131451321dc3 /layouts/_default/featured.html
parent4c04d9c5bfd031d3966856f55f0d7e3f6d8a25f7 (diff)
feat: add featured post section
Former-commit-id: ab6318704c4a5f22793fb738662bb2201fa89082
Diffstat (limited to 'layouts/_default/featured.html')
-rw-r--r--layouts/_default/featured.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/layouts/_default/featured.html b/layouts/_default/featured.html
new file mode 100644
index 00000000..f1484bcb
--- /dev/null
+++ b/layouts/_default/featured.html
@@ -0,0 +1,44 @@
+{{ define "main" }}
+ <article class="index">
+ {{ partial "header.html" . }}
+ {{ partial "components/postnav.html" . }}
+
+ <!-- Latest Posts -->
+ <section id="featured-posts">
+ <div class="posts-list">
+ {{ range where site.RegularPages "Params.featured" true }}
+ <div class="posts-item"
+ style="view-transition-name: post-{{ .File.UniqueID }}">
+ <header>
+ <div class="posts-item-meta">
+ <time>
+ {{ .Date.Format "Jan 2" }}
+ </time>
+ <h2 class="posts-item-title">
+ <a
+ href="{{ .Permalink }}"
+ data-umami-event="Click post link from featured"
+ >
+ {{ if eq .Section "library" }}
+ 读《{{ .Title }}》
+ {{ else }}
+ {{ .Title }}
+ {{ end }}
+ </a>
+ </h2>
+ </div>
+ {{ with .Params.categories }}
+ <div class="posts-item-category">
+ <a href="/categories/{{ . }}" style="padding: 0.1rem 0.3rem;">
+ {{ . }}
+ </a>
+ </div>
+ {{ end }}
+ </header>
+ </div>
+ {{ end }}
+ </div>
+ </section>
+ </article>
+{{ partial "footer.html" . }}
+{{ end }}