diff --git a/src/shared/js/helpers/ContentfulContext.js b/src/shared/js/helpers/ContentfulContext.js index f5f05d9..feab275 100644 --- a/src/shared/js/helpers/ContentfulContext.js +++ b/src/shared/js/helpers/ContentfulContext.js @@ -99,11 +99,16 @@ function ContentfulProvider({ children }) { const origId = entry.sys.id; const newId = idsMap[origId]; // Map fields, look for links and replace with new ids + let internalTitle = entry.fields.internalTitle['en-US']; + internalTitle = + internalTitle.indexOf('TEMPLATE - ') === 0 + ? internalTitle.replace('TEMPLATE - ', `${uniqueId} - `) + : `${uniqueId} - ${internalTitle}`; const newitem = await environment.createEntryWithId(entry.sys.contentType.sys.id, newId, { fields: { ...entry.fields, internalTitle: { - 'en-US': entry.fields.internalTitle['en-US'].replace('TEMPLATE - ', `${uniqueId} - `) + 'en-US': internalTitle } }, metadata: {