Issue: A single multilingual pageFolder is now getting replaced by one per language in frontmatter.json. #607

Closed
opened 2026-10-05 02:55:43 +02:00 by adam · 5 comments
Owner

Describe the bug

In frontmatter.json, it looks like the original simple model for i18n and pageFolder is getting transformed internally and then (perhaps unintentionally?) getting persisted to back to frontmatter.json.

IMHO, this complicates and duplicates information in the frontmatter.json model. Is that what you intended??
Perhaps you need to maintain a computed pageFolder model that maintains the original model as isomorphic in this aspect.

Example

frontmatter.json

...
  "frontMatter.content.i18n": [
    {
      "title": "English",
      "locale": "en",
      "path": "en"
    },
    {
      "title": "Hindi",
      "locale": "hi",
      "path": "hi"
    },
    {
      "title": "Bengali",
      "locale": "bn",
      "path": "bn"
    }
],
...
"frontMatter.content.pageFolders": [
    {
      "title": "posts",
      "path": "[[workspace]]/src/content/posts",
      "filePrefix": "",
      "defaultLocale": "en",
      "contentTypes": [
        "post"
      ]
    },
    {
      "title": "site",
      "path": "[[workspace]]/src/content/site",
      "filePrefix": "",
      "defaultLocale": "en",
      "contentTypes": [
        "site"
      ]
    }

  ],

... is getting converted into this that's saved in the ...

  "frontMatter.content.pageFolders": [
    {
      "title": "posts",
      "path": "[[workspace]]/src/content/posts/en",
      "filePrefix": "",
      "defaultLocale": "en",
      "contentTypes": [
        "post"
      ],
      "locale": "en",
      "localeTitle": "English",
      "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/posts"
    },
    {
      "title": "posts",
      "path": "[[workspace]]/src/content/posts/hi",
      "filePrefix": "",
      "defaultLocale": "en",
      "contentTypes": [
        "post"
      ],
      "locale": "hi",
      "localeTitle": "Hindi",
      "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/posts"
    },
    {
      "title": "posts",
      "path": "[[workspace]]/src/content/posts/bn",
      "filePrefix": "",
      "defaultLocale": "en",
      "contentTypes": [
        "post"
      ],
      "locale": "bn",
      "localeTitle": "Bengali",
      "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/posts"
    },
    {
      "title": "site",
      "path": "[[workspace]]/src/content/site/en",
      "filePrefix": "",
      "defaultLocale": "en",
      "contentTypes": [
        "site"
      ],
      "locale": "en",
      "localeTitle": "English",
      "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/site"
    },
    {
      "title": "site",
      "path": "[[workspace]]/src/content/site/hi",
      "filePrefix": "",
      "defaultLocale": "en",
      "contentTypes": [
        "site"
      ],
      "locale": "hi",
      "localeTitle": "Hindi",
      "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/site"
    },
    {
      "title": "site",
      "path": "[[workspace]]/src/content/site/bn",
      "filePrefix": "",
      "defaultLocale": "en",
      "contentTypes": [
        "site"
      ],
      "locale": "bn",
      "localeTitle": "Bengali",
      "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/site"
    },
]
**Describe the bug** In `frontmatter.json`, it looks like the original simple model for `i18n` and `pageFolder` is getting transformed internally and then (perhaps unintentionally?) getting **persisted** to back to `frontmatter.json`. IMHO, this complicates and duplicates information in the `frontmatter.json` model. Is that what you intended?? Perhaps you need to maintain a computed pageFolder model that maintains the original model as isomorphic in this aspect. **Example** `frontmatter.json` ```json ... "frontMatter.content.i18n": [ { "title": "English", "locale": "en", "path": "en" }, { "title": "Hindi", "locale": "hi", "path": "hi" }, { "title": "Bengali", "locale": "bn", "path": "bn" } ], ... "frontMatter.content.pageFolders": [ { "title": "posts", "path": "[[workspace]]/src/content/posts", "filePrefix": "", "defaultLocale": "en", "contentTypes": [ "post" ] }, { "title": "site", "path": "[[workspace]]/src/content/site", "filePrefix": "", "defaultLocale": "en", "contentTypes": [ "site" ] } ], ``` ... is getting converted into this that's saved in the ... ```json "frontMatter.content.pageFolders": [ { "title": "posts", "path": "[[workspace]]/src/content/posts/en", "filePrefix": "", "defaultLocale": "en", "contentTypes": [ "post" ], "locale": "en", "localeTitle": "English", "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/posts" }, { "title": "posts", "path": "[[workspace]]/src/content/posts/hi", "filePrefix": "", "defaultLocale": "en", "contentTypes": [ "post" ], "locale": "hi", "localeTitle": "Hindi", "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/posts" }, { "title": "posts", "path": "[[workspace]]/src/content/posts/bn", "filePrefix": "", "defaultLocale": "en", "contentTypes": [ "post" ], "locale": "bn", "localeTitle": "Bengali", "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/posts" }, { "title": "site", "path": "[[workspace]]/src/content/site/en", "filePrefix": "", "defaultLocale": "en", "contentTypes": [ "site" ], "locale": "en", "localeTitle": "English", "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/site" }, { "title": "site", "path": "[[workspace]]/src/content/site/hi", "filePrefix": "", "defaultLocale": "en", "contentTypes": [ "site" ], "locale": "hi", "localeTitle": "Hindi", "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/site" }, { "title": "site", "path": "[[workspace]]/src/content/site/bn", "filePrefix": "", "defaultLocale": "en", "contentTypes": [ "site" ], "locale": "bn", "localeTitle": "Bengali", "localeSourcePath": "c:/Users/tony/Projects/JOI-Software/SGY_SITE/site/src/content/site" }, ] ``` <!-- github-sync-id:2162501278 -->
adam closed this issue 2026-10-05 02:55:43 +02:00
Author
Owner

The settings update was overlooked. Those fields are internal and shouldn't be pushed to the configuration file, and an update to fix it has been pushed. It should be available in the latest beta. Let me know if it got fixed, and I'll release it to the stable version.

The settings update was overlooked. Those fields are internal and shouldn't be pushed to the configuration file, and an update to fix it has been pushed. It should be available in the latest beta. Let me know if it got fixed, and I'll release it to the stable version. <!-- github-comment-id:1972705278 -->
Author
Owner

BETA Version: 10.0.8108301

BETA Version: 10.0.8108301 <!-- github-comment-id:1972705775 -->
Author
Owner

Tested and passed. I added a temporary snippet to ensure frontmatter.json was serialised and the result was ok.
Thanks again. Glad we caught this one before it broke too many frontmatter.json files in the wild.

Tested and passed. I added a temporary snippet to ensure `frontmatter.json` was serialised and the result was ok. Thanks again. Glad we caught this one before it broke too many `frontmatter.json` files in the wild. <!-- github-comment-id:1972787295 -->
Author
Owner

Release notes might want to have repair instructions.

Release notes might want to have repair instructions. <!-- github-comment-id:1972788869 -->
Author
Owner
@tohagan a fix will be included to revert the setting to the original state: https://github.com/estruyf/vscode-front-matter/blob/6f6015cf834765bd22798c310b625c03d5fe4f28/src/helpers/Extension.ts#L247-L270 <!-- github-comment-id:1972837149 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/vscode-front-matter#607