rspress icon indicating copy to clipboard operation
rspress copied to clipboard

[Bug]: action.link in HomeHero Component doesn't generate link with language prefix

Open Timeless0911 opened this issue 1 year ago • 4 comments

Version

-

Details

https://github.com/web-infra-dev/rspress/blob/main/packages/theme-default/src/components/HomeHero/index.tsx#L66

image

we need to manually add zh prefix to config link in zh docs

Reproduce link

https://github.com/web-infra-dev/rspress/blob/main/packages/document/docs/zh/index.md?plain=1#L17

Reproduce Steps

  • pnpm run dev

Timeless0911 avatar Apr 08 '24 11:04 Timeless0911

I think it should be resolved by the compiler, as most of the other links are done through the compiler. In addition, if dynamic linking is required, it should be resolved through the theme to use useLang with normalizeHref.

shulaoda avatar Apr 23 '24 11:04 shulaoda

I think it should be resolved by the compiler, as most of the other links are done through the compiler. In addition, if dynamic linking is required, it should be resolved through the theme to use useLang with normalizeHref.

This is a point that can be optimized. The experience should be the same as the link in the mdx file, with the lang prefix automatically added. Currently, the hero component has no related normalizeHref operation.

Timeless0911 avatar Apr 23 '24 11:04 Timeless0911

I think it should be resolved by the compiler, as most of the other links are done through the compiler. In addition, if dynamic linking is required, it should be resolved through the theme to use useLang with normalizeHref.

This is a point that can be optimized. The experience should be the same as the link in the mdx file, with the lang prefix automatically added. Currently, the hero component has no related normalizeHref operation.

So, how should I solve this problem? Compiler or Component (theme-default)

shulaoda avatar Apr 23 '24 11:04 shulaoda

So, how should I solve this problem? Compiler or Component (theme-default)

I think component is better for theme related like i18n and multiversion. @sanyuan0704 What's your opinion?

Timeless0911 avatar Apr 23 '24 11:04 Timeless0911