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

Empty commit with i18n + nested collections (when missing a language file) #7389

Open
martinjagodic opened this issue Jan 31, 2025 · 1 comment
Labels
area: i18n area: nested-collections type: bug code to address defects in shipped code

Comments

@martinjagodic
Copy link
Member

In a nested collection that uses i18n, an entry is not saved if it's missing a language.

Consider the below structure for example. Note that posts is missing _index.sl.md.

content
│-  _index.en.md
│-  _index.sl.md
│
└──posts
│   │-  _index.en.md

Corresponding config

i18n:
  structure: multiple_files
  locales: [sl, en]

collections:
  - name: content
    label: Content
    label_singular: post
    folder: content
    i18n: true
    nested:
      depth: 10
      summary: "{{title}}"
    fields: 
      - {name: title, widget: string, i18n: true}

If you try to save the posts/_index file via CMS, it will produce an empty commit. If you add posts/_index.sl.md, the commit will save changes as expected.

I stumbled upon this bug years ago and posted it on Netlify Forums, but the post is now deleted. Thanks to the Internet Archive, we have a snapshot version: https://web.archive.org/web/20221207001621/https://answers.netlify.com/t/changes-to-entries-saved-in-the-ui-but-commit-is-empty/34954

@martinjagodic martinjagodic added area: i18n area: nested-collections type: bug code to address defects in shipped code labels Jan 31, 2025
@martinjagodic martinjagodic changed the title Empty commit with i18n + nested and missing a language file Empty commit with i18n + nested collections (when missing a language file) Jan 31, 2025
@demshy
Copy link
Member

demshy commented Feb 4, 2025

just in case, we could check if proposed changes in #7145 solve this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: i18n area: nested-collections type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants