diff options
| author | verdant <im@verdant.ee> | 2026-05-31 16:33:36 +0800 |
|---|---|---|
| committer | verdant <im@verdant.ee> | 2026-05-31 16:33:36 +0800 |
| commit | 172adfb014596423d7cc3043f2a288ac01884cba (patch) | |
| tree | f788b0b10f330daf8c3a6d1a8ed656a1d1253390 /layouts/archives/single.html | |
| parent | f9869a2cf060976c69aeade3d3f231bf1fbdddd3 (diff) | |
| download | blog-172adfb014596423d7cc3043f2a288ac01884cba.tar.gz blog-172adfb014596423d7cc3043f2a288ac01884cba.zip | |
Add minify configuration, modify favicon url
Diffstat (limited to 'layouts/archives/single.html')
| -rw-r--r-- | layouts/archives/single.html | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/layouts/archives/single.html b/layouts/archives/single.html index 60ec3e4..dc089ff 100644 --- a/layouts/archives/single.html +++ b/layouts/archives/single.html @@ -15,52 +15,6 @@ </small> {{ end }} - {{ if .Site.Params.postSearch }} - <input id="search-input" type="text" placeholder="Search..." style="margin-top: 16px" /> - <script> - // 等待 DOM 完全加载后执行 - document.addEventListener('DOMContentLoaded', function () { - // 缓存 DOM 元素 - const searchInput = document.getElementById('search-input'); - const posts = document.querySelectorAll('.blog-posts li'); - const years = document.querySelectorAll('.blog-posts h3'); - - // 更新搜索结果 - function updateSearchResults(searchTerm) { - let visiblePosts = 0; - const displayedYears = new Set(); - posts.forEach(function (post) { - const title = post.querySelector('a').textContent.toLowerCase(); - const year = post.querySelector('time').getAttribute('datetime').split('-')[0]; - if (title.includes(searchTerm)) { - post.style.display = ''; - visiblePosts++; - displayedYears.add(year); - } else { - post.style.display = 'none'; - } - }); - - {{ if .Site.Params.groupByYear }} - years.forEach(function (y) { - const year = y.textContent; - y.style.display = displayedYears.has(year) ? '' : 'none'; - }); - {{ end }} - - {{ if .Site.Params.showPostCount }} - const countText = `There ${visiblePosts <= 1 ? `is ${visiblePosts} piece.` : `are ${visiblePosts} pieces.`}`; - document.getElementById('post-count').innerHTML = countText; - {{ end }} - } - - searchInput.addEventListener('input', function () { - updateSearchResults(this.value.toLowerCase().trim()); - }); - }); - </script> - {{ end }} - {{ $allPosts := where .Site.RegularPages "Type" "eq" "posts" }} {{ $excludePosts := where $allPosts "Params.categories" "intersect" (slice "1") }} {{ $postPages := ($allPosts | complement $excludePosts) }} |
