27 lines
1.2 KiB
JavaScript
27 lines
1.2 KiB
JavaScript
import { readFileSync, writeFileSync } from 'fs'
|
||
|
||
const path = '/Users/nate.emmert/Documents/github/Siteforge/data/chatbot-content.json'
|
||
const data = JSON.parse(readFileSync(path, 'utf8'))
|
||
|
||
const fixes = {
|
||
2: { title: 'Episode 2 — Introduction to Titus (Background & Overview)', extra: ['introduction', 'background', 'overview', 'crete', 'letter'] },
|
||
5: { title: 'Episode 5 — The Danger of Empty Words (Titus 1:10–13a)', extra: ['danger', 'empty', 'words', 'false', 'teacher', 'titus 1:10', 'titus 1:13'] },
|
||
6: { title: 'Episode 6 — Words That Deny What We Claim to Believe (Titus 1:13b–16)', extra: ['deny', 'claim', 'believe', 'titus 1:13', 'titus 1:16'] },
|
||
14: { title: 'Episode 14 — Grace: Where It Starts and Where It Ends (Titus 3:12–15)', extra: ['grace', 'starts', 'ends', 'review', 'titus 3:12', 'titus 3:15'] },
|
||
}
|
||
|
||
let count = 0
|
||
for (const entry of data) {
|
||
const m = entry.title.match(/^Episode (\d+)/)
|
||
if (!m) continue
|
||
const ep = Number(m[1])
|
||
if (fixes[ep]) {
|
||
entry.title = fixes[ep].title
|
||
entry.keywords = [...new Set([...entry.keywords, ...fixes[ep].extra])].slice(0, 20)
|
||
count++
|
||
}
|
||
}
|
||
|
||
writeFileSync(path, JSON.stringify(data, null, 2), 'utf8')
|
||
console.log(`Fixed ${count} entries. Total: ${data.length}`)
|