Enhancement: Add default value support for group fields #203

Closed
opened 2026-10-05 02:33:11 +02:00 by adam · 5 comments
Owner

@estruyf , one word amazing! I have been able to rebuild my troublesome about-section. A couple of things, is it possible to add an image field to fieldGroup and add a default string to a field?
When I select an image the dialog closes or when I look at the current about-section, the image is not found (that could be because it is not in the media folder).
A workaround for the default string is to create a string with one choice and I tried to use a placeholder without success.

Originally posted by @apowell656 in https://github.com/estruyf/vscode-front-matter/issues/176#issuecomment-1042862808

@estruyf , one word amazing! I have been able to rebuild my troublesome about-section. A couple of things, is it possible to add an image field to fieldGroup and add a default string to a field? When I select an image the dialog closes or when I look at the current about-section, the image is not found (that could be because it is not in the media folder). A workaround for the default string is to create a string with one choice and I tried to use a placeholder without success. _Originally posted by @apowell656 in https://github.com/estruyf/vscode-front-matter/issues/176#issuecomment-1042862808_ <!-- github-sync-id:1141635023 -->
adam closed this issue 2026-10-05 02:33:11 +02:00
Author
Owner

I don't think that defaults work now for any fields in a field group.

In this video I set a default string of "Page Content" to the 'label' field in a field group. When I add that page section to the array, the label is not pre-populated with the default string.

https://user-images.githubusercontent.com/12104446/154544047-519f8160-0fb2-4d47-acfb-699dac11e65c.mp4

I don't think that defaults work now for any fields in a field group. In this video I set a default string of "Page Content" to the 'label' field in a field group. When I add that page section to the array, the label is not pre-populated with the default string. https://user-images.githubusercontent.com/12104446/154544047-519f8160-0fb2-4d47-acfb-699dac11e65c.mp4 <!-- github-comment-id:1043257979 -->
Author
Owner

Correct, seems I myself did it wrong 🙈, it is for the group fields only indeed.

Correct, seems I myself did it wrong 🙈, it is for the group fields only indeed. <!-- github-comment-id:1043307447 -->
Author
Owner

Can those defaults use placeholders like {{now}}?

Can those defaults use placeholders like {{now}}? <!-- github-comment-id:1043466612 -->
Author
Owner

@zivbk1 took a bit more work, as this is something which is performed on the backend, but now the block fields can also leverage the same placeholder logic as the root fields.

@zivbk1 took a bit more work, as this is something which is performed on the backend, but now the block fields can also leverage the same placeholder logic as the root fields. <!-- github-comment-id:1043773381 -->
Author
Owner

Thank you!

Thank you! <!-- github-comment-id:1043822721 -->
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#203