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

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

Open
Timeless0911 opened this issue Apr 8, 2024 · 4 comments
Labels
🐞 bug Something isn't working 👏 PR welcome

Comments

@Timeless0911
Copy link
Collaborator

Timeless0911 commented Apr 8, 2024

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 Timeless0911 added 🐞 bug Something isn't working 👏 PR welcome labels Apr 8, 2024
@shulaoda
Copy link
Contributor

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.

@Timeless0911
Copy link
Collaborator Author

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.

@shulaoda
Copy link
Contributor

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)

@Timeless0911
Copy link
Collaborator Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 👏 PR welcome
Projects
None yet
Development

No branches or pull requests

2 participants