diff options
author | Sarah German <sgerman@gitlab.com> | 2022-11-23 12:47:04 +0300 |
---|---|---|
committer | Kati Paizee <kpaizee@gitlab.com> | 2022-11-23 12:47:04 +0300 |
commit | a7b878a3fe879de16cb39f225694cd0ff346e5d0 (patch) | |
tree | 8ff574c617c65c855bd3e9f0185b49cd5a1b0532 /scripts | |
parent | bb9a1f49c41e1e53f7e77e86b48693c3ef9b7f8e (diff) |
Ignore pages with deprecated features in the navigation report
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/pages_not_in_nav.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/pages_not_in_nav.js b/scripts/pages_not_in_nav.js index 87e15fe0..28811fb4 100755 --- a/scripts/pages_not_in_nav.js +++ b/scripts/pages_not_in_nav.js @@ -23,9 +23,16 @@ const nav = JSON.stringify(navYaml); // Read the markdown file and extract the fields we need. const getPageData = (filename) => { const contents = fs.readFileSync(filename, 'utf-8'); + const title = contents + .split('\n') + .filter((line) => line.startsWith('# ')) + .toString() + .toLowerCase(); + return { filename, isRedirect: contents.includes('redirect_to'), + isDeprecated: title.includes('(deprecated)') || title.includes('(removed)'), stage: fm(contents).attributes.stage, group: fm(contents).attributes.group, }; @@ -36,7 +43,7 @@ const lostPages = []; dataSources.forEach((source) => { glob.sync(`${source.content_dir}/**/*.md`).forEach((filename) => { const pageData = getPageData(filename); - if (pageData.isRedirect) { + if (pageData.isRedirect || pageData.isDeprecated) { return; } |