Skip to content

feat(core): add logoHref config option#3012

Merged
SoonIter merged 1 commit intomainfrom
syt-vibe-kanban/edc5-logo-href
Jan 19, 2026
Merged

feat(core): add logoHref config option#3012
SoonIter merged 1 commit intomainfrom
syt-vibe-kanban/edc5-logo-href

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Jan 15, 2026

Summary

Add a new logoHref configuration option to customize the logo link destination.

Related Issue

closes #2952

close #2963

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

AI Summary

What changes were made

  1. Type definitions (packages/shared/src/types/index.ts):

    • Added new logoHref property to UserConfig interface with default value /${lang}/
    • Added logoHref property to SiteData interface
  2. createSiteData (packages/core/src/node/runtimeModule/siteData/createSiteData.ts):

    • Added logoHref to the siteData object
  3. NavTitle component (packages/core/src/theme/components/Nav/NavTitle.tsx):

    • Extract logoHref from site config
    • Use logoHref || defaultHref for the Link component, prioritizing custom href over the default language home page
  4. Documentation (English and Chinese):

    • Added new logoHref configuration section with type string and default value /${lang}/
    • Added usage examples

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 logoHref is not specified, the logo still links to the current language's home page as before.

Usage

export default defineConfig({
  logo: '/logo.png',
  logoHref: 'https://example.com',
});

This PR was written using Vibe Kanban


Copilot AI review requested due to automatic review settings January 15, 2026 12:01
@netlify
Copy link
Copy Markdown

netlify bot commented Jan 15, 2026

Deploy Preview for rspress-v2 ready!

Name Link
🔨 Latest commit 71133af
🔍 Latest deploy log https://app.netlify.com/projects/rspress-v2/deploys/696dccf34267fb00080f52e2
😎 Deploy Preview https://deploy-preview-3012--rspress-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@SoonIter SoonIter changed the title 增加 logo 的 href 配置 (vibe-kanban) feat(core): add href option to logo config Jan 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Logo type interface to include an optional href property for custom link configuration
  • Updated documentation (Chinese and English) to reflect the new href option with usage examples
  • Modified NavTitle component to extract and use the custom logoHref when 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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 15, 2026

Rsdoctor Bundle Diff Analysis

Found 3 projects in monorepo, 3 projects with changes.

📊 Quick Summary
Project Total Size Change
node 10.5 MB +7.5 KB (0.1%)
web 15.9 MB +6.2 KB (0.0%)
node_md 1.3 MB +1.6 KB (0.1%)
📋 Detailed Reports (Click to expand)

📁 node

Path: website/doc_build/diff-rsdoctor/node/rsdoctor-data.json

📌 Baseline Commit: 38a630e23f | PR: #3008

Metric Current Baseline Change
📊 Total Size 10.5 MB 10.5 MB +7.5 KB (0.1%)
📄 JavaScript 0 B 0 B 0
🎨 CSS 0 B 0 B 0
🌐 HTML 10.5 MB 10.5 MB +7.5 KB (0.1%)
📁 Other Assets 0 B 0 B 0

📦 Download Diff Report: node Bundle Diff

📁 web

Path: website/doc_build/diff-rsdoctor/web/rsdoctor-data.json

📌 Baseline Commit: 38a630e23f | PR: #3008

Metric Current Baseline Change
📊 Total Size 15.9 MB 15.9 MB +6.2 KB (0.0%)
📄 JavaScript 15.1 MB 15.1 MB +5.4 KB (0.0%)
🎨 CSS 125.9 KB 125.9 KB 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 726.6 KB 725.9 KB +780.0 B (0.1%)

📦 Download Diff Report: web Bundle Diff

📁 node_md

Path: website/doc_build/diff-rsdoctor/node_md/rsdoctor-data.json

📌 Baseline Commit: 38a630e23f | PR: #3008

Metric Current Baseline Change
📊 Total Size 1.3 MB 1.3 MB +1.6 KB (0.1%)
📄 JavaScript 0 B 0 B 0
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 1.3 MB 1.3 MB +1.6 KB (0.1%)

📦 Download Diff Report: node_md Bundle Diff

Generated by Rsdoctor GitHub Action

@SoonIter SoonIter force-pushed the syt-vibe-kanban/edc5-logo-href branch from 6daf209 to 3f37a66 Compare January 19, 2026 03:21
@SoonIter SoonIter changed the title feat(core): add href option to logo config feat(core): add logoHref config option Jan 19, 2026
@SoonIter SoonIter requested a review from Timeless0911 January 19, 2026 05:14
Timeless0911
Timeless0911 previously approved these changes Jan 19, 2026
- 新增 `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 点击后仍然跳转到首页(保持向后兼容)。
@SoonIter SoonIter merged commit bc079bc into main Jan 19, 2026
8 checks passed
@SoonIter SoonIter deleted the syt-vibe-kanban/edc5-logo-href branch January 19, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support custom URL for navbar logo [Feature]: Custom the href link of logo

3 participants