mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-09 23:27:28 +02:00
Enable clean / extension-less url (#677)
This commit is contained in:
parent
aee255219b
commit
31f0c27f81
14 changed files with 124 additions and 50 deletions
|
@ -20,8 +20,20 @@ function extractBlogPostSummary(content) {
|
|||
return content.substring(0, BLOG_POST_SUMMARY_LENGTH);
|
||||
}
|
||||
|
||||
function getPath(path, cleanUrl = false) {
|
||||
if (cleanUrl) {
|
||||
if (path.endsWith('/index.html')) {
|
||||
return path.replace(/\/index.html$/, '');
|
||||
} else {
|
||||
return path.replace(/\.html$/, '');
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
blogPostHasTruncateMarker,
|
||||
extractBlogPostBeforeTruncate,
|
||||
extractBlogPostSummary,
|
||||
getPath,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue