Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
estruyf opened this issue Mar 7, 2022 Discussed in #278 · 6 comments
Closed
Labels
enhancement New feature or request

Comments

@estruyf
Copy link
Owner

estruyf commented Mar 7, 2022

Discussed in #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

@estruyf estruyf added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request and removed bug Something isn't working documentation Improvements or additions to documentation labels Mar 7, 2022
@estruyf
Copy link
Owner Author

estruyf commented Mar 7, 2022

@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
Copy link

works fine for me following those instructions @estruyf

@jmatthewpryor
Copy link

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

@estruyf
Copy link
Owner Author

estruyf commented Mar 8, 2022

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

@estruyf
Copy link
Owner Author

estruyf commented Mar 8, 2022

This commit should fix the above issue.

@jmatthewpryor
Copy link

that works for me now too - thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants