Links using file paths and custom style #11870
-
|
Hi, I am trying to use the Button component (https://docusaurus.community/knowledge/component-library/new/Button/) on our website. It seems I cannot use file paths in that case, although the Link component is used behind the scene which unfortunately turns out to be a problem in my case. Say my file is I cannot use the relative file paths as I would do in pure Markdown, for example Currently my workaround is to use an absolute URL but it will cause some issues if the slurgs change and maybe if I use internationalization. Is this expected? Best, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
File path links are only supported within md/mdx files, and are not supported by JSX/React components. It is unrelated to the
We have utils to append automatically the site baseUrl (including the i18n baseUrl locale) to React links: https://docusaurus.io/docs/docusaurus-core#useBaseUrl |
Beta Was this translation helpful? Give feedback.

If you want to support a site in English and French, you have 2 strategies common:
example.com+fr.example.com/+/fr/baseUrlAnn URL will break only if you use the subpath strategy because your pathnames will eventually have a locale
/fr/prefix so the path is not correct anymoreThe solution is explained in the doc link I provided:
Our
<Link>component is something we provide, and we enhanced it to automatically add that base URL prefix for you. This ensures that most links do …