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...
https://frontmatter.codes
MIT License
1.95k stars 77 forks source link

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

Closed steelcoder closed 1 month ago

steelcoder commented 4 months ago

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):

Smartphone (please complete the following information):

estruyf commented 4 months ago

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 commented 4 months ago

Dear Elio,

Thank you for your prompt response. I'd be happy to provide more details about our setup to help diagnose the issue.

We use a custom tool to package and publish, and our articles have the following structure:

For your reference, I am attaching our configuration file (JSON format) to this email.

Please let me know if you need any further information or clarification.

Regards,

Yoann.

Le ven. 24 mai 2024 à 16:24, Elio Struyf @.***> a écrit :

Thanks, @steelcoder https://github.com/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.

— Reply to this email directly, view it on GitHub https://github.com/estruyf/vscode-front-matter/issues/813#issuecomment-2129657112, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAILI2SZZ6VSMVGBHNNFQODZD5ETDAVCNFSM6AAAAABIHVR4G2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRZGY2TOMJRGI . You are receiving this because you were mentioned.Message ID: @.***>

-- Yoann PANTIC

estruyf commented 4 months ago

@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?

steelcoder commented 4 months ago

{ "$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 } } }

estruyf commented 4 months ago

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

https://github.com/estruyf/vscode-front-matter/assets/2900833/dbf851df-8c78-4514-830e-310076e5a56a

steelcoder commented 4 months ago

No, the slug were filled and was deleted.

Yoann PANTIC

Le ven. 24 mai 2024 à 21:18, Elio Struyf @.***> a écrit :

@steelcoder https://github.com/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.

https://github.com/estruyf/vscode-front-matter/assets/2900833/dbf851df-8c78-4514-830e-310076e5a56a

— Reply to this email directly, view it on GitHub https://github.com/estruyf/vscode-front-matter/issues/813#issuecomment-2130212150, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAILI2T53SGO6YI2UQBEOITZD6G7LAVCNFSM6AAAAABIHVR4G2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZQGIYTEMJVGA . You are receiving this because you were mentioned.Message ID: @.***>

estruyf commented 4 months ago

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?

estruyf commented 4 months ago

@steelcoder, do you have an update for me?

steelcoder commented 4 months ago

Hello, no but the bug is still present for me.

Yoann PANTIC

Le mar. 28 mai 2024 à 13:53, Elio Struyf @.***> a écrit :

@steelcoder https://github.com/steelcoder, do you have an update for me?

— Reply to this email directly, view it on GitHub https://github.com/estruyf/vscode-front-matter/issues/813#issuecomment-2135030262, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAILI2VIIQFAUQAXEFXD3SLZERV2RAVCNFSM6AAAAABIHVR4G2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZVGAZTAMRWGI . You are receiving this because you were mentioned.Message ID: @.***>

estruyf commented 4 months ago

@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?

estruyf commented 1 month ago

Closing the issue due to no response.