From 6e4734b0ae0403d5b4cd6cca0b7c84e24368f2cf Mon Sep 17 00:00:00 2001 From: Shinsina Date: Thu, 24 Mar 2022 08:36:05 -0500 Subject: [PATCH 1/4] + requiresIndexed to allPublishedContentQueryInput Defaults to false. --- .../src/graphql/definitions/platform/content/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/services/graphql-server/src/graphql/definitions/platform/content/index.js b/services/graphql-server/src/graphql/definitions/platform/content/index.js index c9e0cac7e..915749b44 100644 --- a/services/graphql-server/src/graphql/definitions/platform/content/index.js +++ b/services/graphql-server/src/graphql/definitions/platform/content/index.js @@ -521,6 +521,8 @@ input AllPublishedContentQueryInput { sectionBubbling: Boolean = true "Adjusts the order items are returned in." sort: ContentSortInput = { field: published, order: desc } + "Whether or not the content needs to be indexed by a search engine" + requiresIndexed: Boolean = false "Adjust which subset of results should be returned." pagination: PaginationInput = {} "For types with a startDate field: Limit results to items with a startDate matching the criteria." From aba41f55ad383db220c37ff595f29d6e25c05d4b Mon Sep 17 00:00:00 2001 From: Shinsina Date: Thu, 24 Mar 2022 08:36:45 -0500 Subject: [PATCH 2/4] If requiresIndexed true, query for indexed content --- .../graphql-server/src/graphql/resolvers/platform/content.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/services/graphql-server/src/graphql/resolvers/platform/content.js b/services/graphql-server/src/graphql/resolvers/platform/content.js index 72bf1beb5..a1ba3d0b6 100644 --- a/services/graphql-server/src/graphql/resolvers/platform/content.js +++ b/services/graphql-server/src/graphql/resolvers/platform/content.js @@ -904,6 +904,7 @@ module.exports = { withSite, customAttributes, updated, + requiresIndexed, } = input; // @deprecated Prefer includeContentTypes over contentTypes. @@ -951,6 +952,9 @@ module.exports = { if (includeLabels.length) { query.labels = { $in: includeLabels }; } + if (requiresIndexed) { + query.$and.push({ $or: [{ 'mutations.Website.noIndex': { $exists: false } }, { 'mutations.Website.noIndex': false }] }); + } const projection = connectionProjection(info); return basedb.paginate('platform.Content', { From 91ee504bd7da9a1cfbb37cc95922a1b106a6008d Mon Sep 17 00:00:00 2001 From: Shinsina Date: Thu, 24 Mar 2022 08:36:56 -0500 Subject: [PATCH 3/4] Add requiresIndexed to block loader. --- packages/web-common/src/block-loaders/all-published-content.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/web-common/src/block-loaders/all-published-content.js b/packages/web-common/src/block-loaders/all-published-content.js index c521b2060..9521348c8 100644 --- a/packages/web-common/src/block-loaders/all-published-content.js +++ b/packages/web-common/src/block-loaders/all-published-content.js @@ -56,6 +56,8 @@ module.exports = async (apolloClient, { requiresImage, sectionBubbling, + requiresIndexed, + queryFragment, queryName, } = {}) => { @@ -74,6 +76,7 @@ module.exports = async (apolloClient, { since: date(since), beginning: { after: date(beginningAfter), before: date(beginningBefore) }, ending: { after: date(endingAfter), before: date(endingBefore) }, + requiresIndexed, ...(publishedAfter && { after: date(publishedAfter) }), }; if (field || order) input.sort = { field, order }; From eea08cac7854496d854457e7fe69329bc43c7e12 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Thu, 24 Mar 2022 08:37:12 -0500 Subject: [PATCH 4/4] Add requiresIndexed to sitemap day.marko template. --- packages/marko-web-html-sitemap/templates/day.marko | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/marko-web-html-sitemap/templates/day.marko b/packages/marko-web-html-sitemap/templates/day.marko index 873bfe110..0f1e912c0 100644 --- a/packages/marko-web-html-sitemap/templates/day.marko +++ b/packages/marko-web-html-sitemap/templates/day.marko @@ -30,6 +30,7 @@ $ const pageNode = {