Skip to content

Commit ed64e43

Browse files
committed
updates
- changed __metadata.url to __metadata.urlPath - fixed objects concatenation
1 parent a94b196 commit ed64e43

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,9 @@ module.exports.transform = ({ data, getPluginContext, options }) => {
9393
logMatchedModels: _.get(options, 'logMatchedModels', false)
9494
});
9595
}
96-
return _.assign({}, data, { objects });
96+
return _.assign({}, data, {
97+
objects: data.objects.concat(objects)
98+
});
9799
};
98100

99101
async function loadStackbitYaml(stackbitYamlPath) {

src/models-matcher.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function addMetadata(data, model, { filePath, modelsByName, dataFieldPath = [],
105105
modelType: model.type,
106106
modelName: _.get(model, 'name', null),
107107
modelLabel: _.get(model, 'label', null),
108-
url: model.type === 'page' ? urlFromFilePath(filePath) : null
108+
urlPath: model.type === 'page' ? urlPathFromFilePath(filePath) : null
109109
}, _.isNil)
110110
)
111111
}
@@ -163,14 +163,14 @@ function mapObjectField(fieldValue, fieldModel, { filePath, modelsByName, dataFi
163163
}
164164
}
165165

166-
function urlFromFilePath(filePath) {
166+
function urlPathFromFilePath(filePath) {
167167
const pathObject = path.parse(filePath);
168168
const parts = _.compact(pathObject.dir.split(path.sep));
169169
if (pathObject.name !== 'index') {
170170
parts.push(pathObject.name);
171171
}
172-
const url = parts.join('/').toLowerCase();
173-
return '/' + url + (url ? '/' : '');
172+
const urlPath = parts.join('/').toLowerCase();
173+
return '/' + urlPath + (urlPath ? '/' : '');
174174
}
175175

176176
function mergeDataObjects(objects, objectFileKeyPath, source) {

0 commit comments

Comments
 (0)