diff --git a/src/site/constants/brokenLinkIgnorePatterns.js b/src/site/constants/brokenLinkIgnorePatterns.js deleted file mode 100644 index 756386cf65..0000000000 --- a/src/site/constants/brokenLinkIgnorePatterns.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - This is a set of patterns which the broken link checker should ignore when making a check. - - Given a page dog.html that contains the following three links: - - /animals/cat.html - - /animals/horse.html - - /animals/capybara.html - - If an item in IGNORE_PATTERNS contains 'capybara', it will ignore the third link. - If an item in IGNORE_PATTERNS contains 'animals', it will ignore ALL the links. - - Note that it's the target URL that checks the ignore pattern. If you included - 'dog' in the IGNORE_PATTERNS in the example above, it would still test dog.html - for broken links it contains, but block testing dog.html as a destination. - - Be very careful of unintended consequences when adding these patterns. Be - sure you are targeting what you want to ignore precisely. - - */ -const IGNORE_PATTERNS = [ - /\/events($|\/)?/, // This ignores all links to Event and Event Listing pages. -]; - -module.exports = { - IGNORE_PATTERNS, -}; diff --git a/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js b/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js index 2848cc0a1f..d3807596ba 100644 --- a/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js +++ b/src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js @@ -91,6 +91,26 @@ const CountEntityTypes = ` count } + eventListing: nodeQuery( + filter: { + conditions: [ + {field: "status", value: ["1"]}, + {field: "type", value: ["event_listing"]} + ]} + ) { + count + } + + event: nodeQuery( + filter: { + conditions: [ + {field: "status", value: ["1"]}, + {field: "type", value: ["event"]} + ]} + ) { + count + } + healthCareRegionDetailPage: nodeQuery( filter: { conditions: [ diff --git a/src/site/stages/build/drupal/graphql/GetAllPages.graphql.js b/src/site/stages/build/drupal/graphql/GetAllPages.graphql.js index 4945843eeb..db16a71a82 100644 --- a/src/site/stages/build/drupal/graphql/GetAllPages.graphql.js +++ b/src/site/stages/build/drupal/graphql/GetAllPages.graphql.js @@ -115,7 +115,8 @@ const buildQuery = () => { ... nodeOffice ... bioPage ... benefitListingPage - + ... nodeEventListing + ... nodeEvent ... storyListingPage ... leadershipListingPage ... pressReleasesListingPage diff --git a/src/site/stages/build/drupal/individual-queries.js b/src/site/stages/build/drupal/individual-queries.js index e8084f0929..3006c15b28 100644 --- a/src/site/stages/build/drupal/individual-queries.js +++ b/src/site/stages/build/drupal/individual-queries.js @@ -29,6 +29,12 @@ const { GetNodePressReleaseListingPages, } = require('./graphql/pressReleasesListingPage.graphql'); +const { + getNodeEventListingQueries, +} = require('./graphql/nodeEventListing.graphql'); + +const { getNodeEventQueries } = require('./graphql/nodeEvent.graphql'); + const { GetNodeStoryListingPages, } = require('./graphql/storyListingPage.graphql'); @@ -112,6 +118,8 @@ function getNodeQueries(entityCounts) { ...getNewsStoryQueries(entityCounts), ...getPressReleaseQueries(entityCounts), GetNodePressReleaseListingPages, + ...getNodeEventListingQueries(entityCounts), + ...getNodeEventQueries(entityCounts), ...getVaPoliceQueries(entityCounts), GetNodeStoryListingPages, GetNodeLocationsListingPages, diff --git a/src/site/stages/build/plugins/modify-dom/check-broken-links/helpers/isBrokenLink.js b/src/site/stages/build/plugins/modify-dom/check-broken-links/helpers/isBrokenLink.js index 753c309841..b88204e4e3 100644 --- a/src/site/stages/build/plugins/modify-dom/check-broken-links/helpers/isBrokenLink.js +++ b/src/site/stages/build/plugins/modify-dom/check-broken-links/helpers/isBrokenLink.js @@ -1,8 +1,5 @@ const path = require('path'); const url = require('url'); -const { - IGNORE_PATTERNS, -} = require('../../../../../../constants/brokenLinkIgnorePatterns'); /** * Validates an HREF/SRC value @@ -27,13 +24,6 @@ function isBrokenLink(link, pagePath, allPaths) { let filePath = decodeURIComponent(parsed.pathname); - // Check for link destinations we are not testing. - for (let i = 0; i < IGNORE_PATTERNS.length; i += 1) { - if (filePath.match(IGNORE_PATTERNS[i])) { - return false; - } - } - if (path.isAbsolute(filePath)) { filePath = path.join('.', filePath); } else { @@ -43,6 +33,7 @@ function isBrokenLink(link, pagePath, allPaths) { if (!path.extname(filePath)) { filePath = path.join(filePath, 'index.html'); } + return !allPaths.has(filePath); }