Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: When the site configures the base path, how to introduce the logo in hero #1387

Open
zzzz-bang opened this issue Sep 4, 2024 · 3 comments

Comments

@zzzz-bang
Copy link

What problem does this feature solve?

静态资源配置了
builderConfig: {
output: {
assetPrefix: "/help/",
},
},
但是最后显示还是有问题

What does the proposed API look like?

能够正常引入显示

@SoonIter
Copy link
Member

SoonIter commented Sep 4, 2024

try this

export default defineConfig({
  root: path.join(__dirname, 'docs'),
  base: '/base',
  icon: '/rspress-light-logo.png',
  logo: {
    light: '/rspress-light-logo.png',
    dark: '/rspress-dark-logo.png',
  },
})

@SoonIter SoonIter changed the title [Feature]: 当站点配置了 base 路径,在hero里主页logo如何引入 [Feature]: When the site configures the base path, how to introduce the logo in hero Sep 4, 2024
@zzzz-bang
Copy link
Author

try this

export default defineConfig({
  root: path.join(__dirname, 'docs'),
  base: '/base',
  icon: '/rspress-light-logo.png',
  logo: {
    light: '/rspress-light-logo.png',
    dark: '/rspress-dark-logo.png',
  },
})

我就是这么引入的,但是本地启动没问题,构建部署后就显示不了,需要手动在控制台资源里加上base

@Timeless0911
Copy link
Collaborator

Try to use

import { normalizeImagePath } from 'rspress/runtime';

export default defineConfig({
  root: path.join(__dirname, 'docs'),
  base: '/base',
  icon: normalizeImagePath('/rspress-light-logo.png'),
  logo: {
    light: normalizeImagePath('/rspress-light-logo.png'),
    dark: normalizeImagePath('/rspress-dark-logo.png'),
  },
})

refer: https://rspress.dev/zh/guide/basic/static-assets#mdx-%E4%B8%AD%E4%BD%BF%E7%94%A8%E7%9A%84%E9%9D%99%E6%80%81%E8%B5%84%E6%BA%90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants