1
0
mirror of synced 2025-12-19 18:10:59 -05:00
Files
docs/script/search/find-indexable-pages.js
2022-10-10 23:25:51 +00:00

19 lines
734 B
JavaScript

#!/usr/bin/env node
import { loadPages } from '../../lib/page-data.js'
export default async function findIndexablePages(match = '') {
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 absolute home page (e.g. /en or /ja)
.filter((page) => page.relativePath !== 'index.md')
.filter((page) => !match || page.relativePath.includes(match))
console.log('total pages', allPages.length)
console.log('indexable pages', indexablePages.length)
return indexablePages
}