mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 15:47:23 +02:00
chore(v2): add tbd v2 docs (#1408)
* docs(v2): docusaurus 2 own docs * misc(v2): try to get multiple sidebar working * misc(v2): tweak CSS * fix(v2): fix conflicting docsMetadata
This commit is contained in:
parent
9c27884823
commit
528bd7f280
7 changed files with 76 additions and 26 deletions
|
@ -234,13 +234,17 @@ class DocusaurusPluginContentDocs {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const docsBaseRoute = normalizeUrl([
|
||||||
|
this.context.siteConfig.baseUrl,
|
||||||
|
routeBasePath,
|
||||||
|
]);
|
||||||
const docsMetadataPath = await createData(
|
const docsMetadataPath = await createData(
|
||||||
`docsMetadata.json`,
|
`${docuHash(docsBaseRoute)}.json`,
|
||||||
JSON.stringify(content, null, 2),
|
JSON.stringify(content, null, 2),
|
||||||
);
|
);
|
||||||
|
|
||||||
addRoute({
|
addRoute({
|
||||||
path: normalizeUrl([this.context.siteConfig.baseUrl, routeBasePath]),
|
path: docsBaseRoute,
|
||||||
component: docLayoutComponent,
|
component: docLayoutComponent,
|
||||||
routes,
|
routes,
|
||||||
modules: {
|
modules: {
|
||||||
|
|
|
@ -26,14 +26,16 @@ function Doc(props) {
|
||||||
<title>{siteConfig.title}</title>
|
<title>{siteConfig.title}</title>
|
||||||
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
|
{favicon && <link rel="shortcut icon" href={baseUrl + favicon} />}
|
||||||
</Head>
|
</Head>
|
||||||
|
<div className="container container--fluid">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col col--3">
|
<div className="col col--3">
|
||||||
<Sidebar docsMetadata={docsMetadata} location={location} />
|
<Sidebar docsMetadata={docsMetadata} location={location} />
|
||||||
</div>
|
</div>
|
||||||
<div className="col col--9" style={{padding: '0 3rem'}}>
|
<div className="col col--9">
|
||||||
{renderRoutes(route.routes, {docsMetadata})}
|
{renderRoutes(route.routes, {docsMetadata})}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</Layout>
|
</Layout>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,12 @@ function DocBody(props) {
|
||||||
<div className="container margin-vert--lg">
|
<div className="container margin-vert--lg">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
<div className="col col--8">
|
<div className="col col--8">
|
||||||
|
{/* TODO: remove this in the future */}
|
||||||
|
<div className="alert alert--warning" role="alert">
|
||||||
|
Docusaurus 2 is still <strong>work in progress</strong>. Do not
|
||||||
|
use it in production yet!
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
<header>
|
<header>
|
||||||
<h1 className="margin-bottom--lg">{metadata.title}</h1>
|
<h1 className="margin-bottom--lg">{metadata.title}</h1>
|
||||||
</header>
|
</header>
|
||||||
|
|
15
website/docs/introduction.md
Normal file
15
website/docs/introduction.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
---
|
||||||
|
id: introduction
|
||||||
|
title: Introduction
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Docusaurus is a **painless static site generator** powered by React.
|
||||||
|
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
TODO
|
||||||
|
|
|
@ -13,7 +13,8 @@ module.exports = {
|
||||||
baseUrl: '/',
|
baseUrl: '/',
|
||||||
url: 'https://docusaurus-2.netlify.com',
|
url: 'https://docusaurus-2.netlify.com',
|
||||||
headerLinks: [
|
headerLinks: [
|
||||||
{url: 'docs/installation', label: 'Docs'},
|
{url: 'docs-legacy/installation', label: 'Docs V1'},
|
||||||
|
{url: 'docs/introduction', label: 'Docs'},
|
||||||
{url: 'blog', label: 'Blog'},
|
{url: 'blog', label: 'Blog'},
|
||||||
{url: 'feedback/', label: 'Feedback'},
|
{url: 'feedback/', label: 'Feedback'},
|
||||||
],
|
],
|
||||||
|
@ -29,7 +30,7 @@ module.exports = {
|
||||||
'@docusaurus/preset-classic',
|
'@docusaurus/preset-classic',
|
||||||
{
|
{
|
||||||
docs: {
|
docs: {
|
||||||
path: '../docs',
|
path: 'docs',
|
||||||
sidebarPath: require.resolve('./sidebars.json'),
|
sidebarPath: require.resolve('./sidebars.json'),
|
||||||
},
|
},
|
||||||
blog: {
|
blog: {
|
||||||
|
@ -38,4 +39,14 @@ module.exports = {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
plugins: [
|
||||||
|
{
|
||||||
|
name: '@docusaurus/plugin-content-docs',
|
||||||
|
options: {
|
||||||
|
path: '../docs',
|
||||||
|
routeBasePath: 'docs-legacy',
|
||||||
|
sidebarPath: require.resolve('./sidebars-legacy.json'),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
};
|
};
|
||||||
|
|
25
website/sidebars-legacy.json
Normal file
25
website/sidebars-legacy.json
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
{
|
||||||
|
"docs-legacy": {
|
||||||
|
"Getting Started": [
|
||||||
|
"installation",
|
||||||
|
"site-preparation",
|
||||||
|
"site-creation",
|
||||||
|
"publishing",
|
||||||
|
"docker"
|
||||||
|
],
|
||||||
|
"Guides": [
|
||||||
|
"adding-blog",
|
||||||
|
"custom-pages",
|
||||||
|
"search",
|
||||||
|
"navigation",
|
||||||
|
"translation",
|
||||||
|
"versioning"
|
||||||
|
],
|
||||||
|
"API": [
|
||||||
|
"commands",
|
||||||
|
"doc-markdown",
|
||||||
|
"api-pages",
|
||||||
|
"site-config"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,20 +1,7 @@
|
||||||
{
|
{
|
||||||
"docs": {
|
"docs": {
|
||||||
"Getting Started": [
|
"Quick Start": [
|
||||||
"installation",
|
"introduction"
|
||||||
"site-preparation",
|
]
|
||||||
"site-creation",
|
|
||||||
"publishing",
|
|
||||||
"docker"
|
|
||||||
],
|
|
||||||
"Guides": [
|
|
||||||
"adding-blog",
|
|
||||||
"custom-pages",
|
|
||||||
"search",
|
|
||||||
"navigation",
|
|
||||||
"translation",
|
|
||||||
"versioning"
|
|
||||||
],
|
|
||||||
"API": ["commands", "doc-markdown", "api-pages", "site-config"]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue