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: new features for Ghost source plugin #2
Open
nocash
wants to merge
32
commits into
master
Choose a base branch
from
develop
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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 `sinon@5.0.0`, 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
This was done originally in 714bdc7 but I missed it during the merge.
The changes included have outgrown the scope of #1 so I'm closing it in favor of this PR. |
6 tasks
# Conflicts: # gatsby-node.js
nocash
pushed a commit
that referenced
this pull request
Jan 15, 2019
closes #2 - This is the hacky workaround recommended by Gatsby - Ref: gatsbyjs/gatsby#10856 (comment) - It depends on private API, but is better than needing a data stub!
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
: