ropensci-review-tools / babelquarto

Renders a Multilingual Quarto Project (Book or Website)
https://docs.ropensci.org/babelquarto/
Other
40 stars 7 forks source link

Attempt at fixing multilingual websites #58

Closed Nenuial closed 3 months ago

Nenuial commented 3 months ago

I was trying to setup a more elaborate multilingual website using the changes in #54. I quickly ran into a number of issues with my listings that were showing both my french and english pages.

I've tried to fix this for me so that each language is rendered clean without duplicate qmd files. I also made sure that a mainlanguage file gets copied when there is no specific language file available. I believe this is the behaviour with books, and I like it so. But that maybe isn't the case for everybody?

I've made a number of changes, but I must admit that I don't fully understand everything babelquarto does. Therefore, I am not entirely confident that my changes don't introduce some problems with other setups. It did however allow me to render a multilingual website with pages organised in subfolders and everything renders neatly without duplicates.

maelle commented 3 months ago

:wave: @Nenuial, thank you! Do you have a reprex of your problem?

I've just merged another PR that included some refactoring of the file, hence the conflicts, please have a look but really I'd like to see a reprex first so you don't lose time on this.

maelle commented 3 months ago

I also made sure that a mainlanguage file gets copied when there is no specific language file available

I don't use babelquarto for websites myself but I think users like @joelnitta @beatrizmilz were not necessarily intending both versions to be the same. Furthermore using the main language file as specific language file in production would mean the metadata of the page is wrong (indicating it's German while it's English for instance) and I suspect this could lead to SEO problems.

Nenuial commented 3 months ago

Of course, here's an example of what I mean. The repository is here : https://github.com/Nenuial/babeltest And the rendered website can be seen here: https://test.nenuial.org

If you have a look at this page for example: https://test.nenuial.org/Introduction/index.html The listing should only have two pages: Grading and Paper. Grading has both a french and an english version. Paper only has an english version.

There are also issues with the language links. If you have a look at the english version of the Grading page: https://test.nenuial.org/Introduction/Documents/Grading.html The Français link in the language button points at a page in the french folder (/fr) but it's the english page instead of the french one. The french one is here https://test.nenuial.org/fr/Introduction/Documents/Grading.fr.html.

My changes were aimed at fixing all those issues.

Nenuial commented 3 months ago

Oh and I forgot to mention: the website was rendered just now with the latest changes in the main branch of babelquarto.

maelle commented 3 months ago

https://github.com/Nenuial/babeltest is private :wink:

Nenuial commented 3 months ago

Oups! Sorry about that, it's now public.

Nenuial commented 3 months ago

I might add that the repository has some profile files (quarto-en.yml and quarto-fr.yml) but they don't serve any purpose. There there because I was playing with a version of babelquarto with #54 merged when I encountered the problems.

Nenuial commented 3 months ago

I don't use babelquarto for websites myself but I think users like @joelnitta @beatrizmilz were not necessarily intending both versions to be the same. Furthermore using the main language file as specific language file in production would mean the metadata of the page is wrong (indicating it's German while it's English for instance) and I suspect this could lead to SEO problems.

It's easily doable both ways. I had it without the copy at some point. If that's the preferred case I could change the PR to avoid creating copies.

maelle commented 3 months ago

I now understand what you were trying to do. Could you please focus this PR on the first problem ("Grading has both a french and an english version. Paper only has an english version.")? Recursing as you are doing in two places, and fixing the logic around deletion as you started doing, is a good idea, but please base the changes off the new main branch.

I could also tackle this myself next week, but collaborating is more fun if you have time :smile_cat:

maelle commented 3 months ago

after the first problem is fixed we can tackle the second one. :slightly_smiling_face:

maelle commented 3 months ago

it might be worth looking into how https://github.com/joelnitta/joelnitta-home/ is organized