From e7a9760611a222142cb7b4e92f999dc5ee6d365f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Peyronnet?= Date: Sat, 5 Nov 2022 17:05:19 +0000 Subject: [PATCH] Added new_meta_defaults options --- docs/configs.md | 19 +++++++++++++++++++ spec/fixtures/site/_config.yml | 5 +++++ src/components/CreateMarkdownPage.js | 1 + 3 files changed, 25 insertions(+) diff --git a/docs/configs.md b/docs/configs.md index db636c3e1..2c6e90460 100644 --- a/docs/configs.md +++ b/docs/configs.md @@ -35,3 +35,22 @@ Valid values for `homepage`: `pages` (default), `posts`, ``, jekyll_admin: homepage: "posts" ``` + +#### `new_meta_defaults` + +Add default values for meta fields of new drafts or posts. + +This is useful to define some meta fields that you want not to forget to set on your pages, but that do not have a default value given in `defaults` section of `_config.yml`. + +```yaml +jekyll_admin: + new_meta_defaults: + date: '' + image: '' + tags: [] + categories: [] + ... +``` + + + diff --git a/spec/fixtures/site/_config.yml b/spec/fixtures/site/_config.yml index 17aa0e5f6..8d7bb21b4 100644 --- a/spec/fixtures/site/_config.yml +++ b/spec/fixtures/site/_config.yml @@ -99,3 +99,8 @@ collections: jekyll_admin: homepage: "posts" + new_meta_defaults: + date: '' + image: '' + tags: [] + categories: [] diff --git a/src/components/CreateMarkdownPage.js b/src/components/CreateMarkdownPage.js index 34b6d507c..d75d5e6bd 100644 --- a/src/components/CreateMarkdownPage.js +++ b/src/components/CreateMarkdownPage.js @@ -37,6 +37,7 @@ export default function CreateMarkdownPage({ updateBody={updateBody} onSave={onClickSave} staticmetafields={defaultFields(config, splat, metaType)} + metafields={config.content?.jekyll_admin?.new_meta_defaults} />