MCPcopy Create free account
hub / github.com/github/docs / parentProductId

Method parentProductId

lib/page.js:143–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

141
142 // Infer the parent product ID from the page's relative file path
143 get parentProductId() {
144 // Each page's top-level content directory matches its product ID
145 const id = this.relativePath.split('/')[0]
146
147 // ignore top-level content/index.md
148 if (id === 'index.md') return null
149
150 // make sure the ID is valid
151 if (process.env.NODE_ENV !== 'test') {
152 assert(productMapKeysAsSet.has(id), `page ${this.fullPath} has an invalid product ID: ${id}`)
153 }
154
155 return id
156 }
157
158 get parentProduct() {
159 return productMap[this.parentProductId]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected