Skip to content

Commit

Permalink
Revert "Revert "Remove Event page queries from Content Build (#2368)" (
Browse files Browse the repository at this point in the history
…#2386)" (#2387)

This reverts commit 56d9b5b.
  • Loading branch information
timcosgrove authored Dec 16, 2024
1 parent 3f589d7 commit 8633531
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 31 deletions.
26 changes: 26 additions & 0 deletions src/site/constants/brokenLinkIgnorePatterns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
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,
};
20 changes: 0 additions & 20 deletions src/site/stages/build/drupal/graphql/CountEntityTypes.graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,6 @@ 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: [
Expand Down
3 changes: 1 addition & 2 deletions src/site/stages/build/drupal/graphql/GetAllPages.graphql.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ const buildQuery = () => {
... nodeOffice
... bioPage
... benefitListingPage
... nodeEventListing
... nodeEvent
... storyListingPage
... leadershipListingPage
... pressReleasesListingPage
Expand Down
8 changes: 0 additions & 8 deletions src/site/stages/build/drupal/individual-queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@ const {
GetNodePressReleaseListingPages,
} = require('./graphql/pressReleasesListingPage.graphql');

const {
getNodeEventListingQueries,
} = require('./graphql/nodeEventListing.graphql');

const { getNodeEventQueries } = require('./graphql/nodeEvent.graphql');

const {
GetNodeStoryListingPages,
} = require('./graphql/storyListingPage.graphql');
Expand Down Expand Up @@ -118,8 +112,6 @@ function getNodeQueries(entityCounts) {
...getNewsStoryQueries(entityCounts),
...getPressReleaseQueries(entityCounts),
GetNodePressReleaseListingPages,
...getNodeEventListingQueries(entityCounts),
...getNodeEventQueries(entityCounts),
...getVaPoliceQueries(entityCounts),
GetNodeStoryListingPages,
GetNodeLocationsListingPages,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const path = require('path');
const url = require('url');
const {
IGNORE_PATTERNS,
} = require('../../../../../../constants/brokenLinkIgnorePatterns');

/**
* Validates an HREF/SRC value
Expand All @@ -24,6 +27,13 @@ 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 {
Expand All @@ -33,7 +43,6 @@ function isBrokenLink(link, pagePath, allPaths) {
if (!path.extname(filePath)) {
filePath = path.join(filePath, 'index.html');
}

return !allPaths.has(filePath);
}

Expand Down

0 comments on commit 8633531

Please sign in to comment.