sveltia / sveltia-cms

Alternative to Netlify/Decap CMS. Fast, lightweight, Git-based headless CMS. Modern UX, first-class i18n support, open source & free. Made with Svelte.
MIT License
955 stars 49 forks source link

File collection doesn't recognize '_index.{{locale}}.md' in subdirectory #242

Closed josineto closed 3 weeks ago

josineto commented 3 weeks ago

In file collections, I can use file: content/_index.{{locale}}.md, but not e.g. file: content/coauthors/_index.{{locale}}.md. In the former, fields are correctly populated. In the latter, fields appear empty, although they have content in corresponding files.

Here is a configuration excerpt, with above files:

- name: pages
  label: Pages
  ...
  i18n: true
  files:
  - name:   home
    label:  Home
    file: content/_index.{{locale}}.md  # correctly populated
    i18n: true
    fields: ...
  - name: coautores
    label: Coauthors list page
    file: content/coauthors/_index.{{locale}}.md  # populated as empty
    i18n: true
    fields: ...

This began to happen between v0.39.9 (second locale is not recognized) and v0.39.12 (fields are not populated, as current version), so maybe it's related to #239 . Loading the CMS with v0.38.0 or below, the files are loaded and populated as expected.

What is interesting is that I have a folder collection in that same folder (content/coatuhors) with below configuration, whose entries are correctly loaded:

folder: content/coauthors
path: '{{slug}}/_index'
josineto commented 3 weeks ago

Just to turn things easier to understand: the above folder is like:

content/
.  coauthors/
.  .  john-doe/
.  .  .  _index.pt.md   --> John Doe info in Portuguese, OK
.  .  .  _index.en.md   --> John Doe info in English,    OK
.  .  _index.pt.md      --> coauthors list page info in Portuguese, loaded empty
.  .  _index.en.md      --> coauthors list page info in English,    loaded empty
.  _index.pt.md         --> home info in Portuguese, OK
.  _index.en.md         --> home info in English,    OK
kyoshino commented 3 weeks ago

Will check!

kyoshino commented 3 weeks ago

Fixed in v0.45.3 🙇🏼