-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
(docs): split GraphQL image fragments APIs to their own pages #21536
Closed
+36
−81
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
title: Contentful Fragments | ||
jsdoc: ["gatsby-source-contentful/src/fragments.js"] | ||
contentsHeading: Fragments | ||
includeTopLevel: true | ||
--- | ||
|
||
The following fragments are available in any site with `gatsby-source-contentful` installed and included in your `gatsby-config.js`. These fragments generally mirror the fragments outlined in the `gatsby-transformer-sharp` package. |
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: Image Sharp Fragments | ||
jsdoc: ["gatsby-transformer-sharp/src/fragments.js"] | ||
contentsHeading: Fragments | ||
includeTopLevel: true | ||
--- | ||
|
||
The following fragments are available in any site with `gatsby-transformer-sharp` installed and included in your `gatsby-config.js`. | ||
|
||
Information on querying with these fragments is also listed in-depth in the [Gatsby image API docs](/docs/gatsby-image/), including options like resizing and recoloring. |
This file was deleted.
Oops, something went wrong.
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 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding
includeTopLevel
is a hack for now. Once we're approved that we want to do this, I can figure out a less hacky solution.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind expanding on that? I'm not too sure what the name suggests. And is the question about approval about adding that to the frontmatter or the general approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Originally, we're filtering the docs based on if
def.memberof
is defined -- i.e. only using docs that are part of some object, likeactions.createPage
.Since the fragments are exported by themselves they'll be filtered out if we don't change this query in some way. My current solution is to add an option in the frontmatter to disable this check.
But I think the better solution would be to figure out why this query was needed (as in, what things we don't want to include in the doc) and come up with a better check that works for both that and the new fragments query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To my knowledge, this change is good to go. But do we have any additional clarity on this? @LekoArts, do you know why the query is there or whether this might cause unforeseen issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for the question about the meaning of
includeTopLevel
... seems like we should also put a note about that in the contributing docs.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the Git history, I believe @gillkyle would know more about that query as it appears he wrote the file. It seems worth getting to the bottom of it rather than doing a workaround with contributing docs, in my opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea of that query was to tie the updates to the fragments file in the core codebase to the docs so they wouldn't fall out of sync. This was a different use case than the other API reference pages so I see why there would need to be a bit of a change to the logic of the template.
As it stands now it's not doing much more than list all the exported fragments so if it would simplify things to just make that a list that we occasionally have to update from time to time I don't think that would be a problem either. Seems like maybe the added complexity of querying the list of fragments might not be worth whatever small benefit it adds 🤷♂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's more or less where I'm at, Kyle. I'm struggling to think of a different way to do this that wouldn't create additional opportunities for docs to get out of sync. Also, my point about the contributing docs stands regardless of what we do if we go for something that requires setting an option somewhere, even if it's not exactly this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed in just making it a static list. There's precedence for it: many of our docs don't rely on pulling in JSDoc. In fact, we already have a list of the ImageSharp fragments in the Gatsby Image API, so an argument could be made that this content is repeated. I'm not sure what the best place would be to put information about the Contentful fragments though -- maybe in the
gatsby-source-contentful
readme and "sourcing from contentful", with a link to the Gatsby Image API for more details on the fragment options.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solid points. I think your suggestions for where to add the information make sense and I'm comfortable with keeping the list of fragments.