-
We maintain documentation for a PaaS product that supports multiple platforms, and we are keeping API reference files generated from platform-specific tools such as Dokka, Jazzy, Doxygen, and Typedoc as static resources. While the documentation itself supports multiple locales, the API reference files are in English only and located under the
Since the API reference is in English only, we use
However, we recently found out that the content of
Among the files above, all the files in the locale-specific directories are unused and only take up storage space. Is there a way to improve the current situation? (For your reference, the tested version of Docusaurus is 2.2.0.) |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
That's the behavior we choose for the static directory, and it makes sense for many other use-cases to keep it that way. If you don't want one copy of the api ref per locale, then you can simply not use the static directory. You could build your site and at the end do You don't need Docusaurus in practice to "merge" static files of multiple tools, and |
Beta Was this translation helpful? Give feedback.
-
There's other considerations that prevent us from using this suggestion. We need to verify the API reference as part of the site URL while previewing the site with If we keep using the static directory, a workaround would be to add a script to delete the API reference files copied to each locale directory and make the script run after So I'm wondering if it's feasible to add a configuration to exclude some directory under |
Beta Was this translation helpful? Give feedback.
-
Another thing to note is that, in order to use localized assets (images, diagrams, etc.) for each locale in a multi-language site, a typical method would be to place asset files by locale under
or
and all these files would be copied to each locale directory during build, while most of them would be unused except in the corresponding locale. This might be a more complicated case than the original inquiry, but I think it would be beneficial if there is some configuration to control the inclusion/exclusion of certain files under |
Beta Was this translation helpful? Give feedback.
-
Hi, same issue here. Is there an option to disable copying static files to different locales when building, I would prefer using the same static folder for all my i18n locales. Thanks. |
Beta Was this translation helpful? Give feedback.
Hey that solves your use-case and is easy so why isn't this good enough?
I feel like we are trying to achieve useless micro-optimisations here.
Is this really a problem in practice to deploy this duplicate api ref?
Is copying for each locale + deleting a perf issue of any kind that's worth us to fix?
There is not config to exclude static directories, but we have
staticDirectories
to let you provide your own list.https://docusaurus.io/docs/3.0.1/api/docusaurus-config#staticDirectories
Combined with the locale env variable (#4542 (comment)), that could solve the same use-case.
You could for example only list an api-ref static directory if locale is und…