@@ -240,7 +240,7 @@ module.exports = class Unibit {
240240 context . getPage = this . getPage . bind ( this , context ) ;
241241 context . getPages = this . getPages . bind ( this , context ) ;
242242 context . getData = this . getData . bind ( this , context ) ;
243- context . getPageByReference = this . getPageByReference . bind ( this , context ) ;
243+ context . getPageByFilePath = this . getPageByFilePath . bind ( this , context ) ;
244244 context . paginate = this . paginate . bind ( this , context ) ;
245245 context . link = this . link . bind ( this , context . site ) ;
246246 context . classNames = this . classNames . bind ( this ) ;
@@ -368,12 +368,12 @@ module.exports = class Unibit {
368368 return _ . get ( context . site . data , path , null ) ;
369369 }
370370
371- getPageByReference ( context , reference ) {
371+ getPageByFilePath ( context , filePath ) {
372372 // remove extension
373- reference = reference . replace ( / \. m d $ / , '' ) ;
373+ const urlPath = _ . trim ( filePath , '.md ' ) ;
374374 return _ . find ( context . site . pages , page => {
375- const pageUrl = _ . trim ( _ . get ( page , 'url ' ) , '/ ' ) ;
376- return reference === pageUrl ;
375+ const pageUrl = _ . trim ( _ . get ( page , 'relPath ' ) , '.md ' ) ;
376+ return urlPath === pageUrl ;
377377 } ) ;
378378 }
379379
0 commit comments