docusaurus/docs
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
..
api-commands.md docs: document process.env.BROWSER for start command (#1034) 2018-10-14 12:28:50 -07:00
api-doc-markdown.md feat: use 'sidebar_label' instead of 'title' in prev/next buttons (#1122) 2018-11-22 18:36:05 +08:00
api-pages.md feat: Allow modifying docs url prefix (#914) 2018-11-28 15:34:16 +08:00
api-site-config.md feat: Allow modifying docs url prefix (#914) 2018-11-28 15:34:16 +08:00
getting-started-docker.md Rewrote some of the new Docker copy. 2018-09-06 11:13:13 -07:00
getting-started-installation.md Fix typo in Getting Started docs (#1013) 2018-10-01 22:41:08 -07:00
getting-started-preparation.md docs: mention about website directory naming (#1106) 2018-11-11 15:14:39 -08:00
getting-started-publishing.md docs: reword publish to GitHub Pages documentation (#1049) 2018-10-20 21:15:06 -07:00
getting-started-site-creation.md docs: remove extra comma in site creation steps 2018-10-22 17:45:34 -04:00
guides-blog.md CSS revamp - Improve typography and overall styling (#757) 2018-06-19 21:46:15 -07:00
guides-custom-pages.md Reformat, proofread and tidy up docs (#749) 2018-06-10 08:02:04 -07:00
guides-navigation.md fix: change subcategory format (#1026) 2018-10-10 08:33:20 -07:00
guides-search.md feat: customizable search placeholder (#1126) 2018-11-23 14:27:59 -08:00
guides-translation.md feat: Allow modifying docs url prefix (#914) 2018-11-28 15:34:16 +08:00
guides-versioning.md Reformat, proofread and tidy up docs (#749) 2018-06-10 08:02:04 -07:00