Add related posts section and blog search

This commit is contained in:
2025-11-18 16:43:52 +08:00
parent 0df0a85579
commit 4b3329d66f
4 changed files with 203 additions and 54 deletions

View File

@@ -54,6 +54,7 @@ Markdown content (posts & pages) lives in a separate repository and is consumed
- **Blog index** (`/blog`)
- Uses `PostListWithControls`:
- Keyword search filters posts by title, tags, and excerpt with instant feedback.
- Sort order: new→old or old→new.
- Pagination using `siteConfig.postsPerPage`.
@@ -62,6 +63,7 @@ Markdown content (posts & pages) lives in a separate repository and is consumed
- Top: published date, large title, colored tags.
- Body: `prose` typography with tuned light/dark colors, images, blockquotes, code.
- Top bar: reading progress indicator.
- Bottom: "相關文章" cards suggesting up to three related posts that share overlapping tags.
- **Right sidebar** (on large screens)
- Top hero:
@@ -77,6 +79,29 @@ Markdown content (posts & pages) lives in a separate repository and is consumed
- **Misc**
- Floating "back to top" button on long pages.
## Motion & Interaction Guidelines
- Keep motion subtle and purposeful:
- Use small translations (±24px) and short durations (200400ms, `ease-out`).
- Prefer fade/slide-in over large bounces or rotations.
- Respect user preferences:
- Animations that run on their own are wrapped with `motion-safe:` so they are disabled when `prefers-reduced-motion` is enabled.
- Reading experience first:
- Scroll-based reveals are used sparingly (e.g. post header and article body), not on every small element.
- TOC and reading progress bar emphasize orientation, not decoration.
- Hover & focus:
- Use light elevation (shadow + tiny translateY) and accent color changes to indicate interactivity.
- Focus states remain visible and are not replaced by motion-only cues.
### Implemented Visual Touches
- Reading progress bar with a soft gradient glow at the top of post pages.
- Scroll reveal for post header + article body (`ScrollReveal` component).
- Hover elevation + gradient accents for post cards, list items, sidebar author card, and tag chips.
- Smooth theme toggle with icon rotation and global `transition-colors` on the page background.
- TOC smooth scrolling + short-lived highlight on the target heading.
- Subtle hover elevation for `blockquote` and `pre` blocks inside `.prose` content.
## Prerequisites
- Node.js **18+**