Skip to content
Snippets Groups Projects
Commit a3ad9153 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files
parents
Branches
No related tags found
No related merge requests found
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# nyc test coverage
.nyc_output
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# Typescript v1 declaration files
typings/
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# dotenv environment variable files
.env*
# gatsby files
.cache/
public
# Mac files
.DS_Store
# Yarn
yarn-error.log
.pnp/
.pnp.js
# Yarn Integrity file
.yarn-integrity
LICENSE 0 → 100644
MIT License
Copyright (c) 2020 Rocketseat
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
<p align="center">
<img src="https://rocketseat-cdn.s3-sa-east-1.amazonaws.com/theme-docs.svg" alt="A illustration of file that is the @rocketseat/gatsby-theme-docs logo" width="100">
</p>
<h2 align="center">
Gatsby Starter: Rocket Docs
</h2>
<p align="center">
Out of the box Gatsby Starter for creating documentation websites easily and quickly. With support for MDX, code highlight, Analytics, SEO and more 🔥 Using the theme: <a href="https://github.com/Rocketseat/gatsby-themes/tree/master/%40rocketseat/gatsby-theme-docs">@rocketseat/gatsby-theme-docs</a>
</p>
<p align="center">
<img src="https://img.shields.io/badge/PRs-welcome-%237159c1.svg" alt="PRs welcome!" />
<img alt="License" src="https://img.shields.io/badge/license-MIT-%237159c1">
<a href="https://twitter.com/intent/follow?screen_name=rocketseat">
<img src="https://img.shields.io/twitter/follow/rocketseat.svg?label=Follow%20@rocketseat" alt="Follow @rocketseat" />
</a>
</p>
## 🚀 Features
- MDX for docs;
- Fully customizable through the usage of Gatsby Themes (and Theme UI)
- Sidebar customization with Yaml;
- Code highlighting with [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) and [react-live](https://github.com/FormidableLabs/react-live) support. Copy code button and option to show line numbers.
- SEO (Sitemap, schema.org data, Open Graph and Twitter tags).
- Google Analytics support;
- Offline Support & WebApp Manifest
## ⚡️ Getting started
1. Create the website.
```sh
gatsby new rocket-docs https://github.com/rocketseat/gatsby-starter-rocket-docs
```
2. Start developing.
```sh
cd rocket-docs
gatsby develop
```
3. Are you ready for launch?
Your site is now running at `http://localhost:8000`
## 📄 Docs
Looking for docs? Check our live demo and documentation [website](https://rocketdocs.netlify.com).
---
Made with 💜 by Rocketseat :wave: [check our community!](https://discordapp.com/invite/gCRAFhc)
module.exports = {
siteMetadata: {
siteTitle: `@rocketseat/gatsby-theme-docs`,
defaultTitle: `@rocketseat/gatsby-theme-docs`,
siteTitleShort: `gatsby-theme-docs`,
siteDescription: `Out of the box Gatsby Theme for creating documentation websites easily and quickly`,
siteUrl: `https://rocketdocs.netlify.com`,
siteAuthor: `@rocketseat`,
siteImage: `/banner.png`,
siteLanguage: `en`,
themeColor: `#7159c1`,
basePath: `/`,
footer: `Theme by Rocketseat`,
},
plugins: [
{
resolve: `@rocketseat/gatsby-theme-docs`,
options: {
configPath: `src/config`,
docsPath: `src/docs`,
githubUrl: `https://github.com/rocketseat/gatsby-themes`,
baseDir: `examples/gatsby-theme-docs`,
},
},
{
resolve: `gatsby-plugin-manifest`,
options: {
name: `Rocketseat Gatsby Themes`,
short_name: `RS Gatsby Themes`,
start_url: `/`,
background_color: `#ffffff`,
display: `standalone`,
icon: `static/favicon.png`,
},
},
`gatsby-plugin-sitemap`,
{
resolve: `gatsby-plugin-google-analytics`,
options: {
// trackingId: ``,
},
},
{
resolve: `gatsby-plugin-canonical-urls`,
options: {
siteUrl: `https://rocketdocs.netlify.com`,
},
},
`gatsby-plugin-offline`,
],
};
This diff is collapsed.
{
"name": "gatsby-starter-rocket-docs",
"private": true,
"version": "1.0.0",
"description": "Out of the box Gatsby Starter for creating documentation websites easily and quickly. With support for MDX, code highlight, Analytics, SEO and more",
"author": "João Pedro Schmitz <oi@joaopedro.cc> (@joaopedro_cc)",
"license": "MIT",
"starter-name": "gatsby-starter-rocket-docs",
"dependencies": {
"@rocketseat/gatsby-theme-docs": "^2.1.0",
"gatsby": "^2.19.10",
"gatsby-plugin-canonical-urls": "^2.1.19",
"gatsby-plugin-google-analytics": "^2.1.34",
"gatsby-plugin-manifest": "^2.2.37",
"gatsby-plugin-offline": "^3.0.32",
"gatsby-plugin-sitemap": "^2.2.26",
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-dom": "^16.12.0"
},
"devDependencies": {},
"keywords": [
"gatsby",
"rocketseat",
"gatsby-starter"
],
"scripts": {
"build": "gatsby build",
"start": "gatsby develop",
"serve": "gatsby serve",
"clean": "gatsby clean"
}
}
# Introduction
A complete and awesome Gatsby Theme for documentation websites.
Forget about other things and focus on what matters: **writing docs.**
## Features
- 📝 MDX for docs;
- 🛣 Yaml-based sidebar navigation;
- 📱 Responsive and mobile friendly;
- 🖥 Code highlighting with [prism-react-renderer](https://github.com/FormidableLabs/prism-react-renderer) and [react-live](https://github.com/FormidableLabs/react-live) support;
- 🥇 SEO (Sitemap, schema.org data, Open Graph and Twitter tags).
- 📈 Google Analytics support;
- 📄 Custom docs schema;
- ⚡️ Offline Support & WebApp Manifest;
- and much more 🔥
<br />
[Get started now!](/getting-started)
# Sidebar navigation
- label: 'Introduction'
link: '/'
- label: 'Getting started'
link: '/getting-started'
- label: Usage
items:
- label: 'Creating docs'
link: '/usage/creating-docs'
- label: 'Navigation'
link: '/usage/navigation'
- label: 'Shadowing'
link: '/usage/shadowing'
---
title: 'Getting started'
---
The best way yo start is by using our starter:
```bash
gatsby new rocket-docs https://github.com/rocketseat/gatsby-starter-theme-docs
```
But, if you prefer, you can install and configure manually.
```bash
# Using Yarn:
yarn add @rocketseat/gatsby-theme-docs
# Using NPM:
npm i @rocketseat/gatsby-theme-docs
```
## Theme Options
| Key | Default | Required | Description |
| ---------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
| basePath | / | No | Root url for all docs |
| configPath | config | No | Location of config files |
| docsPath | docs | No | The site description for SEO and social (FB, Twitter) tags |
| githubUrl | - | No | The complete URL of your repository. For example: `https://github/rocketseat/gatsby-themes` |
| baseDir | - | No | If your Gatsby site does not live in the root of your project directory/git repo, pass the subdirectory name here (ex: `docs`) |
## Example usage
```js title=gatsby-config.js
module.exports = {
siteMetadata: {
siteTitle: `@rocketseat/gatsby-theme-docs`,
defaultTitle: `@rocketseat/gatsby-theme-docs`,
siteTitleShort: `gatsby-theme-docs`,
siteDescription: `Out of the box Gatsby Theme for creating documentation websites easily and quickly`,
siteUrl: `https://rocketdocs.netlify.com`,
siteAuthor: `@rocketseat`,
siteImage: `/banner.png`,
siteLanguage: `en`,
themeColor: `#7159c1`,
},
plugins: [
{
resolve: `@rocketseat/gatsby-theme-docs`,
options: {
docsPath: `src/docs`,
basePath: `/`,
},
},
],
};
```
Once you have installed the dependencies you will need to create the [navigation](/usage/navigation) and [documentation](/usage/creating-docs) file.
After that, you are ready 🚀
---
title: Creating docs
---
By creating a MDX file inside your docs folder it will be created as a page, with the path defined by the filename.
Inside all docs files, you can define the following options:
<div style="overflow-x:auto;">
<table>
<tr>
<th>Key</th>
<th>Required?</th>
<th>Description</th>
</tr>
<tr>
<td>title</td>
<td>Yes</td>
<td>Page title</td>
</tr>
<tr>
<td>description</td>
<td>No</td>
<td>Page description</td>
</tr>
<tr>
<td>image</td>
<td>No</td>
<td>Used for og:image</td>
</tr>
</table>
</div>
### Example:
```mdx
---
title: 'My Example'
description: 'A simple description for this page'
image: /banner.jpeg
---
Wow, this is a nice page
```
## Embeding files
In a documentation website, sometimes you will need to embed well known services (like CodeSandbox, Twitter, or others...). If you need to
do it, you can simply copy-paste the link (powered by the awesome [gatsby-remark-embeder](https://www.gatsbyjs.org/packages/gatsby-remark-embedder/)).
Make sure to check the [supported services](https://github.com/MichaelDeBoey/gatsby-remark-embedder#supported-services).
https://youtu.be/QfcozcbDhNM
## Code Highlight
### Title
To show the title, just add it to your code block. Ex: `title=src/myfile.css`
```css title=src/myfile.css
.gatsby::before {
content: 'niceee...';
}
```
### Line numbers
If you want to show line number, just add a option `lineNumbers=true`.
```js lineNumbers=true
const rocket = {
launch: () => console.log('Launching...'),
};
rocket.launch();
```
### React live
As mentioned in the introduction, this theme uses `react-live`, so you can
create a playground for live editing React components.
To use it, just add a `live=true` option to your code block.
```jsx live=true
function MyComponent() {
function handleButtonClick() {
alert('wowww');
}
return <button onClick={handleButtonClick}>Hey, click me!</button>;
}
render(<MyComponent />);
```
---
title: Navigation
---
To create a navigation file, simple add it under the config folder. Example:
```yml title=sidebar.yml
# Just a simple item
- label: 'Home'
link: '/'
# With a list of items
- label: 'With subitens'
items:
- label: 'My Example'
link: '/my-example'
```
You can also add external links:
```yml
- label: 'GitHub'
link: 'https://github.com/jpedroschmitz'
```
---
title: Shadowing
---
To shadow/override this theme, you will need to place your files into `src/@rocketseat/gatsby-theme-docs/` folder.
_ps: if you still have questions, check the [Shadowing in Gatsby Themes](https://www.gatsbyjs.org/docs/themes/shadowing/) article._
## Changing the logo
If you want to change the logo just create the following file:
```js title=src/@rocketseat/gatsby-theme-docs/components/Logo.js
import styled from '@emotion/styled';
import logo from '../assets/logo.svg';
export default styled.div`
width: 160px;
height: 36px;
background-size: contain;
background: url(${logo}) center no-repeat;
`;
```
## Changing the home text
Create a file at `src/@rocketseat/gatsby-theme-docs/text/index.mdx` to edit the text.
import React from 'react';
import { Link } from 'gatsby';
import Layout from '@rocketseat/gatsby-theme-docs/src/components/Layout';
import SEO from '@rocketseat/gatsby-theme-docs/src/components/SEO';
export default function NotFound() {
return (
<Layout title="Page not found!">
<SEO title="404: Not found" />
<p>You just hit a route that doesn&#39;t exist... the sadness.</p>
<p>
If you&#39;d like to go back to homepage,{' '}
<Link to="/">click here</Link>.
</p>
</Layout>
);
}
static/banner.png

38.3 KiB

static/favicon.png

10.6 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment