docs: describe useSite/usePage runtime hooks#2887
Conversation
✅ Deploy Preview for rspress-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
|
Co-authored-by: SoonIter <79413249+SoonIter@users.noreply.github.com>
Rsdoctor Bundle Diff Analysis📁 webPath:
📦 Download Diff Report: web Bundle Diff Generated by Rsdoctor GitHub Action |
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive documentation for two runtime hooks, useSite and usePage, which were previously undocumented. The useSite hook returns the normalized site configuration from rspress.config.ts, while usePage exposes metadata extracted from the current Markdown or MDX page.
- Added English and Chinese documentation pages for both hooks
- Included practical code examples demonstrating hook usage
- Updated navigation metadata to include the new documentation pages
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| website/docs/en/ui/hooks/use-site.mdx | Documents the useSite hook, explaining it returns normalized site configuration with examples |
| website/docs/en/ui/hooks/use-page.mdx | Documents the usePage hook, showing how to access current page metadata |
| website/docs/zh/ui/hooks/use-site.mdx | Chinese translation of useSite documentation |
| website/docs/zh/ui/hooks/use-page.mdx | Chinese translation of usePage documentation |
| website/docs/en/ui/hooks/_meta.json | Adds navigation entries for the new English hook documentation |
| website/docs/zh/ui/hooks/_meta.json | Adds navigation entries for the new Chinese hook documentation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The hooks
useSite(normalizedrspress.config.ts) andusePage(per-page MDX/Markdown metadata) lacked documentation.useSiteandusePageexplaining returned data (normalized site config and parsed page metadata) with usage guidance.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.