Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #262 from Shinsina/content-requires-index
Browse files Browse the repository at this point in the history
```requiresIndexed``` field on ```AllPublishedContentQuery```
  • Loading branch information
zarathustra323 authored Mar 30, 2022
2 parents a3a0775 + eea08ca commit 6f590dd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/marko-web-html-sitemap/templates/day.marko
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ $ const pageNode = {
<marko-web-query|{ nodes }|
name="all-published-content"
params={
requiresIndexed: true,
publishedAfter: new Date(after.toISOString()),
since: new Date(ending.toISOString()),
limit: perPage,
Expand All @@ -52,6 +53,7 @@ $ const pageNode = {
<marko-web-html-sitemap-query-total-count|{ totalCount }|
name="all-published-content"
params={
requiresIndexed: true,
after: after.toDate().getTime(),
since: ending.toDate().getTime(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ module.exports = async (apolloClient, {
requiresImage,
sectionBubbling,

requiresIndexed,

queryFragment,
queryName,
} = {}) => {
Expand All @@ -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 };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,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."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -904,6 +904,7 @@ module.exports = {
withSite,
customAttributes,
updated,
requiresIndexed,
} = input;

// @deprecated Prefer includeContentTypes over contentTypes.
Expand Down Expand Up @@ -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', {
Expand Down

0 comments on commit 6f590dd

Please sign in to comment.