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
docs: move Breadcrumb and ToC component docs for i18n efforts (gatsbyjs#20913)
* move info for nav components in contributing docs, remove imports for i18n
* Update docs/contributing/docs-contributions.md
Co-Authored-By: Aisha Blake <[email protected]>
Copy file name to clipboardExpand all lines: docs/contributing/docs-and-website-components.md
-175Lines changed: 0 additions & 175 deletions
Original file line number
Diff line number
Diff line change
@@ -3,10 +3,6 @@ title: Docs and Website Components
3
3
tableOfContentsDepth: 2
4
4
---
5
5
6
-
import Breadcrumb from "../../www/src/components/docs-breadcrumb"
7
-
import { itemListContributing } from "../../www/src/utils/sidebar/item-list"
8
-
import TableOfContents from "../../www/src/components/docs-table-of-contents"
9
-
10
6
The Gatsbyjs.org site has a handful of components that have been developed to facilitate writing new content for the blog and the docs. There are also components that help organize and lay out content in various pages across the website.
11
7
12
8
This guide documents what components are available and explains how to use them. You can also refer to the [code for this page on GitHub](https://github.com/gatsbyjs/gatsby/blob/master/docs/contributing/docs-and-website-components.md) to see to how each component can be used, because they are all embedded here!
@@ -204,177 +200,6 @@ slug={props.slug}
204
200
205
201
---
206
202
207
-
## Other available components
208
-
209
-
Other less commonly used components aren't globally available, but can imported at the top of a Markdown file and used in other docs.
210
-
211
-
---
212
-
213
-
### Breadcrumb
214
-
215
-
The `<Breadcrumb />` component is used in layout files to display the hierarchy of pages a user is currently browsing on.
216
-
217
-
#### Usage
218
-
219
-
The Breadcrumb component takes one prop:
220
-
221
-
-`location` - an object provided in the props of page templates by default
222
-
-`itemList` - an object comprised of the docs hierarchical structure
_You can also refer to [an example of usage of the Breadcrumb in the Gatsbyjs.org source code](https://github.com/gatsbyjs/gatsby/blob/1d65ce051967dda5c4a89da920fc34692524e237/www/src/templates/template-docs-markdown.js#L82)_
232
-
233
-
#### Optional `breadcrumbTitle` entries in sidebar files
234
-
235
-
To alter the title of a doc that is displayed in the Breadcrumb component, a `breadcrumbTitle` is supported as a key in the [sidebar YAML files](https://github.com/gatsbyjs/gatsby/tree/master/www/src/data/sidebars). It is commonly used to provide an abbreviated version of a doc's title when displayed next to its parent page title, e.g. shortening "Adding a Custom webpack Config" to "webpack Config".
_You can also refer to [an example of usage of the Table of Contents in the Gatsbyjs.org source code](https://github.com/gatsbyjs/gatsby/blob/1d65ce051967dda5c4a89da920fc34692524e237/www/src/templates/template-docs-markdown.js#L121)_
269
-
270
-
The Table of Contents component also has some optional configurations that can be set in the frontmatter of a doc's markdown.
271
-
272
-
In docs where the Table of Contents isn't required and should be disabled, a key in the frontmatter called `disableTableOfContents` can be set to `true` like this:
273
-
274
-
```markdown
275
-
---
276
-
title: Glossary
277
-
disableTableOfContents: true
278
-
---
279
-
280
-
When you're new to Gatsby there can be a lot of words to learn...
281
-
```
282
-
283
-
In other docs where the Table of Contents is extremely long it can make sense to only show headers from the doc up to a certain level, rather than all subheadings. You can set the `tableOfContentsDepth` key to a number that will limit the subheadings shown in the table of contents to that "depth". If it is set to 2, `<h2>`/`##`, and `<h3>`/`###` headers will be listed, if set to 3, `<h2>`/`##`, `<h3>`/`###`, and `<h4>`/`####` will all be shown. It is set like this:
284
-
285
-
```markdown
286
-
---
287
-
title: Glossary
288
-
tableOfContentsDepth: 2
289
-
---
290
-
291
-
When you're new to Gatsby there can be a lot of words to learn...
292
-
```
293
-
294
-
#### Sample
295
-
296
-
The Table of Contents looks like this when rendered (and is also displayed on the right hand side of the page):
title: "Styling components on Gatsbyjs.org with Theme-UI",
360
-
items: [
361
-
{
362
-
url: "#design-tokens",
363
-
title: "Design tokens",
364
-
},
365
-
{
366
-
url: "#the-sx-prop",
367
-
title: "The sx prop",
368
-
},
369
-
],
370
-
},
371
-
],
372
-
},
373
-
}}
374
-
/>
375
-
376
-
---
377
-
378
203
## Writing content in Markdown
379
204
380
205
New docs and blog posts are added to the [docs](https://github.com/gatsbyjs/gatsby/tree/master/docs/) folder inside the Gatsby repository. They are stored as `.md` (Markdown) or `.mdx` (MDX) files and can be written using Markdown, or using inline JSX thanks to MDX. Writing in Markdown will output tags that are styled according to [Gatsby's design guidelines](/guidelines/color/).
Copy file name to clipboardExpand all lines: docs/contributing/docs-contributions.md
+42Lines changed: 42 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -103,6 +103,48 @@ It can be necessary to change a heading within the docs. It's important to note
103
103
- Determine the URL you're looking for. `Changing headers` is linked with a URL ending in `changing-headers`, `Docs renaming instructions` becomes `docs-renaming-instructions`, etc.
104
104
- Update all instances of the old URL to your new one. [Find and replace](https://code.visualstudio.com/docs/editor/codebasics#_search-across-files) in VS Code can help. Check that the context of the original link reference still makes sense with the new one.
105
105
106
+
## Configuring site navigation
107
+
108
+
The docs include custom built components to aid with navigation. In order to customize the navigation experience, these components allow some configurations without changing any of the React code.
109
+
110
+
### Adjusting breadcrumb titles
111
+
112
+
The `<Breadcrumb />` component is used in layout files to display the hierarchy of pages a user is currently browsing on at the top of each doc.
113
+
114
+
To alter the title of a doc that is displayed in the Breadcrumb component, `breadcrumbTitle` is supported as a key in the [sidebar YAML files](https://github.com/gatsbyjs/gatsby/tree/master/www/src/data/sidebars). It is commonly used to provide an abbreviated version of a doc's title when displayed next to its parent page title, e.g. shortening "Adding a Custom webpack Config" to "webpack Config".
The `<TableOfContents />` component is used to render a list of subheaders from a docs page and automatically provide deep links to them. It can be tweaked by values set in the frontmatter of a doc's markdown.
125
+
126
+
In docs where the Table of Contents isn't required and should be disabled, a key in the frontmatter called `disableTableOfContents` can be set to `true` like this:
127
+
128
+
```markdown
129
+
---
130
+
title: Glossary
131
+
disableTableOfContents: true
132
+
---
133
+
134
+
When you're new to Gatsby there can be a lot of words to learn...
135
+
```
136
+
137
+
In other docs where the Table of Contents is extremely long it can make sense to only show headers from the doc up to a certain level, rather than all subheadings. You can set the `tableOfContentsDepth` key to a number that will limit the subheadings shown in the table of contents to that "depth". If it is set to 2, `<h2>`/`##`, and `<h3>`/`###` headers will be listed, if set to 3, `<h2>`/`##`, `<h3>`/`###`, and `<h4>`/`####` will all be shown. It is set like this:
138
+
139
+
```markdown
140
+
---
141
+
title: Glossary
142
+
tableOfContentsDepth: 2
143
+
---
144
+
145
+
When you're new to Gatsby there can be a lot of words to learn...
146
+
```
147
+
106
148
## Adding embedded GraphQL examples
107
149
108
150
There are embedded examples in a few places in the docs (like the [GraphQL Reference guide](/docs/graphql-reference/)) that provide a working version of the code described. In the specific example of the GraphQL Query Options Reference page, these examples of the GraphiQL interface show how data can be queried from Gatsby's data layer.
0 commit comments