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

Source related resource content from Swiftype #594

Merged
merged 33 commits into from
Aug 13, 2020

Conversation

jerelmiller
Copy link
Contributor

Closes #584
Closes #589

Description

Adds the ability to source data from Swiftype to populate the related resource content. This adds the GraphQL nodes needed to fetch from the site as well as the flags to tell it whether to regenerate results from Swiftype or read from the local JSON file. This also ensures results from the frontmatter defined resources are filtered out from the search call.

Copy link
Contributor

@caylahamann caylahamann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is so much work woaaah it looks all good to me 👍 :)

resolve: 'gatsby-source-swiftype',
options: {
file: `${__dirname}/src/data/related-pages.json`,
refetch: Boolean(process.env.BUILD_RELATED_CONTENT),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this for caching reasons?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. By default, the data is resolved from the src/data/related-pages.json file. When we need to refresh that data and make new requests to Swiftype, setting the BUILD_RELATED_CONTENT environment variable will instruct the plugin to go make new requests to Swiftype and save them in the JSON file.

@jerelmiller jerelmiller merged commit 13b2fb8 into develop Aug 13, 2020
@jerelmiller jerelmiller deleted the jerel/sync-search-data branch August 13, 2020 18:29
@nr-opensource-bot
Copy link
Contributor

🎉 This PR is included in version 1.11.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request released
Projects
None yet
3 participants