1
0
mirror of synced 2025-12-22 03:16:52 -05:00
Files
docs/lib/get-map-topic-content.js
Vanessa Yuen 3df90fc9b8 Hello git history spelunker!
Are you looking for something? Here is all of the GitHub Docs history in one single commit. Enjoy! 🎉
2020-09-27 14:10:11 +02:00

23 lines
686 B
JavaScript

const findPage = require('./find-page')
// get the page.childArticles set on english map topics in lib/site-tree.js
module.exports = function getMapTopicContent (page, pages, redirects) {
const englishPage = page.languageCode !== 'en'
? findPage(`/${page.relativePath.replace(/.md$/, '')}`, pages, redirects, 'en')
: page
if (!englishPage) {
console.error(`cannot find english page: ${page.fullPath}`)
return
}
if (!englishPage.childArticles) {
console.error(`error getting child articles on map topic: ${page.fullPath}`)
return
}
return englishPage.childArticles
.map(article => `{% link_with_intro /${article.href} %}`)
.join('\n\n')
}