0.0.27 • Published 4 years ago

gatsby-theme-documentation v0.0.27

Weekly downloads
99
License
MIT
Repository
github
Last release
4 years ago

gatsby-theme-documentation

A minimalist Gatsby Theme for documentation sites built with MDX and Theme UI.

Get up and running in seconds with a beautiful docs site so you can do what's more important: write docs.

image

Features

Installation

yarn add gatsby-theme-documentation

Install as a starter

NameCommand
Basegatsby new johno/gatsby-starter-documentation
Darkgatsby new johno/gatsby-starter-documentation-dark
Tomatogatsby new johno/gatsby-starter-documentation-tomato

Read the full setup guide

Usage

// gatsby-config.js
module.exports = {
  plugins: [
    'gatsby-theme-documentation'
  ]
}

Customizing the sidebar

gatsby-theme-documentation uses a sidebar.mdx file to populate the navigation. In order to customize it you can shadow it by creating a file at src/gatsby-theme-documentation/sidebar.mdx.

Example sidebar.mdx

- [Introduction](/introduction/)
- [Getting Started](/getting-started/)
- [GitHub](https://github.com/johno/gatsby-theme-documentation)

Customizing the header

Similarly to sidebar customization, you can also change the header content by writing MDX. You can shadow the default header by creating a file at src/gatsby-theme-documentation/header.mdx

Example header.mdx

# ![Docs Logo](https://contrast.now.sh/white/black?width=80&height=40&text=DOCS)

- [GitHub](https://github.com/johno/gatsby-theme-documentation)
- [Twitter](https://twitter.com/4lpine)

Adding component shortcodes

You can add shortcodes to your docs site which can be used throughout your docs pages by extending the components passed to MDXProvider. You can do this by using component shadowing and creating the following file in the root of your project: src/gatsby-theme-documentation/components.js.

Example components.js

import baseComponents from 'gatsby-theme-documentation/src/components'

import MyCustomH1 from '../components/my-custom-h1'

export default {
  ...baseComponents,
  h1: MyCustomH1
}

Readme routing

In order to get documents rendered in directories on GitHub, it's common to specify a readme.md similarly to the index.html on normal websites. Since this theme is meant to work seamlessly with docs directories on GitHub, file/path/readme.md will be automatically turned into /file/path/index.html in the built site. Links will also be redirected to support the new url scheme.

Docs schema

This theme creates a Docs type which can be queried as an individual document or a collection. This data can be used to create additional pages, create summaries, etc.

Query an individual document

{
  docs(slug: {eq: "/some-page"}) {
    slug
    body
  }
}

Query a collection

{
  allDocs {
    slug
  }
}
0.0.28-ci.15

4 years ago

0.0.28-ci.14

4 years ago

0.0.28-ci.13

4 years ago

0.0.28-ci.12

5 years ago

0.0.28-ci.11

5 years ago

0.0.28-ci.10

5 years ago

0.0.28-ci.8

5 years ago

0.0.28-ci.7

5 years ago

0.0.28-ci.6

5 years ago

0.0.28-ci.5

5 years ago

0.0.28-ci.4

5 years ago

0.0.28-ci.3

5 years ago

0.0.28-ci.2

5 years ago

0.0.28-ci.1

5 years ago

0.0.28-ci.0

5 years ago

0.0.27

5 years ago

0.0.27-ci.0

5 years ago

0.0.26-ci.17

5 years ago

0.0.26-ci.16

5 years ago

0.0.26

5 years ago

0.0.26-ci.14

5 years ago

0.0.25

5 years ago

0.0.24

5 years ago

0.0.23

5 years ago

0.0.22

5 years ago

0.0.22-ci.4

5 years ago

0.0.21

5 years ago

0.0.20

5 years ago

0.0.19

5 years ago

0.0.18

5 years ago

0.0.17

5 years ago

0.0.16

5 years ago

0.0.15

5 years ago

0.0.14

5 years ago

0.0.13

5 years ago

0.0.12

5 years ago

0.0.11

5 years ago

0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago