Skip to content
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

fallback to default page for i18n #2659

Open
alirezaalavi87 opened this issue Oct 3, 2024 · 7 comments
Open

fallback to default page for i18n #2659

alirezaalavi87 opened this issue Oct 3, 2024 · 7 comments

Comments

@alirezaalavi87
Copy link

alirezaalavi87 commented Oct 3, 2024

Bug Report

for every language your site supports, for every page you MUST create a separate file for that language (https://www.getzola.org/documentation/content/multilingual/)

This leads to many redundant pages in some cases.

I purpose if for a language there is no index.{code}.md zola should just fallback to index.md, and maybe show a warning instead of not creating your website at all.

for example see duckquill and how many redundant pages it has to have in itslef for no reason.

Environment

Zola version:
v0.19.2

Expected Behavior

I purpose if for a language there is no index.{code}.md zola should just fallback to index.md, and maybe show a warning instead of not creating the website at all.

@alirezaalavi87 alirezaalavi87 changed the title fallback language for i18n fallback to default page for i18n Oct 3, 2024
@Keats
Copy link
Collaborator

Keats commented Oct 3, 2024

for every language your site supports, for every page you MUST create a separate file for that language

That's not true? Only the sections require multiple files if you want them, not the pages. As for fallback, I don't think we can do it? The slug in the url might be different

@alirezaalavi87
Copy link
Author

yes my bad, for every section we will need a new page. but still I think a fallback would be very convenient. because maybe I don't want to change some sections based on language and maintain two copies of the same page.

@Keats

@alirezaalavi87
Copy link
Author

alirezaalavi87 commented Oct 3, 2024

And for another example, checkout the gallery page in my website.link

I want the posts in my gallery to also be loaded in other languages, without copying about a hundred index.md files and renaming them to index.fa.md.

I'm not sure if this has another workaround or not, but I think the point is valid.

I think the fallback behavior should be in a way that you can include or exclude pages or sections to use fallback in config.default_language.

for example, I want all my gallery posts to fallback to index.md but not my blog posts. I want only blog posts with index.fa.md when I'm in farsi mode and index.md in english mode.

I think this is a reasonable behavior.

@alirezaalavi87
Copy link
Author

bump?

@Keats
Copy link
Collaborator

Keats commented Nov 30, 2024

How would that look like for a user? Zola would automatically generate a page for every non-default language that redirects to the default language if not present?

@alirezaalavi87
Copy link
Author

@Keats
In my opinion, the default fallback should behave like this:

I have multiple posts in my gallery. I want those with index.fa.md to be rendered and those without it, just fallback to index.md. so zola has to render index.fa.md itself so we can have:

gallery/
    post-1/
        index.md
    post-2/
        index.md
        index.fa.md

and render

test.com/fa/gallery/post-1
test.com/fa/gallery/post-2

remember that whether we should do fallbacks to index.md or not should be a per-section option. so I want to fallback in my gallery but not in my blog

@Keats
Copy link
Collaborator

Keats commented Dec 12, 2024

Seems ok to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@Keats @alirezaalavi87 and others