From 212ae29a7e10151700a7d230d3189232fa21d7be Mon Sep 17 00:00:00 2001 From: Mateusz Filipowicz Date: Thu, 4 Jun 2020 06:37:13 +0200 Subject: [PATCH] feat(components): :sparkles: make previous-next buttons configurable (on/off) --- config/config.yml | 1 + gatsby-node.js | 1 + src/templates/docs.js | 12 +++++++++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/config/config.yml b/config/config.yml index 166859a3..597c4159 100644 --- a/config/config.yml +++ b/config/config.yml @@ -66,3 +66,4 @@ features: enabled: true toc: depth: 3 + previousNext: true diff --git a/gatsby-node.js b/gatsby-node.js index 07a40425..1f697fd0 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -14,6 +14,7 @@ exports.createSchemaCustomization = ({ actions }) => { skipToC: Boolean editable: Boolean skipMetadata: Boolean + showPreviousNext: Boolean metaDescription: String metaTitle: String order: Int diff --git a/src/templates/docs.js b/src/templates/docs.js index 0cf93012..69ad8baa 100644 --- a/src/templates/docs.js +++ b/src/templates/docs.js @@ -165,9 +165,14 @@ export default class MDXRuntimeTest extends React.Component { {mdx.body} -
- -
+ {(config.features.previousNext === true && mdx.frontmatter.showPreviousNext != false) || + mdx.frontmatter.showPreviousNext ? ( +
+ +
+ ) : ( + '' + )} ); } @@ -207,6 +212,7 @@ export const pageQuery = graphql` metaDescription skipMetadata editable + showPreviousNext skipToC } }