@@ -30,16 +30,16 @@ export default async function genericToc(req, res, next) {
30
30
req . pagePath
31
31
)
32
32
33
- // Do not include hidden child items on a TOC page unless it's an Early Access category page.
34
- // We need to account for the extra 'articles' segment with Early Access as well, we don't
35
- // want to show hidden child items in that case.
36
- req . context . showHiddenTocItems =
37
- ( req . context . page . documentType === 'category' &&
38
- req . context . currentPath . includes ( '/early-access/' ) &&
39
- ! req . context . currentPath . endsWith ( '/articles' ) ) ||
40
- ( req . context . page . documentType === 'product' &&
41
- req . context . currentPath . includes ( '/early-access/' ) &&
42
- req . context . page . shortTitle === 'GitHub Insights' )
33
+ // Only include hidden child items on a TOC page if it's an Early Access category or
34
+ // map topic page, not a product or 'articles' fake cagegory page (e.g., /early-access/github/articles).
35
+ // This is because we don't want entire EA product TOCs to be publicly browseable, but anything at the category
36
+ // or below level is fair game because that content is scoped to specific features.
37
+ const isCategoryOrMapTopic =
38
+ req . context . page . documentType === 'category' || req . context . page . documentType === 'mapTopic'
39
+ const isEarlyAccess = req . context . currentPath . includes ( '/early-access/' )
40
+ const isArticlesCategory = req . context . currentPath . endsWith ( '/articles' )
41
+
42
+ req . context . showHiddenTocItems = isCategoryOrMapTopic && isEarlyAccess && ! isArticlesCategory
43
43
44
44
// Conditionally run getTocItems() recursively.
45
45
let isRecursive
@@ -77,6 +77,7 @@ async function getTocItems(pagesArray, context, isRecursive, renderIntros) {
77
77
return (
78
78
await Promise . all (
79
79
pagesArray . map ( async ( child ) => {
80
+ // only include a hidden page if showHiddenTocItems is true
80
81
if ( child . page . hidden && ! context . showHiddenTocItems ) return
81
82
82
83
return {
0 commit comments