Return default value to toSlug func
This commit is contained in:
parent
0065eed6e9
commit
8e4e9d1b32
@ -75,15 +75,18 @@ export function toFilePath(slug) {
|
|||||||
|
|
||||||
|
|
||||||
export function toSlug(filePath) {
|
export function toSlug(filePath) {
|
||||||
// Convert File Path to unique slug
|
|
||||||
|
|
||||||
// let result = filePath.replace('/','__').replace(' ','-').replace('.md', '')
|
|
||||||
|
|
||||||
|
if (Node.isFile(filePath)) {
|
||||||
return filePath.replace(postsDirectory, '')
|
return filePath.replace(postsDirectory, '')
|
||||||
.replaceAll('/','__')
|
.replaceAll('/','__')
|
||||||
.replaceAll(' ','--')
|
.replaceAll(' ','--')
|
||||||
.replaceAll('&','ambersand')
|
.replaceAll('&','ambersand')
|
||||||
.replace('.md', '')
|
.replace('.md', '')
|
||||||
|
} else {
|
||||||
|
//TODO handle this properly
|
||||||
|
return '/'
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user