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: Set a 'required' parameter for a frontmatter field that will annoy editors until it is defined. #369

Closed
bwklein opened this issue Jul 11, 2022 · 7 comments
Labels
enhancement New feature or request Project: v8.1.0

Comments

@bwklein
Copy link

bwklein commented Jul 11, 2022

Is your feature request related to a problem? Please describe.
Some fields need to be filled in for the site design to work as intended and for SEO.

Describe the solution you'd like
Set a parameter required: true on a content type field, that will first highlight the field red when not filled out, and then raise a warning on save until the field is filled out. Basically, be annoying to the editor until the requirements are satisfied.

Describe alternatives you've considered
Telling people to remember to fill it out, checklists, pre-build script to check all files for required fields. It would be better to have some information in the UI at the time of editing, instead of after the files are saved, committed to the repo.

Additional context
Add any other context or screenshots about the feature request here.

@bwklein bwklein added the enhancement New feature or request label Jul 11, 2022
@bwklein
Copy link
Author

bwklein commented Aug 16, 2022

@estruyf I was asked about this today and wanted to see what you thought about it.

@estruyf
Copy link
Owner

estruyf commented Aug 30, 2022

Hi @bwklein, sorry for the delay. I am just back from vacation, so I need to get up to speed with all the things I missed.

@zivbk1
Copy link

zivbk1 commented Aug 30, 2022

@estruyf no worries, I was hoping that you were off doing something fun and relaxing this summer. :D

@estruyf
Copy link
Owner

estruyf commented Sep 15, 2022

Good news @zivbk1 @bwklein - there has been some good progress on this, and it will soon be available for testing.

Field view

Screenshot 2022-09-14 at 12 05 57

VS Code problems view and notification (can be turned off)

Screenshot 2022-09-13 at 16 06 50

Highlighted issues in the content

Screenshot 2022-09-13 at 16 06 40

estruyf added a commit that referenced this issue Sep 15, 2022
@estruyf
Copy link
Owner

estruyf commented Sep 15, 2022

This is now available for testing.

Configuration

  • Add the required property to the fields in your content type you want to define as a required field
  • You will automatically get the notification if you save the file and a required field is missing, if you don't want to see this notification, you can disable it with the new frontMatter.global.notifications.disabled setting and add the [requiredFieldValidation] its value.

@bwklein
Copy link
Author

bwklein commented Sep 15, 2022

This is excellent! Thank you.

@estruyf
Copy link
Owner

estruyf commented Sep 19, 2022

Changed setting to frontMatter.global.disabledNotifications.

estruyf added a commit that referenced this issue Sep 19, 2022
estruyf added a commit that referenced this issue Sep 19, 2022
@estruyf estruyf closed this as completed Sep 22, 2022
@estruyf estruyf mentioned this issue Sep 22, 2022
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Project: v8.1.0
Projects
None yet
Development

No branches or pull requests

3 participants