From 494e79c86ef754f3de88bcb47935728f5a5d7ef5 Mon Sep 17 00:00:00 2001 From: HerrHase Date: Sun, 19 Feb 2023 21:25:43 +0100 Subject: [PATCH] bugfix for dirPath --- src/factories/page.js | 10 +++++----- src/siteomat.js | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/factories/page.js b/src/factories/page.js index e0f3eac..fc859f3 100644 --- a/src/factories/page.js +++ b/src/factories/page.js @@ -45,12 +45,11 @@ class Page { // adding filename for html as pathname and relative path in structure this._filename = this._resolveFilename(file) this._slug = this._resolveSlug(this._filename) - this._path = this._resolvePath(parent) - - this._permalink = this._path + this._dirPath = this._resolvePath(parent) + this._permalink = this._dirPath if (this._slug) { - this._permalink = this._path + '/' + this._slug + this._permalink = this._dirPath + '/' + this._slug } this._filename += '.' + this._fields.extensions @@ -70,7 +69,8 @@ class Page { return assign({ 'content' : this._content, 'blocks' : this._blocks, - 'path' : this._path + '/' + this._filename, + 'dirPath' : this._dirPath, + 'path' : this._dirPath + '/' + this._filename, 'permalink' : this._permalink, 'filename' : this._filename }, this._fields) diff --git a/src/siteomat.js b/src/siteomat.js index b4e6bfa..4c93a01 100644 --- a/src/siteomat.js +++ b/src/siteomat.js @@ -104,8 +104,8 @@ class Siteomat { } // create directories and write file = page - mkdirp(this._destination + page.pathname).then(() => { - fs.writeFileSync(this._destination + page.pathname + '/' + page.filename, content) + mkdirp(this._destination + page.dirPath).then(() => { + fs.writeFileSync(this._destination + page.path, content) }) sitemap.addPage(page)