feat(config): Hierarchical site configuration using distributed config files#4660
Conversation
…into feat/hierarchical-theme-config
|
An obvious downside is we can't use node stuff in configs. What if we glob and load all the configs at plugin-level instead of doing it via import.meta.glob in client code? We can create a virtual module that exports |
|
Also, the site appears to be broken. There is probably a circular dependency somewhere in generated code. |
|
/publish |
commit: |
This seems like a better solution. I'll try to adapt this approach. |
Updates:1. Removed
|
…tion overloading
|
Thanks a lot! 🙌 Overall looks good. I'll test some stuff locally and merge if nothing pops up. |
Summary of update:Code Cleanup
Typing Helper
There is no major change since last review. This PR should be ready to merge. |
ee9e572 to
01f600f
Compare
|
Something is wrong with stacking. Try opening http://localhost:5173/zh/guide/what-is-vitepress, then change language to Portuguese from switcher in navbar. It goes to http://localhost:5173/pt/zh/guide/what-is-vitepress but it should go to http://localhost:5173/pt/guide/what-is-vitepress. Also, the debug logs say: Here the third one shouldn't be there? Seems to be broken since the ssr refactor commit - a2a297e |
|
@brc-dd this is fixed. The fix is very simple: add There are actually two issues in the code that makes the problem intertwined:
I think this also needs to be fixed. I can do a separate PR for this later. |
2d31f61 to
d5b1563
Compare

Description
Summary of changes
src/client/app/data.ts:
initData()to dynamically computesiteDataand apply extra configuration layers based onroute.relativePath.src/client/app/utils.ts:
stackView()and supporting utilities to merge multiple layers of objects into a readonly view, without mutating the original objects - this is important because certain layers may be dropped later when user navigates outside its scope.Configuration Files
The configuration files are moved from
.vitepress/configto their corresponding language subdirectories (e.g.docs/.vitepress/config/en.ts->docs/en/config.ts) to demonstrate the benefits of the proposed changes. In addition, a language-specific locale is added for 404 pages under/zh/directory. It is reflected in the rendered preview.Linked Issues
closes #4659
closes #4654
Additional Context
Please refer to the linked issue for highlights of this PR.
Tip
The author of this PR can publish a preview release by commenting
/publishbelow./publish