Merge pull request #1290 from gollum/fix_1274

Pagename() function no longer returns file extension. Fixes #1274.
This commit is contained in:
Bart Kamphorst
2018-02-05 13:29:11 +01:00
committed by GitHub
@@ -1,8 +1,14 @@
// Helpers // Helpers
function pageName(){ function pageName(){
// "my/dir/file" => "file" // "my/dir/file.md" => "file"
return typeof(pageFullPath) == 'undefined' ? undefined : pageFullPath.split('/').pop(); if (typeof(pageFullPath) == 'undefined') {
return undefined;
} else {
name = pageFullPath.split('/').pop();
return name.substring(0, name.lastIndexOf('.'));
} }
}
function pagePath(){ function pagePath(){
// "my/dir/file" => "my/dir" // "my/dir/file" => "my/dir"
return typeof(pageFullPath) == 'undefined' ? undefined : pageFullPath.split('/').slice(0,-1).join('/'); return typeof(pageFullPath) == 'undefined' ? undefined : pageFullPath.split('/').slice(0,-1).join('/');