Open recoluan opened 4 years ago
directories:[
{
id: "zh",
dirname: "_zh",
path: "/zh/",
itemLayout: "Post",
itemPermalink: "/zh/:year/:month/:day/:slug",
},
{
id: "en",
dirname: "_en",
path: "/en/",
itemLayout: "Post",
itemPermalink: "/en/:year/:month/:day/:slug",
}
]
Would this configuration meet your needs?
@newsbielt703 For Example,the date formatting needs to be localized,the default is in English,which is so unreadable for non-native English speakers.
@songzhi This plugin doesn't provide date formatting. Probably, you've mixed up blog theme and blog plugin. Btw, blog theme has supported for custom date.
directories:[ { id: "zh", dirname: "_zh", path: "/zh/", itemLayout: "Post", itemPermalink: "/zh/:year/:month/:day/:slug", }, { id: "en", dirname: "_en", path: "/en/", itemLayout: "Post", itemPermalink: "/en/:year/:month/:day/:slug", } ]
Would this configuration meet your needs?
What if I want to set a baseLang?
I mean We don't want xxx.com/en/xxxx
, just xxx.com/xxxx
. We can not deal with that with the option you provided.
Can the dirname
change to accept a glob list, or add a excludedirname
option?
As a workaround, I can fliter the results by using computed options in my layout components, but I still want this feature to support mitulanguage.
Hi @Mister-Hope ,
I mean We don't want
xxx.com/en/xxxx
, justxxx.com/xxxx
. We can not deal with that with the option you provided.
sorry I don't get it. the path is configurable, such as
directories:[
{
id: "zh",
dirname: "_zh",
path: "/zh/",
itemPermalink: "/zh/:year/:month/:day/:slug",
},
{
id: "en",
dirname: "/",
path: "/en/",
itemPermalink: "/:year/:month/:day/:slug",
}
]
Besides, there're some configurable options such as title
, frontmatter
, getPaginationPageTitle
to improve flexibility.
Nevertheless, making dirname
accept a glob list is a good idea.
Hi @Mister-Hope ,
I mean We don't want
xxx.com/en/xxxx
, justxxx.com/xxxx
. We can not deal with that with the option you provided.sorry I don't get it. the path is configurable, such as
directories:[ { id: "zh", dirname: "_zh", path: "/zh/", itemPermalink: "/zh/:year/:month/:day/:slug", }, { id: "en", dirname: "/", path: "/en/", itemPermalink: "/:year/:month/:day/:slug", } ]
Besides, there're some configurable options such as
title
,frontmatter
,getPaginationPageTitle
to improve flexibility.
Excuse me, I think that will cause the en page contains zh tags which I don't want.
As I said, I can filter the auto-generated result, but I still think that excluding it directly will be better
Oops, I modified the wrong line.
directories:[
{
id: "zh",
dirname: "_zh",
path: "/zh/",
itemPermalink: "/zh/:year/:month/:day/:slug",
},
{
id: "en",
dirname: "_en",
path: "/",
itemPermalink: "/:year/:month/:day/:slug",
}
]
That's what I meant.
Oops, I modified the wrong line.
directories:[ { id: "zh", dirname: "_zh", path: "/zh/", itemPermalink: "/zh/:year/:month/:day/:slug", }, { id: "en", dirname: "_en", path: "/", itemPermalink: "/:year/:month/:day/:slug", } ]
That's what I meant.
But that will make the original markdown links wrong. It means all the xxx.com/yyy/zzz.html
will move to xxx.com/en/yyy/zzz.html
I just want to add a tag list page and a category list page. And hope that a certain language page do not contain tags or category from another language. Also don't want to change the original link rendered by the folder and file name structure. This is what I want, and I think that this need is common, at least is not strange. And I don't think I can make this without filtering results or add permalinks in markdown files as workaround. This struture is the same as Vuepress Offical Docs.
That's why I suggest the dirname change to accept a glob list, or adding a excludedirname
option which can accept a dir list.
Or maybe you can add the same locales logic from vuepress
, and add a new localesConfig
option? Let the user config some templates once in the localesConfig
and apply it on all the languages by reading the themeConfig.locales
(or the locales option user give to you).
I think the first one can be an enhance, while the second one is a prefect solution when the project has muti languages.
But that will make the original markdown links wrong. It means all the xxx.com/yyy/zzz.html will move to xxx.com/en/yyy/zzz.html
No it won't, please look carefully at the documentation and the config I offered itemPermalink: "/:year/:month/:day/:slug"
, both the link and dirname are configurable.
Also don't want to change the original link rendered by the folder and file name structure.
Therefore, the links are not totally rendered by the folder and file name structure as you mentioned.
However, I'll carefully consider the locales
config you suggested. 😉
But that will make the original markdown links wrong. It means all the xxx.com/yyy/zzz.html will move to xxx.com/en/yyy/zzz.html
No it won't, please look carefully at the documentation and the config I offered
itemPermalink: "/:year/:month/:day/:slug"
, both the link and dirname are configurable.
First, how can I config itemPermalink
, if I am not misunderstanding, a/b/c.md
's slug is a_b_c
. So you are suggesting me to write ../:regular
? I am not sure if it works, but I will try it tomorrow.
Besides, as I explained, my project are docs which it's pages are containing lot's of another pages' links. It's heavily depending on the file structure. So I don't think it's a good idea to make my local source file structure and the render results structure different. And I think that costs to much for just a category page and a tag page for each of my language in my website.
Let me explain it more carefully with this example, I have A,B,C,D,E,zh
in my doc folder, and in zh
there is also A,B,C,D,E
five folder. I have fully config the navbar and sidebar options, and in my docs, insteadof writing ../../../B/a/b/c.md
from A/a/b/c.md
I often use absolute links /B/a/b/c.md
.
The first thing you want me to do is to change them to zh,en
with has A,B,C,D,E
. In fact,though I know there is itemPerminak link, I still don't know how can solve it, besides there are lots of problems happening.
The main effect is that it will render two en docs, one in base, another in base/en
.That means if user try to visit xx.com/en/yyy
, then it's reachable, and that will case issue if I am writing relative links to anothor language or another website(I serve muti docs on different base in my domain).
Second, I have a folder helding assets for muti language in doc root folder, I have to rewrite every assets path to make them correct.
Third, I have to careful, and remember any time that when I am working on en docs, my path is uncorrect. I have to check every path intelligense my editor gave to me.
I really don't think it's a good idea that when I am writing a docs base on file structures, while they are naviagting to each other, my render structure is different from my source file structure. Beside the render results contain xxx.com/en/yyy
which I don't want.
However, I'll carefully consider the
locales
config you suggested. 😉
When can we have it? I really don't want to change my file structure?
Feature request
What problem does this feature solve?
How can I configure internationalization for routes generated by
@vuepress/plugin-blog
?What does the proposed API look like?
How should this be implemented in your opinion?
Are you willing to work on this yourself?
No