mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-05 13:17:23 +02:00
* Allow other routes than /docs in the URL siteConfig.js has a new mandatory field named *docsRoute* which default value is 'docs' and that can be customized by the user. This change will allow users who uses the library to host guides and tutorials to customize their websites by assign 'docsRoute' values like 'tutorials' or 'guides'. Fixes #879 * Make "docsRoute" field optional * Isolate docsRoute login in getDocsRoute function * Rename docsRoute to docsUrl * Run prettier * Remove old folders * fix: Restore docusaurus reference link * fix: Add `docsUrl` param fallback. Refactor multiple function calls * Fix linting errors * Update description for docsUrl field * Reduce redundant calls to getDocsUrl * Replace a missed use case for `docsUrl` instead of the function call * Move `getDocsUrl` out from `server/routing.js` to `server/utils.js` **Why?** Because `routing.js` is exporting all router RegEx's, and the `getDocsUrl` suffices more as a util * WiP: Align leading slashes and fix routing around `docsUrl` Checklist: - [x] Added `removeDuplicateLeadingSlashes` util to make sure there is only one leading slash - [-] Fix edge cases for routing: - [x] `docsUrl: ''` - [ ] `docsUrl: '/'` - [ ] make it work with languages - [ ] make it work with versioning * Make leading slashes canonical cross routing and generated links This ensures correct routing for customized `baseUrl` and `docsUrl`. - Changed all routing functions to take `siteConfig` instead of `siteConfig.baseUrl` - Updated tests accordingly * Alternative fallback for `docsUrl` * rework/ fix implementation * cleanup * refactor and add docs for config props * fix typo * fix broken url
69 lines
2.5 KiB
JavaScript
Executable file
69 lines
2.5 KiB
JavaScript
Executable file
/**
|
|
* Copyright (c) 2017-present, Facebook, Inc.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
const React = require('react');
|
|
const CompLibrary = require('../../core/CompLibrary.js');
|
|
|
|
const Container = CompLibrary.Container;
|
|
const GridBlock = CompLibrary.GridBlock;
|
|
const translate = require('../../server/translate.js').translate;
|
|
|
|
class Help extends React.Component {
|
|
render() {
|
|
const {config: siteConfig} = this.props;
|
|
const supportLinks = [
|
|
{
|
|
title: <translate>Browse the docs</translate>,
|
|
content: `Learn more about Docusaurus using the [official documentation](${
|
|
siteConfig.baseUrl
|
|
}${siteConfig.docsUrl ? `${siteConfig.docsUrl}/` : ''}${
|
|
this.props.language
|
|
}/installation).`,
|
|
},
|
|
{
|
|
title: <translate>Discord</translate>,
|
|
content:
|
|
'You can join the conversation on [Discord](https://discord.gg/docusaurus) on one of our two text channels: #docusaurus-users for user help and #docusaurus-dev for contributing help.',
|
|
},
|
|
{
|
|
title: <translate>Twitter</translate>,
|
|
content:
|
|
'You can follow and contact us on [Twitter](https://twitter.com/docusaurus).',
|
|
},
|
|
{
|
|
title: <translate>GitHub</translate>,
|
|
content:
|
|
'At our [GitHub repo](https://github.com/facebook/docusaurus) Browse and submit [issues](https://github.com/facebook/Docusaurus/issues) or [pull requests](https://github.com/facebook/Docusaurus/pulls) for bugs you find or any new features you may want implemented. Be sure to also check out our [contributing information](https://github.com/facebook/Docusaurus/blob/master/CONTRIBUTING.md).',
|
|
},
|
|
];
|
|
|
|
return (
|
|
<div className="docMainWrapper wrapper">
|
|
<Container className="mainContainer documentContainer postContainer">
|
|
<div className="post">
|
|
<header className="postHeader">
|
|
<h1>
|
|
<translate>Need help?</translate>
|
|
</h1>
|
|
</header>
|
|
<p>
|
|
<translate desc="statement made to reader">
|
|
If you need help with Docusaurus, you can try one of the
|
|
mechanisms below.
|
|
</translate>
|
|
</p>
|
|
<GridBlock contents={supportLinks} layout="fourColumn" />
|
|
</div>
|
|
</Container>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
Help.title = 'Help';
|
|
|
|
module.exports = Help;
|