feat: 完善站内搜索、索引校验与折叠侧栏 - #46
Merged
LeoninCS merged 4 commits intoAug 5, 2026
Merged
Conversation
Contributor
Author
LeoninCS
marked this pull request as ready for review
August 4, 2026 16:29
Owner
|
@copilot 请修复此拉取请求中的合并冲突。 |
There was a problem hiding this comment.
Pull request overview
该 PR 面向 GoClub(Hugo 静态站点)完善站内搜索能力(索引字段、筛选、状态恢复与高亮)、新增搜索索引覆盖校验脚本并接入 CI,同时优化侧栏折叠/可调宽度交互,并补充一条“每日一问”内容。
Changes:
- 新增搜索索引覆盖校验脚本
scripts/check_search_index.py,并在 PR/部署/每日同步工作流中强制校验。 - 重做/增强搜索前端:新增索引模板
assets/search-data.json、搜索逻辑assets/search.js、搜索 UI 样式与交互(筛选、摘要、高亮、滚动加载、状态恢复等)。 - 侧栏新增可拖拽调宽(含键盘操作),折叠时隐藏更多侧栏内部元素;并补充每日一问 2026.03.30 答案。
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/check_search_index.py | 新增索引覆盖/重复/栏目/锚点校验脚本,用于 CI 兜底发现漏收录与坏链接。 |
| layouts/partials/docs/inject/body.html | 侧栏折叠/宽度持久化与拖拽调宽交互逻辑。 |
| layouts/baseof.html | 侧栏结构中加入可拖拽调宽的 resizer 元素。 |
| layouts/_partials/docs/search.html | 新增搜索弹层与栏目筛选按钮 DOM(但当前路径疑似无法被 Hugo partial 解析命中)。 |
| content/docs/baguwen/每日一问.md | 补充 2026.03.30 “自旋锁和互斥锁的区别”答案。 |
| assets/search.js | 新增/增强 Fuse 搜索逻辑:筛选、排序、摘要、高亮、滚动加载、状态恢复等。 |
| assets/search-data.json | 新增搜索索引生成模板,补充栏目/type/headings/content 等字段。 |
| assets/_custom.scss | 新增搜索弹层/筛选/高亮样式与侧栏折叠隐藏逻辑、resizer 样式。 |
| .github/workflows/static.yml | 部署工作流增加索引覆盖校验步骤。 |
| .github/workflows/pr-check.yml | PR 检查增加索引覆盖校验步骤。 |
| .github/workflows/daily-question-sync.yml | 每日同步后增加索引覆盖校验步骤。 |
| var tocControl = document.getElementById("toc-control"); | ||
| var minWidth = 272; | ||
| var maxWidth = 520; | ||
| var defaultWidth = parseFloat(getComputedStyle(root).getPropertyValue("--goclub-sidebar-width")) || 288; |
Comment on lines
+1
to
+4
| {{ if default true .Site.Params.BookSearch }} | ||
| <div class="book-search hidden"> | ||
| <div class="book-search-topbar"> | ||
| <div> |
Contributor
Author
There was a problem hiding this comment.
验证结果表明第二条建议的前提不成立:项目使用 Hugo 0.159.0,主题最低要求 0.158.0.
主题自身和项目覆盖都使用 layouts/_partials;partial "docs/search" 正是从该路径加载。移动到 layouts/partials 会偏离当前 Hugo 模板体系。
Contributor
Author
|
冲突已解决,可以安全合并了 @LeoninCS |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
说明
这是与 #44 分离的第二个 PR。本 PR 不包含 #44 中的博客卡片 URL 换行和侧栏按钮层级调整,建议先合并 #44,以获得完整的侧栏显示修复。
改动概览
本 PR 完善站内搜索、栏目筛选和搜索索引覆盖检查,同时优化折叠侧栏的隐藏布局,并补充一条缺失的每日一问答案。
主要改动
站内搜索
搜索索引校验
scripts/check_search_index.py。折叠侧栏
GC标识和展开按钮。内容补充
用户影响
验证
hugo --minify构建通过,共生成 439 个页面。python scripts/check_search_index.py --site public通过:469 条索引记录,覆盖 402 个内容页面。ruff check与ruff format --check通过。