Describe the bug
When creating a new content with custom content type, draft field is populated as draft: "" unless content type has a default value of true set for the draft field.
To Reproduce
Steps to reproduce the behavior:
Here is my frontmatter.json
{"$schema":"https://frontmatter.codes/frontmatter.schema.json","frontMatter.taxonomy.contentTypes":[{"name":"blog","pageBundle":true,"template":"[[workspace]]/archetypes/blog/index.md","previewPath":null,"fields":[{"title":"Title","name":"title","type":"string","single":true,"default":"{{title}}"},{"title":"Slug","name":"slug","type":"slug","editable":true,"default":"{{slug}}"},{"title":"Is in draft","name":"draft","type":"draft"},{"title":"Creation date","name":"date","type":"datetime","isPublishDate":true,"default":"{{now}}"},{"title":"Modified date","name":"lastmod","type":"datetime","isModifiedDate":true,"default":"{{now}}"},{"title":"Description","name":"description","type":"string","default":"&summary"},{"title":"Summary","name":"summary","type":"string","default":"*summary"},{"title":"Keywords","name":"keywords","type":"list","default":""},{"title":"Content type","name":"type","type":"string","default":"blog"},{"title":"Weight","name":"weight","type":"number","default":10},{"title":"Sub-title","name":"subtitle","type":"string","single":false,"wysiwyg":true,"default":""},{"title":"Is a Featured Post","name":"featuredPost","type":"boolean","default":false},{"title":"Header Image","name":"headerImage","type":"fields","fields":[{"title":"Image","name":"src","type":"image","default":"images/headerdefault.png","isPreviewImage":true},{"title":"Image title","name":"title","type":"string","single":true,"default":""},{"title":"Image Alt-Text","name":"alt","type":"string","single":true,"default":""}]},{"title":"Categories","name":"categories","type":"categories"},{"title":"Tags","name":"tags","type":"tags"}]}],"frontMatter.framework.id":"hugo","frontMatter.content.publicFolder":"assets","frontMatter.content.pageFolders":[{"title":"Pages","path":"[[workspace]]/content","excludeSubdir":true},{"title":"Blog","path":"[[workspace]]/content/blog"},{"title":"About Page","path":"[[workspace]]/content/about"}],"frontMatter.dashboard.content.cardTags":"tags"}
When draft is:
{"title":"Is in draft","name":"draft","type":"draft"},
The frontmatter becomes:
draft:""
I have to explicitly state:
{"title":"Is in draft","name":"draft","type":"draft","default":true},
in order to get:
draft:true
Expected behavior
Standard draft field should have default of true value on frontmatter creation.
Desktop (please complete the following information):
OS: Windows 10
VScode 1.7.0
Front Matter 8.0.1
**Describe the bug**
When creating a new content with custom content type, draft field is populated as `draft: ""` unless content type has a default value of true set for the draft field.
**To Reproduce**
Steps to reproduce the behavior:
Here is my frontmatter.json
```json
{
"$schema": "https://frontmatter.codes/frontmatter.schema.json",
"frontMatter.taxonomy.contentTypes": [
{
"name": "blog",
"pageBundle": true,
"template": "[[workspace]]/archetypes/blog/index.md",
"previewPath": null,
"fields": [
{
"title": "Title",
"name": "title",
"type": "string",
"single": true,
"default": "{{title}}"
},
{
"title": "Slug",
"name": "slug",
"type": "slug",
"editable": true,
"default": "{{slug}}"
},
{
"title": "Is in draft",
"name": "draft",
"type": "draft"
},
{
"title": "Creation date",
"name": "date",
"type": "datetime",
"isPublishDate": true,
"default": "{{now}}"
},
{
"title": "Modified date",
"name": "lastmod",
"type": "datetime",
"isModifiedDate": true,
"default": "{{now}}"
},
{
"title": "Description",
"name": "description",
"type": "string",
"default": "&summary"
},
{
"title": "Summary",
"name": "summary",
"type": "string",
"default": "*summary"
},
{
"title": "Keywords",
"name": "keywords",
"type": "list",
"default": ""
},
{
"title": "Content type",
"name": "type",
"type": "string",
"default": "blog"
},
{
"title": "Weight",
"name": "weight",
"type": "number",
"default": 10
},
{
"title": "Sub-title",
"name": "subtitle",
"type": "string",
"single": false,
"wysiwyg": true,
"default": ""
},
{
"title": "Is a Featured Post",
"name": "featuredPost",
"type": "boolean",
"default": false
},
{
"title": "Header Image",
"name": "headerImage",
"type": "fields",
"fields": [
{
"title": "Image",
"name": "src",
"type": "image",
"default": "images/headerdefault.png",
"isPreviewImage": true
},
{
"title": "Image title",
"name": "title",
"type": "string",
"single": true,
"default": ""
},
{
"title": "Image Alt-Text",
"name": "alt",
"type": "string",
"single": true,
"default": ""
}
]
},
{
"title": "Categories",
"name": "categories",
"type": "categories"
},
{
"title": "Tags",
"name": "tags",
"type": "tags"
}
]
}
],
"frontMatter.framework.id": "hugo",
"frontMatter.content.publicFolder": "assets",
"frontMatter.content.pageFolders": [
{
"title": "Pages",
"path": "[[workspace]]/content",
"excludeSubdir": true
},
{
"title": "Blog",
"path": "[[workspace]]/content/blog"
},
{
"title": "About Page",
"path": "[[workspace]]/content/about"
}
],
"frontMatter.dashboard.content.cardTags": "tags"
}
```
When draft is:
```json
{
"title": "Is in draft",
"name": "draft",
"type": "draft"
},
```
The frontmatter becomes:
```yaml
draft: ""
```
I have to explicitly state:
```json
{
"title": "Is in draft",
"name": "draft",
"type": "draft",
"default": true
},
```
in order to get:
```yaml
draft: true
```
**Expected behavior**
Standard draft field should have default of `true` value on frontmatter creation.
**Desktop (please complete the following information):**
- OS: Windows 10
- VScode 1.7.0
- Front Matter 8.0.1
<!-- github-sync-id:1333951914 -->
Thanks, @anakinsleftleg, for this suggestion. The draft field will now be set to true when no default value is provided.
Thanks, @anakinsleftleg, for this suggestion. The draft field will now be set to `true` when no default value is provided.
<!-- github-comment-id:1212177193 -->
I thought, based on the documentation, that that was already the default outcome.
https://frontmatter.codes/docs/content-creation/fields#outcome
Seems to imply that it is.
<!-- github-comment-id:1212207380 -->
I'll blame the person that wrote the documentation. Oh, wait, that was me. The good thing is that it will now work as how it is documented.
I'll blame the person that wrote the documentation. Oh, wait, that was me. The good thing is that it will now work as how it is documented.
<!-- github-comment-id:1212273313 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Describe the bug
When creating a new content with custom content type, draft field is populated as
draft: ""unless content type has a default value of true set for the draft field.To Reproduce
Steps to reproduce the behavior:
Here is my frontmatter.json
When draft is:
The frontmatter becomes:
I have to explicitly state:
in order to get:
Expected behavior
Standard draft field should have default of
truevalue on frontmatter creation.Desktop (please complete the following information):
Thanks, @anakinsleftleg, for this suggestion. The draft field will now be set to
truewhen no default value is provided.I thought, based on the documentation, that that was already the default outcome.
https://frontmatter.codes/docs/content-creation/fields#outcome
Seems to imply that it is.
I'll blame the person that wrote the documentation. Oh, wait, that was me. The good thing is that it will now work as how it is documented.