forked from TryGhost/gatsby-source-ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
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
wip: add node links and backreferences during node creation #1
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This will allow for working with tags and users in Gatsby that do not yet have posts associated with them.
From the docs: > Since `[email protected]`, the `sinon` object is a default sandbox. Unless > you have a very advanced setup or need a special configuration, you > probably want to just use that one. https://sinonjs.org/releases/v7.2.2/sandbox/#default-sandbox
nocash
changed the title
add node links and backreferences during node creation
wip: add node links and backreferences during node creation
Dec 17, 2018
nocash
force-pushed
the
create-node-references
branch
from
December 19, 2018 04:15
c011adb
to
2e9117f
Compare
nocash
force-pushed
the
create-node-references
branch
from
December 19, 2018 19:02
d291e89
to
48bb89b
Compare
nocash
force-pushed
the
create-node-references
branch
from
December 19, 2018 19:35
37d4ac1
to
9d94070
Compare
6 tasks
Closing this in favor of #2 (uses |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rewrites a large portion of the plugin in order to properly link related values to their GraphQL node objects.
Todo
Remove the(Note: theGhostPage
node typeGhostPage
node type has been readded after the updates for the v2 API).createRemoteFileNode
to copy images to local file systemSignificant changes
Replaced certain object properties with links to the related node(s).
post.tags
,post.primary_tag
,post.authors
, andpost.primary_author
now return the actual nodes rather than containing a limited copy of the data.Removes the(Note: theGhostPage
node type (explanation below).GhostPage
node type has been readded after the updates for the v2 API).Added a
posts
collection toGhostTag
andGhostAuthor
nodes that contain node references to the posts they are assigned to (e.g.author.posts
returns all posts written by that user).Adds a
GhostMedia
node type that is used forpost.feature_image
,tag.feature_image
,user.profile_image
, anduser.cover_image
. TheGhostMedia
type contains asrc
field the retains the original URL from those fields but additionally downloads the image and creates alocalFile
node that can be used with thegatsby-image
package.Queries the
/tags
and/users
endpoints of the Ghost API to get a full set of data rather than inferring it from the posts collection. Previously, tags that were not added to any posts were never passed to Gatsby, and the same was true for users.Removing theGhostPage
node typeNote: The
GhostPage
node type was removed when working with the v0.1 API but has been readded after updating to the v2 API to maintain parity with the API resources (see https://docs.ghost.org/api/content/#resources). The information below is being kept for posterity but may be removed later.GhostPage
is not significantly different fromGhostPost
— the only difference being thatpost.page
istrue
instead offalse
— and now that nodes and backreferences are working correctly it complicates what should be trivial queries by requiring inline fragments in order to select fields from otherwise identical objects. E.g.:We can remove the
GhostPage
type from the source plugin and we leave it to the consumers to decide how they want to handle pages. This is easily done ingatsby-node.js
: