getzola / zola

A fast static site generator in a single binary with everything built-in. https://www.getzola.org
https://www.getzola.org
MIT License
13.99k stars 964 forks source link

fallback to default page for i18n #2659

Open alirezaalavi87 opened 1 month ago

alirezaalavi87 commented 1 month ago

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.

Keats commented 1 month ago

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 commented 1 month ago

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 commented 1 month ago

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 by 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.