|
|
@ -22,7 +22,7 @@ function removeAllSponsors(baseContentDir) { |
|
|
|
|
|
|
|
|
|
|
|
const contentDir = fs.readdirSync(contentDirPath); |
|
|
|
const contentDir = fs.readdirSync(contentDirPath); |
|
|
|
contentDir.forEach((content) => { |
|
|
|
contentDir.forEach((content) => { |
|
|
|
console.log('Removing sponsor from: ', content); |
|
|
|
console.log('Removing sponsors from: ', content); |
|
|
|
|
|
|
|
|
|
|
|
const pageFilePath = path.join(contentDirPath, content, `${content}.md`); |
|
|
|
const pageFilePath = path.join(contentDirPath, content, `${content}.md`); |
|
|
|
const pageFileContent = fs.readFileSync(pageFilePath, 'utf8'); |
|
|
|
const pageFileContent = fs.readFileSync(pageFilePath, 'utf8'); |
|
|
@ -35,7 +35,7 @@ function removeAllSponsors(baseContentDir) { |
|
|
|
.trim(); |
|
|
|
.trim(); |
|
|
|
|
|
|
|
|
|
|
|
let frontmatterObj = yaml.load(existingFrontmatter); |
|
|
|
let frontmatterObj = yaml.load(existingFrontmatter); |
|
|
|
delete frontmatterObj.sponsor; |
|
|
|
delete frontmatterObj.sponsors; |
|
|
|
|
|
|
|
|
|
|
|
const newFrontmatter = yaml.dump(frontmatterObj, { |
|
|
|
const newFrontmatter = yaml.dump(frontmatterObj, { |
|
|
|
lineWidth: 10000, |
|
|
|
lineWidth: 10000, |
|
|
@ -87,27 +87,23 @@ function addPageSponsor({ |
|
|
|
.trim(); |
|
|
|
.trim(); |
|
|
|
|
|
|
|
|
|
|
|
let frontmatterObj = yaml.load(existingFrontmatter); |
|
|
|
let frontmatterObj = yaml.load(existingFrontmatter); |
|
|
|
delete frontmatterObj.sponsor; |
|
|
|
const sponsors = frontmatterObj.sponsors || []; |
|
|
|
|
|
|
|
|
|
|
|
const frontmatterValues = Object.entries(frontmatterObj); |
|
|
|
const frontmatterValues = Object.entries(frontmatterObj); |
|
|
|
const roadmapLabel = frontmatterObj.briefTitle; |
|
|
|
const roadmapLabel = frontmatterObj.briefTitle; |
|
|
|
|
|
|
|
|
|
|
|
// Insert sponsor data at 10 index i.e. after |
|
|
|
sponsors.push({ |
|
|
|
// roadmap dimensions in the frontmatter |
|
|
|
|
|
|
|
frontmatterValues.splice(10, 0, [ |
|
|
|
|
|
|
|
'sponsor', |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
url: redirectUrl, |
|
|
|
url: redirectUrl, |
|
|
|
title: adTitle, |
|
|
|
title: adTitle, |
|
|
|
imageUrl, |
|
|
|
imageUrl, |
|
|
|
description: adDescription, |
|
|
|
description: adDescription, |
|
|
|
event: { |
|
|
|
page: roadmapLabel, |
|
|
|
category: 'SponsorClick', |
|
|
|
company, |
|
|
|
action: `${company} Redirect`, |
|
|
|
}); |
|
|
|
label: `${roadmapLabel} / ${company} Link`, |
|
|
|
|
|
|
|
}, |
|
|
|
// Insert sponsor data at 10 index i.e. after |
|
|
|
}, |
|
|
|
// roadmap dimensions in the frontmatter |
|
|
|
]); |
|
|
|
frontmatterValues.splice(10, 0, ['sponsors', sponsors]); |
|
|
|
|
|
|
|
|
|
|
|
frontmatterObj = Object.fromEntries(frontmatterValues); |
|
|
|
frontmatterObj = Object.fromEntries(frontmatterValues); |
|
|
|
|
|
|
|
|
|
|
|