mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
Fix bad routing regex for docs & blogs (#795)
* fix bad routing regex for docs & blogs * extract to routing.js & add test * add more test case * address code review * prettier
This commit is contained in:
parent
5a8e9a9ff1
commit
66b2033546
3 changed files with 86 additions and 3 deletions
20
lib/core/routing.js
Normal file
20
lib/core/routing.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
* 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 escapeStringRegexp = require('escape-string-regexp');
|
||||
|
||||
function docsRouting(baseUrl) {
|
||||
return new RegExp(`^${escapeStringRegexp(baseUrl)}docs\/.*html$`);
|
||||
}
|
||||
|
||||
function blogRouting(baseUrl) {
|
||||
return new RegExp(`^${escapeStringRegexp(baseUrl)}blog\/.*html$`);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
docsRouting,
|
||||
blogRouting,
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue