eleventy-plugin-cloudcannon
Advanced tools
Comparing version 0.0.6 to 0.0.7
const { dirname, basename } = require('path'); | ||
const isEqual = require('lodash.isequal'); | ||
@@ -25,2 +26,13 @@ function isTopPath(basePath, index, basePaths) { | ||
const IGNORED_ITEM_KEYS = { | ||
pagination: true, | ||
collections: true, | ||
page: true | ||
}; | ||
function isIgnoredItemKey(item, key) { | ||
return IGNORED_ITEM_KEYS[key] | ||
|| isEqual(item.template?.templateData?.globalData?.[key], item.data[key]); | ||
} | ||
module.exports = { | ||
@@ -58,4 +70,12 @@ environment: process.env.ELEVENTY_ENV, | ||
processItem: function (item, tag) { | ||
const combinedData = Object.keys(item.data).reduce((memo, key) => { | ||
if (!isIgnoredItemKey(item, key)) { | ||
memo[key] = item.data[key]; | ||
} | ||
return memo; | ||
}, {}); | ||
return { | ||
...item.template.frontMatter.data, | ||
...combinedData, | ||
path: item.inputPath.replace('./', ''), | ||
@@ -62,0 +82,0 @@ url: item.url || '', |
{ | ||
"name": "eleventy-plugin-cloudcannon", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "Eleventy plugin to create CloudCannon editor details", | ||
@@ -28,2 +28,3 @@ "main": ".eleventy.js", | ||
"dependencies": { | ||
"lodash.isequal": "^4.5.0", | ||
"pkginfo": "^0.4.1" | ||
@@ -30,0 +31,0 @@ }, |
11898
121
2
+ Addedlodash.isequal@^4.5.0
+ Addedlodash.isequal@4.5.0(transitive)