1
0
mirror of synced 2025-12-23 11:54:18 -05:00
Files
docs/lib/algolia/find-indexable-pages.js
James M. Greene fb30a0766f Unravel pages (the array + map object) (#16708)
* Revise the 'pages' module to export two methods: 'loadPages' and 'loadPageMap'

Update all existing references to use 'loadPages' for now

* Remove explicit Promise resolutions on loadPage* methods

* Condense reduction method into its now-singular usage spot

* Opt for for-of instead of forEach

* Make require of pages in warm-server more explicit

* Be more explicit about find-page using a pageMap

* Be more explicit about find-page-in-version using a pageMap

* Be more explicit about site-tree using a pageMap

* Extract the map creation from loadPageMap

* Be more explicit about using a pageMap

* Update redirects precompile to take two arguments: pageList, pageMap

* Rename internal loadPages method to loadPageList

* Clarify pageMap is what is stored in context.pages

* Use loadPageMap in tests and stuff
2020-12-03 22:31:10 +00:00

17 lines
611 B
JavaScript

const { loadPages } = require('../pages')
module.exports = async function findIndexablePages () {
const allPages = await loadPages()
const indexablePages = allPages
// exclude hidden pages
.filter(page => !page.hidden)
// exclude pages that are part of WIP or hidden products
.filter(page => !page.parentProduct || !page.parentProduct.wip || page.parentProduct.hidden)
// exclude index homepages
.filter(page => !page.relativePath.endsWith('index.md'))
console.log('total pages', allPages.length)
console.log('indexable pages', indexablePages.length)
return indexablePages
}