estruyf / vscode-front-matter

Front Matter is a CMS running straight in Visual Studio Code. Can be used with static site generators like Hugo, Jekyll, Hexo, NextJs, Gatsby, and many more...

Home Page:https://frontmatter.codes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue: Slug field gets erased in Front Matter CMS when focusing on Markdown

steelcoder opened this issue · comments

Describe the bug
When Front Matter CMS obtains focus while a Markdown file is open, even though fields are properly filled, it tends to erase the slug, resulting in the file being modified.

To Reproduce
Steps to reproduce the behavior:

  1. Open a Markdown file with filled fields.
  2. Open the lateral panel of Front Matter CMS.
  3. Observe that the slug field is erased and quotation marks are added:
    ---
    ...
    - slug: ""
    ...
    ---

Expected behavior
The file should remain unchanged, but properties should be loaded in the Metadata section.

Desktop (please complete the following information):

  • OS: macOS Sonoma (Apple Silicon)
  • Browser: Not applicable
  • Version: v10.1.0

Smartphone (please complete the following information):

  • Device: Not applicable
  • OS: Not applicable
  • Browser: Not applicable
  • Version: Not applicable

Thanks, @steelcoder, for opening an issue. This should not be happening indeed, can you share a bit more information, like your configuration and page contents or project/repo? That way I can try to reproduce it on my end to check what is going on.

@steelcoder, it seems that the attachment has been removed. It would be better to reply to the GitHub issue itself.

Besides that, would you be able to record a short video to see what the behavior is?

{
"$schema": "https://frontmatter.codes/frontmatter.schema.json",
"frontMatter.taxonomy.contentTypes": [
{
"name": "default",
"defaultFileName": "article",
"filePrefix": null,
"pageBundle": true,
"previewPath": null,
"postScript": "create-structure",
"fields": [
{
"title": "Title",
"name": "title",
"type": "string",
"required": true,
"description": "SEO Title of the Article"
},
{
"title": "Slug",
"name": "slug",
"type": "slug",
"editable": true,
"default": "{{slug}}",
"required": true,
"description": "Website Article Path (Only lowercase a-z, 0-9 and hyphens)"
},
{
"title": "Description",
"name": "description",
"type": "string",
"required": true,
"description": "SEO Description of the Article"
},
{
"title": "Focus Keywords",
"name": "focus_keywords",
"type": "string",
"description": "Keywords to Find the Post (Keep Empty to Auto-Generate)"
},
{
"title": "Featured Media",
"name": "featured_media",
"type": "image",
"required": true,
"description": "Highlighted Visual Content"
},
{
"title": "Featured Media Description",
"name": "featured_media_description",
"type": "string",
"description": "Featured Media Description (Takes Priority Over Media Library)"
},
{
"title": "Featured Media Title",
"name": "featured_media_title",
"type": "string",
"description": "Featured Media Title (Keep Empty to Auto-Generate)"
},
{
"title": "Categories",
"name": "categories",
"type": "categories",
"taxonomyLimit": 1,
"required": true
},
{
"title": "Tags",
"name": "tags",
"type": "tags",
"description": "Select All Relevant Tags for the Article"
},
{
"title": "keywords",
"name": "keywords",
"type": "list",
"description": "Most Relevant Keywords for SEO Ordered By Importance"
},
{
"title": "Author",
"name": "author",
"type": "choice",
"default": "8",
"required": true,
"choices": [
{
"id": "8",
"title": "Author 1"
},
{
"id": "9",
"title": "Author 2"
}
],
"description": "Author ID of the Article on the Website"
},
{
"title": "Status",
"name": "status",
"type": "draft",
"default": "draft",
"required": true
},
{
"title": "Publish Date",
"name": "published",
"type": "datetime",
"isPublishDate": true,
"when": {
"fieldRef": "status",
"operator": "eq",
"value": "published"
}
},
{
"title": "Language",
"name": "lang",
"type": "choice",
"choices": [
"fr",
"en"
],
"default": "fr",
"required": true
}
]
},
{
"name": "doc",
"filePrefix": null,
"pageBundle": false,
"previewPath": null,
"fields": [
{
"title": "type",
"name": "type",
"type": "string",
"default": "doc",
"hidden": true
},
{
"title": "Language",
"name": "lang",
"type": "choice",
"choices": [
"fr",
"en"
],
"default": "fr",
"required": true
}
]
}
],
"frontMatter.file.preserveCasing": true,
"frontMatter.taxonomy.seoDescriptionLength": 120,
"frontMatter.framework.id": "other",
"frontMatter.content.publicFolder": "",
"frontMatter.taxonomy.dateFormat": "yyyy-MM-dd",
"frontMatter.content.draftField": {
"name": "status",
"type": "choice",
"choices": [
"draft",
"packaged",
"published"
]
},
"frontMatter.content.pageFolders": [
{
"title": "Ecostylia",
"path": "[[workspace]]",
"contentTypes": [
"default"
]
}
],
"frontMatter.dashboard.openOnStart": false,
"frontMatter.sponsors.ai.enabled": false,
"frontMatter.custom.scripts": [
{
"id": "create-structure",
"title": "Create Doc & Glossary",
"script": "./.frontmatter/config/custom/scripts/create-structure.js",
"command": "node"
},
{
"title": "Create media.xlsx from the post",
"command": "node",
"script": "./.frontmatter/config/custom/scripts/import-media-from-md.js"
},
{
"title": "Update Media Library from media.xlsx",
"command": "node",
"script": "./.frontmatter/config/custom/scripts/update-media-db-from-media-list.js"
},
{
"title": "Package",
"command": "bash",
"script": "./.frontmatter/config/custom/scripts/launch-package.sh",
"environments": [
{
"type": "windows",
"command": "powershell",
"script": "./.frontmatter/config/custom/scripts/launch-package.ps1"
}
]
},
{
"title": "Publish & Notify",
"command": "bash",
"script": "./.frontmatter/config/custom/scripts/launch-publish-notify.sh",
"environments": [
{
"type": "windows",
"command": "powershell",
"script": "./.frontmatter/config/custom/scripts/launch-publish-notify.ps1"
}
]
},
{
"title": "Publish",
"command": "bash",
"script": "./.frontmatter/config/custom/scripts/launch-publish.sh",
"environments": [
{
"type": "windows",
"command": "powershell",
"script": "./.frontmatter/config/custom/scripts/launch-publish.ps1"
}
]
}
],
"frontMatter.snippets.wrapper.enabled": false,
"frontMatter.content.snippets": {
"Embed": {
"description": "",
"body": [
"block", "type: embed", "url: [[&url]]", "caption: \"[[caption]]\"", ""
],
"fields": [
{
"name": "url",
"title": "Url",
"type": "string",
"required": true,
"single": true
},
{
"name": "caption",
"title": "caption",
"type": "string",
"required": false,
"default": ""
}
],
"isMediaSnippet": false
}
}
}

@steelcoder I checked the configuration. The reason there is an update when you open the panel is the default property, which is set on the slug field. The update only happens when there is no slug set on the page.

Screen.Recording.2024-05-24.at.21.16.42.mov

I'm not able to reproduce it, would you be able to give me some sample data/files?

Would you be able to record the file update like I did?

@steelcoder, do you have an update for me?

@steelcoder, that is what I thought. It was more on the questions I asked before:

I'm unable to reproduce it. Would you be able to give me some sample data/files?

Would you be able to record the file update like I did?