fix(core): Use correct base for calculating the relative path

Fixes #109
pull/108/head
Felix Eckhofer 6 years ago committed by Romain
parent 124d1857b1
commit 383f77e0d4

@ -11,8 +11,6 @@ class Theme {
this.dir = path.resolve(themeDir)
// target directory
this.dest = path.resolve(destDir)
// used to keep track of relative paths while rendering
this.currentFolder = '.'
// custom options
this.opts = opts
}
@ -43,7 +41,6 @@ class Theme {
// return a function that renders the given album HTML page
// this is used so that all pages can be created in parallel
render (album, data) {
this.currentFolder = path.dirname(album.path)
const fullPath = path.join(this.dest, album.path)
return (next) => {
debug(`Theme rendering ${album.path}`)
@ -87,7 +84,7 @@ class Theme {
// render a relative path
handlebars.registerHelper('relative', (target, options) => {
return path.relative(this.currentFolder, target)
return path.relative(path.dirname(options.data.root.album.path), target)
})
}

Loading…
Cancel
Save