summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authoreltrac <hi@eltr.ac>2026-02-20 15:57:19 +0800
committereltrac <hi@eltr.ac>2026-02-20 15:57:19 +0800
commit02a247ba9112ae944169c7665ba9be87e91c02dc (patch)
treea3d7a1b021fd4b6ce5f765c8f89002074b5cb3bc /layouts
parent453dc430a100729652551643e3024dd36d0dbb21 (diff)
perf: render items of long list only after scrolled into view
Diffstat (limited to 'layouts')
-rw-r--r--layouts/archive.html2
-rw-r--r--layouts/essays/section.html2
-rw-r--r--layouts/highlights.html4
-rw-r--r--layouts/section.html2
4 files changed, 5 insertions, 5 deletions
diff --git a/layouts/archive.html b/layouts/archive.html
index 3af7c9ce..764f0879 100644
--- a/layouts/archive.html
+++ b/layouts/archive.html
@@ -6,7 +6,7 @@
<ol class="mx-0 my-4 p-0 leading-loose flex flex-col-reverse">
{{ range (.Site.RegularPages | collections.Reverse) }}
{{ if eq .Language .Site.Language }}
- <li class="list-decimal text-secondary">
+ <li class="list-decimal text-secondary lazy-render">
<div class="flex justify-between">
<a href="{{ .Permalink }}">{{ .LinkTitle }}</a>
<a href="/{{ .Section }}" class="font-mono text-secondary">{{ .Section }}</a>
diff --git a/layouts/essays/section.html b/layouts/essays/section.html
index f5a08ace..40baea9e 100644
--- a/layouts/essays/section.html
+++ b/layouts/essays/section.html
@@ -16,7 +16,7 @@
)}}
{{ range .Pages.GroupByDate "January" }}
- <details class="posts-month-archive"{{ if gt $remainingMonthsToOpen 0 }} open{{ end }}>
+ <details class="lazy-render"{{ if gt $remainingMonthsToOpen 0 }} open{{ end }}>
<summary class="flex items-center border-b border-b-dashed border-[var(--border-color)] py-2 px-1">
<h2 class="text-size-lg inline-block w-full m-0
flex justify-between items-center">
diff --git a/layouts/highlights.html b/layouts/highlights.html
index 9d7c13bf..f9f9c030 100644
--- a/layouts/highlights.html
+++ b/layouts/highlights.html
@@ -6,12 +6,12 @@
</div>
<!-- Highlights -->
{{ range shuffle site.Data.highlights }}
- <section class="post-content">
+ <section class="post-content lazy-render">
<h3><a href="{{ .url }}">《{{ .title }}》</a></h3>
<ul class="list-none">
{{ range .highlights }}
<li class="my-4 text-lg">
- <a class="font-italic hover:no-underline" href="{{ .link }}">{{ .text | markdownify }}</a>
+ <a class="hover:no-underline" href="{{ .link }}">{{ .text | markdownify }}</a>
</li>
{{ end }}
</ul>
diff --git a/layouts/section.html b/layouts/section.html
index a70c6cd1..7497a217 100644
--- a/layouts/section.html
+++ b/layouts/section.html
@@ -25,7 +25,7 @@
)}}
{{ range .Pages.GroupByDate "January" }}
- <div class="posts-month-archive"{{ if gt $remainingMonthsToOpen 0 }} open{{ end }}>
+ <div class="lazy-render"{{ if gt $remainingMonthsToOpen 0 }} open{{ end }}>
<h2 class="text-size-lg inline-block w-full m-0
flex justify-between items-center">
{{ .Key }}