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

fix(docs): improve image docs from workflow evaluation #14697

Merged
merged 16 commits into from
Jun 12, 2019
Merged

Conversation

marcysutton
Copy link
Contributor

Description

As part of #14529, this PR introduces more documentation for images in Gatsby. Specifically:

  • adding Gatsby Image to the API docs as the information was previously spread across multiple docs and plugin READMEs
  • adding "in gatsby" to the URL and title of the "Images, Files and Video" page for SEO
  • adding more content to Images, Files and Video page to improve decision making
  • adding more links to the Using Gatsby Image and Working with Images in Gatsby pages
  • adding content about working with GIFs

Things still to do:

I decided not to add the gatsby-image props, fragments and API info in Reference Guides because that content went into the new API doc instead. Those docs are more conceptual and do include some examples, but they link off to the API doc instead of including all the parameters/methods/etc. It seemed like overkill and potentially confusing to include those in multiple places.

I'm super open to improvements, as this is the first go at the API doc! Let me know if there's anything you feel could be improved or simplified if it's too long. I tried to bring the major components all together into one place but it's a lot of stuff, so I subjectively included what I thought was important to know.

@marcysutton marcysutton added the type: documentation An issue or pull request for improving or updating Gatsby's documentation label Jun 11, 2019
@marcysutton marcysutton requested a review from a team as a code owner June 11, 2019 00:55
@marcysutton marcysutton requested a review from a team June 11, 2019 00:55
@marcysutton marcysutton requested a review from a team as a code owner June 11, 2019 00:55
Copy link
Contributor

@jlengstorf jlengstorf 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 looking great!

docs/docs/gatsby-image-api.md Outdated Show resolved Hide resolved
docs/docs/gatsby-image-api.md Outdated Show resolved Hide resolved

## Setting up Gatsby Image

To install Gatsby Image, install the `gatsby-image` package along with necessary plugins `gatsby-transformer-sharp` and `gatsby-plugin-sharp`. Reference the packages in your Gatsby config file. You can also provide additional options to [`gatsby-plugin-sharp`](/packages/gatsby-plugin-sharp/) in your config file.
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we include a copy-pasteable block here for convenience?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I debated on that. It's included so many places, I linked to the docs instead. But we could add it if necessary

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ended up adding it in! Thanks for the nudge.

docs/docs/gatsby-image-api.md Outdated Show resolved Hide resolved
docs/docs/gatsby-image-api.md Outdated Show resolved Hide resolved
}
```

Read more in the [gatsby-plugin-sharp](/packages/gatsby-plugin-sharp/?=#fluid) README.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Read more in the [gatsby-plugin-sharp](/packages/gatsby-plugin-sharp/?=#fluid) README.
Read more in the [gatsby-plugin-sharp](/packages/gatsby-plugin-sharp/#fluid) README.

Copy link
Contributor

Choose a reason for hiding this comment

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

Anchors don't seem to be working, FYI. 😕

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They don't seem to work for me no matter what the URL is...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually they do work for me in their existing form, at least locally when I click them. They don't work when deep-linked

docs/docs/gatsby-image-api.md Outdated Show resolved Hide resolved
In addition to `gatsby-plugin-sharp` settings in `gatsby-config.js`, there are additional query options that apply to both _fluid_ and _fixed_ images:

- `grayscale` (bool, default: false)
- `duotone` (bool|obj, default: false)
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be too much, but a before/after of grayscale and duotone would be dope.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ooh maybe @gillkyle could help me with that!

Copy link
Contributor

Choose a reason for hiding this comment

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

Here's what I added (note: these images will only be displayed like this if you've upgraded gatsby-remark-images like this PR #14716):
example-images-screenshot

Just pushed right to this branch, feel free to edit it if you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're amazing, thanks @gillkyle !

docs/docs/gatsby-image-api.md Outdated Show resolved Hide resolved
docs/docs/gatsby-image-api.md Outdated Show resolved Hide resolved
Copy link
Contributor

@gillkyle gillkyle left a comment

Choose a reason for hiding this comment

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

I think this will be really helpful with the additions of the API section as well as a specific page on GIFs 👏

Left some really minor comments.

docs/docs/using-gatsby-image.md Outdated Show resolved Hide resolved

Additionally, plugins supporting `gatsby-image` currently include [gatsby-source-contentful](/packages/gatsby-source-contentful/), [gatsby-source-datocms](https://github.com/datocms/gatsby-source-datocms) and [gatsby-source-sanity](https://github.com/sanity-io/gatsby-source-sanity). See the [gatsby-image](/packages/gatsby-image/#fragments) README for more details.

## Gatsby-image props
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like this info (and maybe some other stuff in this API section are really closely related to what's in the gatsby-image README which this page links to, would it make sense to have the README link back to this page too?

And maybe this table of props is something that could be an MDX component at some point so the two don't diverge (though I'm guessing they don't get updated frequently if at all).

docs/docs/gatsby-image.md Outdated Show resolved Hide resolved
Marcy Sutton and others added 2 commits June 11, 2019 09:01
@calcsam
Copy link
Contributor

calcsam commented Jun 11, 2019

Woooo!

@marcysutton marcysutton merged commit 16f0baf into master Jun 12, 2019
@marcysutton marcysutton deleted the image-docs branch June 12, 2019 22:31
mxxk pushed a commit to mxxk/gatsby that referenced this pull request Jun 21, 2019
* add API doc for Gatsby Image, improve API titles

* improve content in image docs

* add doc on working with GIFs

* chore: format

* update GIFs page with an animated GIF, for reasons

* a few copy tweaks to Gatsby Image API doc

* code block tweaks and moving links

* add markdown + a11y note to GIFs page

* pr feedback from Jason

* change warning to a note per feedback

* Update docs/docs/using-gatsby-image.md

Co-Authored-By: gillkyle <[email protected]>

* Update docs/docs/gatsby-image.md

Co-Authored-By: gillkyle <[email protected]>

* chore: add example images demonstrating duotone and grayscale in image api

* add install code blocks for copy/paste
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: documentation An issue or pull request for improving or updating Gatsby's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants