Enhancement: Create new isPublishDate and isModifiedDate property to define date types #222

Closed
opened 2026-10-05 02:34:21 +02:00 by adam · 6 comments
Owner

Discussed in https://github.com/estruyf/vscode-front-matter/discussions/278

Originally posted by jmatthewpryor March 5, 2022
Hi

I've followed the documentation to try & get custom publish and last mod dates working - so far without success

My workspace editor settings appear correct

Screen Recording 2022-03-05 at 03 53 11 pm

And I have edits frontmatter.json in my project also

"frontMatter.taxonomy.dateField": "publishedAt",
"frontMatter.taxonomy.modifiedField": "lastMod",

However, the FrontMatter editor fails to pick up those field value and sets a field "date" when I use the Dashboard to update

I am running on the Beta

Any tips appreciated

### Discussed in https://github.com/estruyf/vscode-front-matter/discussions/278 <div type='discussions-op-text'> <sup>Originally posted by **jmatthewpryor** March 5, 2022</sup> Hi I've followed the documentation to try & get custom publish and last mod dates working - so far without success My workspace editor settings appear correct ![Screen Recording 2022-03-05 at 03 53 11 pm](https://user-images.githubusercontent.com/850570/156868524-d0476d38-7913-4509-9351-6c9f30dad969.gif) And I have edits frontmatter.json in my project also ``` "frontMatter.taxonomy.dateField": "publishedAt", "frontMatter.taxonomy.modifiedField": "lastMod", ``` However, the FrontMatter editor fails to pick up those field value and sets a field "date" when I use the Dashboard to update I am running on the Beta Any tips appreciated</div> <!-- github-sync-id:1161084870 -->
adam closed this issue 2026-10-05 02:34:21 +02:00
Author
Owner

@jmatthewpryor you will now be able to test it out in the new beta version.

Information to migrate to these new settings can be found here: https://beta.frontmatter.codes/docs/troubleshooting#feature-migrations

@jmatthewpryor you will now be able to test it out in the new beta version. Information to migrate to these new settings can be found here: https://beta.frontmatter.codes/docs/troubleshooting#feature-migrations <!-- github-comment-id:1060483064 -->
Author
Owner

works fine for me following those instructions @estruyf

works fine for me following those instructions @estruyf <!-- github-comment-id:1061236057 -->
Author
Owner

I spoke too soon @estruyf - I keep getting an entry added to my MDX file when I first open the FM edit panel

This is my content defs

  "frontMatter.taxonomy.contentTypes": [
    {
      "name": "default",
      "previewPath": null,
      "pageBundle": false,
      "fields": [
        {
          "title": "Title",
          "name": "title",
          "type": "string"
        },
        {
          "title": "Description",
          "name": "description",
          "type": "string"
        },
        {
          "title": "Publishing date",
          "name": "publishedAt",
          "type": "datetime",
          "default": "{{now}}",
          "isPublishDate": true
        },
        {
          "title": "Updated date",
          "name": "lastMod",
          "type": "datetime",
          "default": "{{now}}",
          "isModifiedDate": true
        },
        {
          "title": "Article preview",
          "name": "preview",
          "type": "image"
        },
        {
          "title": "Is in draft",
          "name": "draft",
          "type": "draft"
        },
        {
          "title": "Tags",
          "name": "tags",
          "type": "tags"
        },
        {
          "title": "Categories",
          "name": "categories",
          "type": "categories"
        }
      ]
    }
  ],

Despite that, when I open an MDX file via the FM dashboard, it auto adds the following to the frontmatter section

date: "{{now}}"
Not sure how to fix that from here

I spoke too soon @estruyf - I keep getting an entry added to my MDX file when I first open the FM edit panel This is my content defs ``` "frontMatter.taxonomy.contentTypes": [ { "name": "default", "previewPath": null, "pageBundle": false, "fields": [ { "title": "Title", "name": "title", "type": "string" }, { "title": "Description", "name": "description", "type": "string" }, { "title": "Publishing date", "name": "publishedAt", "type": "datetime", "default": "{{now}}", "isPublishDate": true }, { "title": "Updated date", "name": "lastMod", "type": "datetime", "default": "{{now}}", "isModifiedDate": true }, { "title": "Article preview", "name": "preview", "type": "image" }, { "title": "Is in draft", "name": "draft", "type": "draft" }, { "title": "Tags", "name": "tags", "type": "tags" }, { "title": "Categories", "name": "categories", "type": "categories" } ] } ], ``` Despite that, when I open an MDX file via the FM dashboard, it auto adds the following to the frontmatter section `date: "{{now}}" ` Not sure how to fix that from here <!-- github-comment-id:1061315325 -->
Author
Owner

@jmatthewpryor if I understand it correctly, when you open an MDX file, without the lastMod or publishedAt date set in your front matter, it gets automatically added?

Ok, accidentally reproduced it, now I understand what is happening 🤓

~~@jmatthewpryor if I understand it correctly, when you open an MDX file, without the `lastMod` or `publishedAt` date set in your front matter, it gets automatically added?~~ Ok, accidentally reproduced it, now I understand what is happening 🤓 <!-- github-comment-id:1061466821 -->
Author
Owner

This commit should fix the above issue.

This commit should fix the above issue. <!-- github-comment-id:1061484305 -->
Author
Owner

that works for me now too - thanks

that works for me now too - thanks <!-- github-comment-id:1066539049 -->
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#222