@yourbright/emdash-analytics-plugin 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -12
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1215,24 +1215,18 @@ async function loadPage(ctx, urlPath) {
|
|
|
1215
1215
|
async function findContentPage(ctx, collection, id, slug) {
|
|
1216
1216
|
if (id) {
|
|
1217
1217
|
const byId = await ctx.storage.pages.query({
|
|
1218
|
-
where: {
|
|
1219
|
-
|
|
1220
|
-
contentId: id
|
|
1221
|
-
},
|
|
1222
|
-
limit: 1
|
|
1218
|
+
where: { contentId: id },
|
|
1219
|
+
limit: 20
|
|
1223
1220
|
});
|
|
1224
|
-
const match = byId.items
|
|
1221
|
+
const match = byId.items.map((item) => item.data).find((page) => page.contentCollection === collection);
|
|
1225
1222
|
if (match) return match;
|
|
1226
1223
|
}
|
|
1227
1224
|
if (slug) {
|
|
1228
1225
|
const bySlug = await ctx.storage.pages.query({
|
|
1229
|
-
where: {
|
|
1230
|
-
|
|
1231
|
-
contentSlug: slug
|
|
1232
|
-
},
|
|
1233
|
-
limit: 1
|
|
1226
|
+
where: { contentSlug: slug },
|
|
1227
|
+
limit: 20
|
|
1234
1228
|
});
|
|
1235
|
-
const match = bySlug.items
|
|
1229
|
+
const match = bySlug.items.map((item) => item.data).find((page) => page.contentCollection === collection);
|
|
1236
1230
|
if (match) return match;
|
|
1237
1231
|
}
|
|
1238
1232
|
return null;
|