docusaurus/v1/lib/core
Dom Corvasce 61078e38a9 feat: Allow modifying docs url prefix (#914)
* 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
2018-11-28 15:34:16 +08:00
..
__tests__ feat: add last contributor to each document (#980) 2018-10-18 00:59:16 -07:00
nav feat: Allow modifying docs url prefix (#914) 2018-11-28 15:34:16 +08:00
anchors.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
BlogPageLayout.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
BlogPost.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
BlogPostLayout.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
BlogSidebar.js fix: change subcategory format (#1026) 2018-10-10 08:33:20 -07:00
CompLibrary.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
Container.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
Doc.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
DocsLayout.js feat: use 'sidebar_label' instead of 'title' in prev/next buttons (#1122) 2018-11-22 18:36:05 +08:00
DocsSidebar.js fix: translated pages missing left TOC (#1119) 2018-11-20 16:36:56 +08:00
GridBlock.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
Head.js Update support for Web App Manifest (#1046) 2018-10-17 10:21:10 -07:00
MarkdownBlock.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
Redirect.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
Remarkable.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
renderMarkdown.js fix: warn unsupported languages by prismjs (#1107) 2018-11-12 18:39:33 +08:00
Site.js feat: add keyboard shortcut to focus search (#1028) 2018-10-11 22:50:12 -07:00
toc.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
toSlug.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
unindent.js Move Docusaurus 1 files into directory (#966) 2018-09-18 00:58:07 +08:00
utils.js feat: add last contributor to each document (#980) 2018-10-18 00:59:16 -07:00