mirror of
https://github.com/facebook/docusaurus.git
synced 2025-12-26 01:33:02 +00:00
refactor: simplify blog url replacement regex (#1491)
This commit is contained in:
parent
cbd2a589e3
commit
9a18b7430a
|
|
@ -19,10 +19,7 @@ function urlToSource(url) {
|
|||
if (!url || typeof url !== 'string') {
|
||||
return null;
|
||||
}
|
||||
return url
|
||||
.replace(/\/index.html$/, '.md')
|
||||
.replace(/\.html$/, '.md')
|
||||
.replace(new RegExp('/', 'g'), '-');
|
||||
return url.replace(/(\/index)?\.html$/, '.md').replace(/\//g, '-');
|
||||
}
|
||||
|
||||
function fileToUrl(file) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue