Skip to content

Hide an article from the sidebar or draft mode

Pepe Cano edited this page Apr 17, 2020 · 2 revisions

k6 doc project provides the options to hide articles:

  • ability to hide certain articles from the sidebar and mobile dropdown menu while respectful pages still have to be generated and accessible via other links or manual url typing.
  • ability to generate certain content only in dev mode to prevent leaking doc entries into prod

Hide from sidebar:

Add hideFromSidebar field to the .md file you want to hide from sidebar:

---
title: 'k6 REST API'
excerpt: ''
hideFromSidebar: true
---

Then rebuild project in prod mode.

Caveats:

  1. You have to keep at least one frontmatter hideFromSidebar field among .md files with any value to prevent GraphQL query errors. Consider using Boolean types for clarity.
  2. You cannot hide article cluster with that option! Given:

If you want to hide from sidebar the whole k6-ws cluster you should add hideFromSidebar to each .md file in a cluster. Setting this field only to high level 08 [k6-ws.md](http://k6-ws.md) will lead to unwanted behaviour.

Hide from the prod:

Add draft flag to the frontmatter field to be available in dev mode or the staging environment

---
title: 'k6 REST API'
excerpt: ''
draft: 'true'
---

Then rebuilt in prod mode

Caveats:

Actually, they are exactly the same:

  • draft is a string.

  • keep at least 1 draft flag with any value among .md entries to prevent build errors from graphql

  • do not use this flag at high level entries (look at example above with k6-ws)