Conversation
✅ Deploy Preview for rspress-v2 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR adds support for customizing the logo's href configuration in Rspress, allowing users to specify a custom link for the logo instead of defaulting to the home page. This resolves GitHub issue #2952.
Changes:
- Extended the
Logotype interface to include an optionalhrefproperty for custom link configuration - Updated documentation (Chinese and English) to reflect the new
hrefoption with usage examples - Modified
NavTitlecomponent to extract and use the customlogoHrefwhen provided
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
website/docs/zh/api/config/config-basic.mdx |
Updated Chinese documentation with type definition and usage example for logo href |
website/docs/en/api/config/config-basic.mdx |
Updated English documentation with type definition and usage example for logo href |
packages/shared/src/types/index.ts |
Added new Logo interface with light, dark, and optional href properties; updated type references |
packages/core/src/theme/components/Nav/NavTitle.tsx |
Refactored to extract logoHref from logo config and use it in the Link component |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Rsdoctor Bundle Diff AnalysisFound 3 projects in monorepo, 3 projects with changes. 📊 Quick Summary
📋 Detailed Reports (Click to expand)📁 nodePath:
📦 Download Diff Report: node Bundle Diff 📁 webPath:
📦 Download Diff Report: web Bundle Diff 📁 node_mdPath:
📦 Download Diff Report: node_md Bundle Diff Generated by Rsdoctor GitHub Action |
6daf209 to
3f37a66
Compare
- 新增 `Logo` 接口,包含 `light`、`dark` 和可选的 `href` 属性
- 更新 `UserConfig.logo` 和 `SiteData.logo` 类型为 `string | Logo`
- 修改 `useMemo` 返回值,同时返回 logo 元素和 `logoHref`
- 当 logo 配置为对象时,提取 `href` 属性
- Link 组件使用 `logoHref ?? defaultHref`,优先使用自定义 href,否则使用默认的首页链接
- 更新英文文档 (`website/docs/en/api/config/config-basic.mdx`)
- 更新中文文档 (`website/docs/zh/api/config/config-basic.mdx`)
- 添加 `href` 配置说明和示例代码
```ts
export default defineConfig({
logo: {
dark: '/logo-dark.png',
light: '/logo-light.png',
href: 'https://example.com', // 自定义 logo 链接
},
});
```
如果不指定 `href`,logo 点击后仍然跳转到首页(保持向后兼容)。
3f37a66 to
71133af
Compare
Summary
Add a new
logoHrefconfiguration option to customize the logo link destination.Related Issue
closes #2952
close #2963
Checklist
AI Summary
What changes were made
Type definitions (
packages/shared/src/types/index.ts):logoHrefproperty toUserConfiginterface with default value/${lang}/logoHrefproperty toSiteDatainterfacecreateSiteData (
packages/core/src/node/runtimeModule/siteData/createSiteData.ts):logoHrefto the siteData objectNavTitle component (
packages/core/src/theme/components/Nav/NavTitle.tsx):logoHreffrom site configlogoHref || defaultHreffor the Link component, prioritizing custom href over the default language home pageDocumentation (English and Chinese):
logoHrefconfiguration section with typestringand default value/${lang}/Why these changes were made
Users requested the ability to customize the logo link destination (e.g., to link to an external website or a different internal page). This feature enables that flexibility while maintaining backward compatibility - if
logoHrefis not specified, the logo still links to the current language's home page as before.Usage
This PR was written using Vibe Kanban