@contentrain/wp-import 0.15.1 → 0.16.0
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.mjs +11 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2319,7 +2319,7 @@ function rawToContentrain(input, opts) {
|
|
|
2319
2319
|
report.slug_rewritten++;
|
|
2320
2320
|
rewritten = s !== decodeSlug(p.slug).toLowerCase();
|
|
2321
2321
|
}
|
|
2322
|
-
const key =
|
|
2322
|
+
const key = `${p.type}:${multilingual ? `${postLocale(p)}:` : ""}${p.parent ?? 0}:${s}`;
|
|
2323
2323
|
const n = usedSlugs.get(key) ?? 0;
|
|
2324
2324
|
usedSlugs.set(key, n + 1);
|
|
2325
2325
|
if (n) {
|
|
@@ -2758,6 +2758,8 @@ function rawToContentrain(input, opts) {
|
|
|
2758
2758
|
taxes,
|
|
2759
2759
|
cover: typeItems.some((p) => p.meta._thumbnail_id)
|
|
2760
2760
|
});
|
|
2761
|
+
const typeSlugs = typeItems.filter((p) => slugOf.has(p.id)).map((p) => `${multilingual ? `${postLocale(p)}:` : ""}${slugOf.get(p.id)}`);
|
|
2762
|
+
if (new Set(typeSlugs).size < typeSlugs.length) delete fields.slug.unique;
|
|
2761
2763
|
let o = order;
|
|
2762
2764
|
fields.wp_id = {
|
|
2763
2765
|
type: "integer",
|
|
@@ -2924,6 +2926,7 @@ function rawToContentrain(input, opts) {
|
|
|
2924
2926
|
}
|
|
2925
2927
|
}
|
|
2926
2928
|
const menus = raw.menus ?? [];
|
|
2929
|
+
const headingLink = (m) => Boolean(m.title && strip(m.title) && m.titleHref?.trim());
|
|
2927
2930
|
if (menus.length) {
|
|
2928
2931
|
addModel({
|
|
2929
2932
|
id: "menus",
|
|
@@ -2967,6 +2970,11 @@ function rawToContentrain(input, opts) {
|
|
|
2967
2970
|
type: "string",
|
|
2968
2971
|
label: "Heading",
|
|
2969
2972
|
order: 15
|
|
2973
|
+
} } : {},
|
|
2974
|
+
...menus.some(headingLink) ? { title_href: {
|
|
2975
|
+
type: "url",
|
|
2976
|
+
label: "Heading link",
|
|
2977
|
+
order: 16
|
|
2970
2978
|
} } : {}
|
|
2971
2979
|
}
|
|
2972
2980
|
});
|
|
@@ -3057,7 +3065,8 @@ function rawToContentrain(input, opts) {
|
|
|
3057
3065
|
items: m.items.map((i) => itemRef(i.id)),
|
|
3058
3066
|
...m.id !== null && m.id > 0 ? { wp_id: m.id } : {},
|
|
3059
3067
|
...m.locations?.length ? { locations: m.locations } : {},
|
|
3060
|
-
...m.title && strip(m.title) ? { title: strip(m.title) } : {}
|
|
3068
|
+
...m.title && strip(m.title) ? { title: strip(m.title) } : {},
|
|
3069
|
+
...headingLink(m) ? { title_href: m.titleHref.trim() } : {}
|
|
3061
3070
|
};
|
|
3062
3071
|
metas.menus[mid] = importMeta("published");
|
|
3063
3072
|
for (const i of m.items) {
|