Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Revert "Remove Event page queries from Content Build"" #2387

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};
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
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
Loading