diff --git a/src/services/fileServices/MdPageServices/CollectionPageService.js b/src/services/fileServices/MdPageServices/CollectionPageService.js index 23d994864..b98e9b2c1 100644 --- a/src/services/fileServices/MdPageServices/CollectionPageService.js +++ b/src/services/fileServices/MdPageServices/CollectionPageService.js @@ -70,6 +70,10 @@ class CollectionPageService { ) { const parsedCollectionName = `_${collectionName}` const newContent = convertDataToMarkdown(frontMatter, content) + const { + frontMatter: newFrontMatter, + pageContent: newPageContent, + } = retrieveDataFromMarkdown(newContent) const { newSha } = await this.gitHubService.update(sessionData, { fileContent: newContent, sha, @@ -78,7 +82,7 @@ class CollectionPageService { }) return { fileName, - content: { frontMatter, pageBody: content }, + content: { frontMatter: newFrontMatter, pageBody: newPageContent }, oldSha: sha, newSha, } diff --git a/src/services/fileServices/MdPageServices/ResourcePageService.js b/src/services/fileServices/MdPageServices/ResourcePageService.js index c42af2ffb..99bd64566 100644 --- a/src/services/fileServices/MdPageServices/ResourcePageService.js +++ b/src/services/fileServices/MdPageServices/ResourcePageService.js @@ -93,6 +93,10 @@ class ResourcePageService { resourceCategoryName, }) const newContent = convertDataToMarkdown(frontMatter, content) + const { + frontMatter: newFrontMatter, + pageContent: newPageContent, + } = retrieveDataFromMarkdown(newContent) const { newSha } = await this.gitHubService.update(sessionData, { fileContent: newContent, sha, @@ -101,7 +105,7 @@ class ResourcePageService { }) return { fileName, - content: { frontMatter, pageBody: content }, + content: { frontMatter: newFrontMatter, pageBody: newPageContent }, oldSha: sha, newSha, } diff --git a/src/services/fileServices/MdPageServices/SubcollectionPageService.js b/src/services/fileServices/MdPageServices/SubcollectionPageService.js index a3fca0b63..06372d38f 100644 --- a/src/services/fileServices/MdPageServices/SubcollectionPageService.js +++ b/src/services/fileServices/MdPageServices/SubcollectionPageService.js @@ -69,6 +69,10 @@ class SubcollectionPageService { ) { const parsedDirectoryName = `_${collectionName}/${subcollectionName}` const newContent = convertDataToMarkdown(frontMatter, content) + const { + frontMatter: newFrontMatter, + pageContent: newPageContent, + } = retrieveDataFromMarkdown(newContent) const { newSha } = await this.gitHubService.update(sessionData, { fileContent: newContent, sha, @@ -77,7 +81,7 @@ class SubcollectionPageService { }) return { fileName, - content: { frontMatter, pageBody: content }, + content: { frontMatter: newFrontMatter, pageBody: newPageContent }, oldSha: sha, newSha, } diff --git a/src/services/fileServices/MdPageServices/UnlinkedPageService.js b/src/services/fileServices/MdPageServices/UnlinkedPageService.js index efa44ff49..735cf0b51 100644 --- a/src/services/fileServices/MdPageServices/UnlinkedPageService.js +++ b/src/services/fileServices/MdPageServices/UnlinkedPageService.js @@ -51,6 +51,10 @@ class UnlinkedPageService { async update(sessionData, { fileName, content, frontMatter, sha }) { const newContent = convertDataToMarkdown(frontMatter, content) + const { + frontMatter: newFrontMatter, + pageContent: newPageContent, + } = retrieveDataFromMarkdown(newContent) const { newSha } = await this.gitHubService.update(sessionData, { fileContent: newContent, sha, @@ -59,7 +63,7 @@ class UnlinkedPageService { }) return { fileName, - content: { frontMatter, pageBody: content }, + content: { frontMatter: newFrontMatter, pageBody: newPageContent }, oldSha: sha, newSha, }