Introduction
Gatsby Theme Documentation is a minimalist theme designed for creating documentation websites using Gatsby. It leverages MDX for content creation and Theme UI for styling, providing a powerful and flexible foundation for building documentation sites. This theme allows developers to quickly set up a professional-looking documentation website and focus on writing content rather than dealing with complex setup and design issues.
Main Features
- MDX support for writing content with JSX in Markdown
- Theme UI-based theming for consistent and customizable styling
- Syntax highlighting for code blocks
- MDX-based sidebar navigation
- Automatic readme routing for GitHub-like directory structure
- Shortcode support with React components
- Collapsible menu for improved navigation
- Mobile-friendly design
- Custom docs schema for flexible content management
- Easy customization of sidebar and header content
- Component shadowing for extending functionality
Installation Steps
Install the theme in your Gatsby project:
yarn add gatsby-theme-documentation
Add the theme to your
gatsby-config.js
:module.exports = { plugins: ['gatsby-theme-documentation'] }
Alternatively, use one of the starter templates:
- Base:
gatsby new my-docs johno/gatsby-starter-documentation
- Dark:
gatsby new my-docs johno/gatsby-starter-documentation-dark
- Tomato:
gatsby new my-docs johno/gatsby-starter-documentation-tomato
- Base:
Usage Instructions
Customizing the Sidebar:
- Create a file at
src/gatsby-theme-documentation/sidebar.mdx
- Use MDX syntax to define your navigation structure
- Create a file at
Customizing the Header:
- Create a file at
src/gatsby-theme-documentation/header.mdx
- Use MDX to customize the header content
- Create a file at
Adding Component Shortcodes:
- Create
src/gatsby-theme-documentation/components.js
- Import base components and extend them with custom components
- Create
Writing Documentation:
- Create MDX files in your project's
docs
directory - Use GitHub-style
readme.md
files for automatic routing
- Create MDX files in your project's
Querying Documentation:
- Use GraphQL to query individual documents or collections
- Utilize the custom
Docs
schema for flexible content management
Styling:
- Leverage Theme UI for consistent theming across your site
- Customize colors, typography, and other design elements
Deploying:
- Build your site using Gatsby's build command
- Deploy the resulting static files to your preferred hosting platform
Important Notes
The theme uses MDX, allowing you to use JSX and React components directly in your Markdown files.
Readme routing automatically converts
file/path/readme.md
to/file/path/index.html
in the built site.The sidebar and header can be easily customized using MDX files, allowing for flexible navigation and branding.
Component shadowing can be used to extend or override theme components and functionality.
The theme provides a custom
Docs
GraphQL schema, enabling powerful querying and manipulation of documentation content.The collapsible menu feature improves navigation, especially on mobile devices.
Syntax highlighting is included out of the box for improved code readability.
The theme is designed to be minimal and performant, focusing on content presentation.
Theme UI integration allows for consistent and easily customizable styling across the entire site.
The theme is actively maintained and has a growing community, ensuring ongoing support and improvements.