[docs] Separate some pages out of the Docs section (#1626)

This PR changes the structure of the docs site's sidebar.


![image](https://github.com/tldraw/tldraw/assets/15892272/ffe1e152-c921-43f0-9ba2-d084bda5e1e3)

I think this signposts more clearly what the different pages are for.
And it also paves the way for some work I want to do on
expanding+refining the Editor docs.

This PR also simplifies URL for all sidebar links.
It's a bit scrappy, but I think it feels simple enough to work with, and
easy-enough to change in the future.
> But hey! I've been doing this a couple times recently. Maybe we should
refactor? Or maybe we should keep going with what we've got and focus on
getting these docs *done*.

### Change Type

- [x] `documentation` — Changes to the documentation only[^2]

[^1]: publishes a `patch` release, for devDependencies use `internal`
[^2]: will not publish a new version

### Test Plan

1. Check that all the sidebar links go to where you expect.
2. Check that old URLs redirect to the right pages, eg: `/docs/usage`
should go to the usage page.


### Release Notes

- Documentation: Restructured the sidebar for clarity.
This commit is contained in:
Lu Wilson 2023-06-23 10:53:22 +01:00 committed by GitHub
parent d2c51ae3ba
commit c5fe399842
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 119 additions and 36 deletions

View file

@ -19,23 +19,14 @@ export async function getSidebarContentList({
if (section.id === 'gen') {
links.push({ type: 'article', title: 'API Reference', url: '/gen' })
// for (const category of section.categories) {
// if (category.id === 'ucg') {
// continue
// } else {
// children.push({
// type: 'article',
// title: category.title,
// url: `/${section.id}/${category.id}`,
// })
// }
// }
// links.push({ type: 'section', title: 'API Reference', url: '/gen', children })
continue
}
// If the article is in the getting-started section
// ... we place it at the top level of the sidebar
// ... so let's simplify its URL to reflect that
const sectionUrl = section.id === 'getting-started' ? '' : `/${section.id}`
for (const category of section.categories) {
if (category.id === 'ucg') {
continue
@ -43,13 +34,13 @@ export async function getSidebarContentList({
children.push({
type: 'category',
title: category.title,
url: `/${section.id}/${category.id}`,
url: `${sectionUrl}/${category.id}`,
children: category.articleIds.map((articleId) => {
const article = articles[articleId]
return {
type: 'article' as const,
title: article.title,
url: `/${section.id}/${category.id}/${articleId}`,
url: `${sectionUrl}/${category.id}/${articleId}`,
}
}),
})
@ -64,14 +55,14 @@ export async function getSidebarContentList({
return {
type: 'article' as const,
title: article.title,
url: `/${section.id}/${category.id}/${articleId}`,
url: `${sectionUrl}/${articleId}`,
}
})
)
}
}
links.push({ type: 'section', title: section.title, url: `/${section.id}`, children })
links.push({ type: 'section', title: section.title, url: sectionUrl, children })
}
return {