feat: fetch from multiple i18n sources #1210
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist:
Update index.md
)This PR adjusts the build process so that we can build sites from both Ghost and Hashnode simultaneously. It also adds some basic tests to make sure certain features like the original post / translator feature still work as expected, even with mixed data sources.
The biggest change is with the GraphQL query in
fetch-from-hashnode.js
, where we check to see if the localized site we're building is one from a shared Hashnode instance. Currently we expect that Italian, Japanese, Korean, and Ukrainian will all be on one instance.If this is the case, then we include a filter with the GraphQL query to only pull posts with tags in the
fcc-<language>
format. This is related to the proposed changes to the migration script here: https://github.com/freeCodeCamp/ghost-posts-archiveThis means that, when we're building the Japanese site, for example, if a published post doesn't have the
fcc-japanese
tag, its data won't get pulled from Hashnode, and we won't build that page. This should also prevent posts from other languages on the same instance like Italian from appearing on the Japanese site.Note: Coordinate with team on the Hashnode host env vars for these languages, and update the
deploy-i18n
workflow to use them.