|
1 | | -This website was created with [Docusaurus](https://docusaurus.io/). |
| 1 | +# Website |
2 | 2 |
|
3 | | -# What's In This Document |
| 3 | +This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator. |
4 | 4 |
|
5 | | -* [Get Started in 5 Minutes](#get-started-in-5-minutes) |
6 | | -* [Directory Structure](#directory-structure) |
7 | | -* [Editing Content](#editing-content) |
8 | | -* [Adding Content](#adding-content) |
9 | | -* [Full Documentation](#full-documentation) |
| 5 | +### Installation |
10 | 6 |
|
11 | | -# Get Started in 5 Minutes |
12 | | - |
13 | | -1. Make sure all the dependencies for the website are installed: |
14 | | - |
15 | | -```sh |
16 | | -# Install dependencies |
17 | | -$ yarn |
18 | | -``` |
19 | | -2. Run your dev server: |
20 | | - |
21 | | -```sh |
22 | | -# Start the site |
23 | | -$ yarn start |
24 | | -``` |
25 | | - |
26 | | -## Directory Structure |
27 | | - |
28 | | -Your project file structure should look something like this |
29 | | - |
30 | | -``` |
31 | | -my-docusaurus/ |
32 | | - docs/ |
33 | | - doc-1.md |
34 | | - doc-2.md |
35 | | - doc-3.md |
36 | | - website/ |
37 | | - blog/ |
38 | | - 2016-3-11-oldest-post.md |
39 | | - 2017-10-24-newest-post.md |
40 | | - core/ |
41 | | - node_modules/ |
42 | | - pages/ |
43 | | - static/ |
44 | | - css/ |
45 | | - img/ |
46 | | - package.json |
47 | | - sidebar.json |
48 | | - siteConfig.js |
49 | 7 | ``` |
50 | | - |
51 | | -# Editing Content |
52 | | - |
53 | | -## Editing an existing docs page |
54 | | - |
55 | | -Edit docs by navigating to `docs/` and editing the corresponding document: |
56 | | - |
57 | | -`docs/doc-to-be-edited.md` |
58 | | - |
59 | | -```markdown |
60 | | ---- |
61 | | -id: page-needs-edit |
62 | | -title: This Doc Needs To Be Edited |
63 | | ---- |
64 | | - |
65 | | -Edit me... |
66 | | -``` |
67 | | - |
68 | | -For more information about docs, click [here](https://docusaurus.io/docs/en/navigation) |
69 | | - |
70 | | -## Editing an existing blog post |
71 | | - |
72 | | -Edit blog posts by navigating to `website/blog` and editing the corresponding post: |
73 | | - |
74 | | -`website/blog/post-to-be-edited.md` |
75 | | -```markdown |
76 | | ---- |
77 | | -id: post-needs-edit |
78 | | -title: This Blog Post Needs To Be Edited |
79 | | ---- |
80 | | - |
81 | | -Edit me... |
| 8 | +$ yarn |
82 | 9 | ``` |
83 | 10 |
|
84 | | -For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog) |
85 | | - |
86 | | -# Adding Content |
87 | | - |
88 | | -## Adding a new docs page to an existing sidebar |
89 | | - |
90 | | -1. Create the doc as a new markdown file in `/docs`, example `docs/newly-created-doc.md`: |
91 | | - |
92 | | -```md |
93 | | ---- |
94 | | -id: newly-created-doc |
95 | | -title: This Doc Needs To Be Edited |
96 | | ---- |
| 11 | +### Local Development |
97 | 12 |
|
98 | | -My new content here.. |
99 | 13 | ``` |
100 | | - |
101 | | -1. Refer to that doc's ID in an existing sidebar in `website/sidebar.json`: |
102 | | - |
103 | | -```javascript |
104 | | -// Add newly-created-doc to the Getting Started category of docs |
105 | | -{ |
106 | | - "docs": { |
107 | | - "Getting Started": [ |
108 | | - "quick-start", |
109 | | - "newly-created-doc" // new doc here |
110 | | - ], |
111 | | - ... |
112 | | - }, |
113 | | - ... |
114 | | -} |
| 14 | +$ yarn start |
115 | 15 | ``` |
116 | 16 |
|
117 | | -For more information about adding new docs, click [here](https://docusaurus.io/docs/en/navigation) |
| 17 | +This command starts a local development server and open up a browser window. Most changes are reflected live without having to restart the server. |
118 | 18 |
|
119 | | -## Adding a new blog post |
| 19 | +### Build |
120 | 20 |
|
121 | | -1. Make sure there is a header link to your blog in `website/siteConfig.js`: |
122 | | - |
123 | | -`website/siteConfig.js` |
124 | | -```javascript |
125 | | -headerLinks: [ |
126 | | - ... |
127 | | - { blog: true, label: 'Blog' }, |
128 | | - ... |
129 | | -] |
130 | 21 | ``` |
131 | | - |
132 | | -2. Create the blog post with the format `YYYY-MM-DD-My-Blog-Post-Title.md` in `website/blog`: |
133 | | - |
134 | | -`website/blog/2018-05-21-New-Blog-Post.md` |
135 | | - |
136 | | -```markdown |
137 | | ---- |
138 | | -author: Frank Li |
139 | | -authorURL: https://twitter.com/foobarbaz |
140 | | -authorFBID: 503283835 |
141 | | -title: New Blog Post |
142 | | ---- |
143 | | - |
144 | | -Lorem Ipsum... |
| 22 | +$ yarn build |
145 | 23 | ``` |
146 | 24 |
|
147 | | -For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog) |
| 25 | +This command generates static content into the `build` directory and can be served using any static contents hosting service. |
148 | 26 |
|
149 | | -## Adding items to your site's top navigation bar |
| 27 | +### Deployment |
150 | 28 |
|
151 | | -1. Add links to docs, custom pages or external links by editing the headerLinks field of `website/siteConfig.js`: |
152 | | - |
153 | | -`website/siteConfig.js` |
154 | | -```javascript |
155 | | -{ |
156 | | - headerLinks: [ |
157 | | - ... |
158 | | - /* you can add docs */ |
159 | | - { doc: 'my-examples', label: 'Examples' }, |
160 | | - /* you can add custom pages */ |
161 | | - { page: 'help', label: 'Help' }, |
162 | | - /* you can add external links */ |
163 | | - { href: 'https://github.com/facebook/Docusaurus', label: 'GitHub' }, |
164 | | - ... |
165 | | - ], |
166 | | - ... |
167 | | -} |
168 | 29 | ``` |
169 | | - |
170 | | -For more information about the navigation bar, click [here](https://docusaurus.io/docs/en/navigation) |
171 | | - |
172 | | -## Adding custom pages |
173 | | - |
174 | | -1. Docusaurus uses React components to build pages. The components are saved as .js files in `website/pages/en`: |
175 | | -1. If you want your page to show up in your navigation header, you will need to update `website/siteConfig.js` to add to the `headerLinks` element: |
176 | | - |
177 | | -`website/siteConfig.js` |
178 | | -```javascript |
179 | | -{ |
180 | | - headerLinks: [ |
181 | | - ... |
182 | | - { page: 'my-new-custom-page', label: 'My New Custom Page' }, |
183 | | - ... |
184 | | - ], |
185 | | - ... |
186 | | -} |
| 30 | +$ GIT_USER=<Your GitHub username> USE_SSH=true yarn deploy |
187 | 31 | ``` |
188 | 32 |
|
189 | | -For more information about custom pages, click [here](https://docusaurus.io/docs/en/custom-pages). |
190 | | - |
191 | | -# Full Documentation |
192 | | - |
193 | | -Full documentation can be found on the [website](https://docusaurus.io/). |
| 33 | +If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch. |
0 commit comments