-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use profile for language #54
Conversation
@ntluong95 this would be relevant for you too. With that feature one could have a main configuration file and then a bunch of configuration files |
That's a cool idea! I think it can help me solve some ideas I was having for bilingual navbars (elements that aren't linked to local pages). Is this going to be merged or is this for discussion first? |
@Nenuial thank you! I have opened it for discussion first and merging later. I'm about to be off for three weeks so won't merge it today. 😸 |
Tanks for the answer. I'll install the PR and take it for a spin. I'll tell you how it goes in a week or two! |
thank you!! |
I've played around with this PR and it's fantastic. It took some time to work out the best way to organise the configuration files. Each specific profile being merged with the main _quarto.yml, I had to wrap my head around "what is merged how". But in the end I was able to make quite a satisfying website with a nicely translated navbar. For my part, I'm very much in favour of going this way with babelquarto! |
I haven't had a chance yet to test it out. @Nenuial are you able to share the source code and website? I'd love to see what you were able to do with it. |
No, sorry. I've experimented with a website that isn't going to be public and its repository isn't ready yet. But basically, what I did was to have 3 _quarto.yml files like so: _quarto.yml (with all the other necessary configuration) website:
title: "MyTitle"
navbar:
logo: "resources/logo.png"
background: "#2f466a" _quarto-fr.yml website:
navbar:
left:
- text: "Accueil"
href: index.qmd
- text: "Discipline Fondamentale"
menu:
- text: "Documents"
href: https://url_to_other_website.xy
- text: "Livre"
href: https://url_to_other_website.xy/_book/fr _quarto-en.yml website:
navbar:
left:
- text: "Home"
href: index.qmd
- text: "Foundational Discipline"
menu:
- text: "Documents"
href: https://url_to_other_website.xy
- text: "Book"
href: https://url_to_other_website.xy/_book This was just a test, but it worked as expected. |
@joelnitta do you think you'll be able to take this for a spin? No worries if not. @ntluong95 see #54 (comment), I think this PR could be relevant to your needs too. |
Couldn't there be a quarto::quarto_render(
as_job = FALSE,
metadata = metadata,
profile = c(main_language, profile)
) And we would retain the ability to have more advanced use cases with multiple possible profiles. |
Oh this is a neat idea! Let me give you write access if you want to push to this branch (but no pressure, I could also come to this later) |
And the profile argument could default to whatever Quarto environment variable exists for profile 🤔 |
I added the changes to the profile branch in my fork. I tried pushing it to this profile branch but without success. Edit: My bad!! I hadn't seen the invitation. |
@Nenuial I added some docs (to that horribly long README 😅), what do you think? |
That's great! As mentioned in #46 I have started some work on reorganizing the documentation into smaller pieces but it's still a work in progress. I haven't started a part about customizing the template/navigation so it will fit perfectly in there. |
Great! I'll go ahead and merge this. @joelnitta @ntluong95 feedback will be welcome after the merge too. |
@maelle I finally got around to trying this on my webpage. Thanks for implementing it! However I haven't gotten it to work quite as I'd like... For example, in my navbar I have a button for my CV, which links directly to a PDF: In the translated version of the webpage, this should read 履歴 But when I try to over-write it in You can see my attempt here: https://github.com/joelnitta/joelnitta-home/blob/profiles/_quarto-ja.yml
|
Yes, that's because of the way Quarto merges the files when using profiles. Arrays don't overwrite, they merge and you get all elements. It's actually quite useful in some situations. The solution is to have the English button in a _quarto-en.yml (and leave the Japanese one in _quarto-ja.yml). That way you shouldn't end up with the two buttons. |
Thanks @joelnitta for testing and @Nenuial for solving! |
Thanks @Nenuial ! That seems to work. However, I realized I now have a different problem: my translated blog posts aren't showing up properly... My solution for that was to use a YAML like this for
Where each of the blog posts with a Japanese translation have Update: I can see now I need to tweak |
Thanks @joelnitta, can you please open a new issue? I'm sorry that it's all so clunky. With your experience we might be able to improve the user experience or at least the docs. 😅 |
That should work despite the changes made. I'll try to reproduce this in the next days and see if I can understand why this wouldn't work. The use of filters for listings is now superfluous because the different language pages should no longer be present when rendering one specific language. But that shouldn't prevent this setup from working 🤔 |
@joelnitta I tried reproducing the errors with the In both the french and english version of the posts.qmd page, the listing works even when I left the However, with the versions now cleaned up properly in subfolders, that |
@joelnitta would this solve #15?
A drawback is that one can not use babelquarto with more profiles (say, production vs development) but to me that seems fine.