MCPcopy
hub / github.com/github/docs / getPage

Function getPage

lib/all-products.js:48–66  ·  view source on GitHub ↗
(id, lang, pageMap)

Source from the content-addressed store, hash-verified

46export const productMap = Object.assign({}, internalProducts, externalProducts)
47
48function getPage(id, lang, pageMap) {
49 const productId = id.split('/')[0]
50 const product = productMap[productId]
51 const href = removeFPTFromPath(path.posix.join('/', lang, product.versions[0], id))
52 const page = pageMap[href]
53 if (!page) {
54 throw new Error(
55 `Unable to find a page by the href '${href}'. Review your 'childGroups' frontmatter maybe.`
56 )
57 }
58 // Return only the props needed for the ProductSelectionCard, since
59 // that's the only place this is ever used.
60 return {
61 id,
62 name: page.shortTitle || page.title,
63 href: href.replace(`/${lang}/`, '/'),
64 versions: page.applicableVersions,
65 }
66}
67
68export function getProductGroups(pageMap, lang) {
69 return data.childGroups.map((group) => {

Callers 1

getProductGroupsFunction · 0.70

Calls 1

removeFPTFromPathFunction · 0.85

Tested by

no test coverage detected