-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(v2): allow using classic theme/preset without the docs plugin (#3382
) * deprecated nextVersionLabel option * useActivePlugin failfast option * remove deprecated option nextVersionLabel * routeBasePath: '' should be forbidden * routeBasePath: '' should be forbidden * Docs: do not show version badge if there is only 1 version: #3362 * allow sidebars file to not exist: fallback to empty sidebars https://githu.com/facebook/docusaurus/issues/3366 * Ability to use classic theme/preset while not using docs/pages without trouble. #3360 * fix netlify redirects * do not throw if useDocs do not load? * netlify deploy typo * try to fix useDocs * docs(v2): update Deploy to Vercel guide (#3344) * filter annoying useDocs conditional require warning * netlify deploy preview homepage * typo * try to trigger again CLA bot Co-authored-by: Sam Ko <[email protected]>
- Loading branch information
Showing
14 changed files
with
223 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/docusaurus-theme-classic/src/theme/hooks/useDocs.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
// See https://github.com/facebook/docusaurus/issues/3360 | ||
// TODO find a better solution, this shouldn't be needed | ||
|
||
// TODO this is not ideal and produce a warning! | ||
// see https://github.com/webpack/webpack/issues/7713#issuecomment-467888437 | ||
// note: warning can be filtered: https://github.com/facebook/docusaurus/pull/3382#issuecomment-684966924 | ||
try { | ||
module.exports = require('@theme-init/hooks/useDocs'); | ||
} catch (e) { | ||
module.exports = {}; | ||
} | ||
|
||
/* | ||
throw new Error( | ||
"The docs plugin is not used, so you can't require the useDocs hooks. ", | ||
); | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
module.exports = { | ||
title: 'Docusaurus blog only!', | ||
tagline: 'Build optimized websites quickly, focus on your content', | ||
organizationName: 'facebook', | ||
projectName: 'docusaurus', | ||
baseUrl: '/blog-only/', | ||
url: 'https://v2.docusaurus.io', | ||
onBrokenLinks: 'throw', | ||
favicon: 'img/docusaurus.ico', | ||
themes: ['@docusaurus/theme-live-codeblock'], | ||
plugins: [], | ||
presets: [ | ||
[ | ||
'@docusaurus/preset-classic', | ||
{ | ||
docs: false, | ||
pages: false, | ||
blog: { | ||
routeBasePath: '/', | ||
path: '../website-1.x/blog', | ||
editUrl: | ||
'https://github.com/facebook/docusaurus/edit/master/website-1.x/', | ||
postsPerPage: 3, | ||
feedOptions: { | ||
type: 'all', | ||
copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc.`, | ||
}, | ||
}, | ||
theme: { | ||
customCss: require.resolve('./src/css/custom.css'), | ||
}, | ||
}, | ||
], | ||
], | ||
themeConfig: { | ||
image: 'img/docusaurus-soc.png', | ||
navbar: { | ||
hideOnScroll: true, | ||
title: 'Docusaurus', | ||
logo: { | ||
alt: 'Docusaurus Logo', | ||
src: 'img/docusaurus.svg', | ||
srcDark: 'img/docusaurus_keytar.svg', | ||
}, | ||
}, | ||
footer: { | ||
style: 'dark', | ||
logo: { | ||
alt: 'Facebook Open Source Logo', | ||
src: 'img/oss_logo.png', | ||
href: 'https://opensource.facebook.com', | ||
}, | ||
copyright: `Copyright © ${new Date().getFullYear()} Facebook, Inc. Built with Docusaurus.`, | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/classic/* /classic/404.html 200 | ||
/bootstrap/* /bootstrap/404.html 200 | ||
/blog-only/* /blog-only/404.html 200 | ||
/* /classic/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<body style="padding: 20px;"> | ||
<img src="https://v2.docusaurus.io/img/docusaurus.png" /> | ||
<h1 style="margin-top: 20px;"> | ||
Docusaurus deploy previews | ||
</h1> | ||
<section style="margin-top: 40px;"> | ||
<p> | ||
We deploy the Docusaurus site with various configurations. It helps us | ||
find potential regressions. | ||
</p> | ||
<p>When in doubt, try the <a href="/classic">classic preview</a></p> | ||
</section> | ||
<section style="margin-top: 40px;"> | ||
<h2>Available deploy previews:</h2> | ||
<ul style="margin-top: 20px;"> | ||
<li style="margin-top: 20px;"> | ||
<a href="/classic">classic</a>: the regular site | ||
</li> | ||
<li style="margin-top: 20px;"> | ||
<a href="/bootstrap">bootstrap</a>: the regular site with the | ||
bootstrap theme (WIP) | ||
</li> | ||
<li style="margin-top: 20px;"> | ||
<a href="/blog-only">blog-only</a>: the regular site in blog-only mode | ||
</li> | ||
</ul> | ||
</section> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters