Skip to content

Commit

Permalink
refactor: simplify blog url replacement regex (#1491)
Browse files Browse the repository at this point in the history
  • Loading branch information
hong4rc authored and endiliey committed May 19, 2019
1 parent cbd2a58 commit 9a18b74
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions packages/docusaurus-1.x/lib/server/blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 9a18b74

Please sign in to comment.