From 8c825ea66e177c345246c70da333f0dcd67102b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Peyronnet?= Date: Mon, 31 Oct 2022 10:49:42 +0000 Subject: [PATCH] Add force show drafts configuration option --- docs/configs.md | 14 ++++++++++++++ src/containers/Sidebar.js | 5 ++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/docs/configs.md b/docs/configs.md index db636c3e1..bc253e115 100644 --- a/docs/configs.md +++ b/docs/configs.md @@ -35,3 +35,17 @@ Valid values for `homepage`: `pages` (default), `posts`, ``, jekyll_admin: homepage: "posts" ``` + + +#### `force_show_drafts` + +On some cases you want to use multiple config files or `--drafts` command line switch that won't be properly +detected by jekyll-admin. This flag can force jekyll-admin to display the draft section in the sidebar +even if `show_draft: true` hasn't been detected in the config file. + +It will only force display, not enable drafts. So be sure to have enabled drafts on jekyll. + +```yaml +jekyll_admin: + force_show_drafts: true +``` diff --git a/src/containers/Sidebar.js b/src/containers/Sidebar.js index 6300c4deb..79b3e60d9 100644 --- a/src/containers/Sidebar.js +++ b/src/containers/Sidebar.js @@ -117,7 +117,10 @@ export class Sidebar extends Component { const collectionsPanel = this.renderCollections(hiddenLinks); const postsPanel = !hiddenLinks.includes('posts'); - const draftsPanel = config && config.show_drafts; + const draftsPanel = + config && + (config.show_drafts || + (config.jekyll_admin && config.jekyll_admin.force_show_drafts)); return (