You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since the redesign of the website, we have a new section called 'Learn'. This is intended to provide a more explanatory set of resources than the API docs, which are designed purely to explain the available APIs.
249
+
250
+
The Learn section is separate from the API docs and is intended to provide a more narrative, tutorial style set of resources. This is a place where we can provide more context and guidance on how to use the APIs and how to build applications with them.
251
+
252
+
The Learn section is also divided into several sub-categories. Note that the sub-categories must be on the same topic.
253
+
254
+
### Structure of the Learn section
255
+
256
+
The file structure of the Learn section is as follows:
257
+
258
+
```
259
+
site/
260
+
├─ pages/
261
+
│ ├─ en/
262
+
│ │ ├─ learn/
263
+
│ │ │ ├─ sub-categories/
264
+
│ │ │ │ ├─ article.md
265
+
```
266
+
267
+
The frontmatter of the `article.md` file should look like this:
268
+
269
+
```yaml
270
+
title: A super cool title
271
+
layout: learn
272
+
authors: github_username, another_github_username
273
+
```
274
+
275
+
A little bit of explanation about the frontmatter:
276
+
277
+
- `title`: The title of the article. This will be displayed as the title of the page. We recommend that you use the same title as the navigation entry. How to enter navigation entries is explained later in this document.
278
+
- `layout`: This must be set to `learn` so that the new article has the same style as other Learn pages.
279
+
- `authors`: A list of the GitHub usernames of the authors of the article. This is used to display the authors' profile pictures on the page. The frontmatter must always have the `github_username` followed by `, `. The comma and space is important.
280
+
281
+
### Modify the navigation
282
+
283
+
The data of the navigation is stored in app/site/navigation.json. To add a new entry to the navigation, you need to add a new object to the sideNavigation.learn.
The `label` key is used to display the title of the article in the navigation. To add a new i18n key we recommend you to read [the translation guide](./TRANSLATION.md#adding-new-translation-keys).
304
+
305
+
### Add the article
306
+
307
+
To add a new article, you need to create a new markdown file in the `site/pages/en/learn/your-sub-category` directory.
308
+
309
+
1. Create your new markdown file in the `site/pages/en/learn/your-sub-category` directory.
310
+
2. Add the frontmatter to the file.
311
+
3. Write your article.
312
+
4. Add the navigation entry to `app/site/navigation.json`.
313
+
5. Add the translation key to the translation files.
314
+
315
+
DONE!
316
+
317
+
### Edit the article
318
+
319
+
To edit an existing article, you need to find the markdown file in the `site/pages/en/learn/your-sub-category` directory.
320
+
321
+
> [!NOTE]
322
+
> If you rewrite a big part of the article you can add yourself as an author in the frontmatter. **But** if you only fix a typo or a small part of the article, you don't need to add yourself as an author.
323
+
324
+
### Accessible MDX components
325
+
326
+
#### Codebox
327
+
328
+
The codebox component is used to display code snippets. If two code snippets follow without any text between them, they will be displayed in the same codebox, but with two tabs.
329
+
330
+
```md
331
+
'''cjs
332
+
const http = require('node:http');
333
+
'''
334
+
335
+
'''mjs
336
+
import http from 'node:http';
337
+
'''
338
+
```
339
+
340
+
`cjs` and `mjs` are variants of `js`, it's just to display the correct language in the codebox (cjs = CommonJS, mjs = ES Module).
0 commit comments