Skip to content

Commit 61e2ae9

Browse files
committed
we do not actually need any body content in index.md files anymore
1 parent f14cfb9 commit 61e2ae9

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

script/content-migrations/update-tocs.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,12 @@ indexFiles
3838
const documentType = getDocumentType(relativePath)
3939

4040
const { data, content } = frontmatter(fs.readFileSync(indexFile, 'utf8'))
41-
let newContent = content
4241

4342
if (documentType === 'homepage') {
4443
data.children = sortedProductIds
4544
}
4645

47-
const linkItems = newContent.match(linksArray) || []
46+
const linkItems = content.match(linksArray) || []
4847

4948
// Turn the `{% link /<link> %}` list into an array of /<link> items
5049
if (documentType === 'product' || documentType === 'mapTopic') {
@@ -57,14 +56,6 @@ indexFiles
5756
data.children = childMapTopics.length ? getLinks(childMapTopics) : getLinks(linkItems)
5857
}
5958

60-
linkItems.forEach(linkItem => {
61-
newContent = newContent.replace(linkItem, '').trim()
62-
})
63-
64-
newContent = newContent
65-
.replace(/###? Table of Contents\n/i, '')
66-
.replace(/<!-- {2}-->\n/g, '')
67-
6859
// Fix this one weird file
6960
if (relativePath === 'discussions/guides/index.md') {
7061
data.children = [
@@ -74,7 +65,8 @@ indexFiles
7465
]
7566
}
7667

77-
fs.writeFileSync(indexFile, frontmatter.stringify(newContent.trim(), data, { lineWidth: 10000 }))
68+
// Index files should no longer have body content, so we write an empty string
69+
fs.writeFileSync(indexFile, frontmatter.stringify('', data, { lineWidth: 10000 }))
7870
})
7971

8072
function getLinks (linkItemArray) {

0 commit comments

Comments
 (0)