From 80b6b6993211ce41da052d198666775c28533f82 Mon Sep 17 00:00:00 2001 From: David Longworth Date: Mon, 3 Apr 2017 16:28:01 +0100 Subject: [PATCH] fix: #139 remove DS path from attributes --- dadi/lib/providers/markdown.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dadi/lib/providers/markdown.js b/dadi/lib/providers/markdown.js index d979e804..87ceb353 100644 --- a/dadi/lib/providers/markdown.js +++ b/dadi/lib/providers/markdown.js @@ -147,13 +147,20 @@ MarkdownProvider.prototype.parseRawDataAsync = function parseRawDataAsync (data, const parsedPath = path.parse(data[i]._name) // Some info about the file - attributes._loc = data[i]._name - attributes._ext = parsedPath.ext attributes._id = parsedPath.name - attributes._path = path.normalize(parsedPath.dir).split('/') + attributes._ext = parsedPath.ext + attributes._loc = data[i]._name + + attributes._path = + parsedPath.dir. + replace(path.normalize(this.schema.datasource.source.path), ''). + replace(/^\/|\/$/g, ''). + split('/') + + if (attributes._path == '') attributes._path = null + posts.push({ - meta, attributes, original: data[i]._contents, contentText,