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

[gatsby-remark-images] Large blank spaces / blurs in RSS feeds #17593

Closed
fionawhim opened this issue Sep 12, 2019 · 8 comments · Fixed by #19888
Closed

[gatsby-remark-images] Large blank spaces / blurs in RSS feeds #17593

fionawhim opened this issue Sep 12, 2019 · 8 comments · Fixed by #19888
Labels
type: bug An issue or pull request relating to a bug in Gatsby

Comments

@fionawhim
Copy link
Contributor

Description

The gatsby-remark-images plugin causes large blank space above images in RSS readers that apply the page’s inline styles.

This seems to be due to #14816, which moved the <img> tag’s positioning out of the style attribute and into a <style> tag that is not seen by RSS readers.

Because of this, the <img> is not absolutely positioned over the background element, which causes either a large white space or a blurry background, depending on the HTML support in the reader. Additionally, the image is not correctly sized.

Steps to reproduce

  1. Include gatsby-remark-images in a site and put an image in a blog post.
  2. View the site in Reeder or NetNewsWire

Expected result

Images naturally fit in with the content of the post.

Actual result

The background element is not covered up, leaving either white space or a blurry image.

Here are shots of the Gatsby blog post Creating a purpose-driven media platform

NetNewsWire 5.0 on OS X:

Screen Shot 2019-09-12 at 1 49 56 PM

Reeder on iOS:

IMG_4160

In some cases, such as FeedBin for the web, the RSS reader throws out enough of the CSS and HTML that it strips the background padding element, so things look fine:

Screen Shot 2019-09-12 at 1 55 33 PM

Environment

Run gatsby info --clipboard in your project directory and paste the output here.

System:
OS: macOS 10.14.6
CPU: (4) x64 Intel(R) Core(TM) i5-4288U CPU @ 2.60GHz
Shell: 3.0.2 - /usr/local/bin/fish
Binaries:
Node: 8.16.0 - /usr/local/bin/node
Yarn: 1.16.0 - /usr/local/bin/yarn
npm: 6.10.3 - /usr/local/bin/npm
Languages:
Python: 2.7.16 - /usr/local/bin/python
Browsers:
Chrome: 76.0.3809.132
Firefox: 68.0.2
Safari: 12.1.2
npmPackages:
gatsby: ^2.13.68 => 2.15.5

@fionawhim fionawhim added the type: bug An issue or pull request relating to a bug in Gatsby label Sep 12, 2019
@fionawhim
Copy link
Contributor Author

I think it would be worth trying to reverse part of #14816 to put the style attribute back on the <img> tag.

Barring that, one could have a style attribute on the background element that gives it display: none, which is then overridden by a !important CSS rule in gatsby-remark-images’s <style> tag. Unfortunately, this latter approach would be a breaking change for MDX users, due to the gatsby-remark-image gatsby-ssr not running. (See #15486)

@gatsbot
Copy link

gatsbot bot commented Oct 3, 2019

Hiya!

This issue has gone quiet. Spooky quiet. 👻

We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here.

If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open!

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks for being a part of the Gatsby community! 💪💜

@gatsbot gatsbot bot added the stale? Issue that may be closed soon due to the original author not responding any more. label Oct 3, 2019
@gatsbot
Copy link

gatsbot bot commented Oct 14, 2019

Hey again!

It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it.

Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m HUMAN_EMOTION_SORRY. Please feel free to reopen this issue or create a new one if you need anything else.

As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!

Thanks again for being part of the Gatsby community!

@gatsbot gatsbot bot closed this as completed Oct 14, 2019
@fionawhim fionawhim reopened this Nov 30, 2019
@fionawhim
Copy link
Contributor Author

fionawhim commented Nov 30, 2019

Reopening because I'm finally pushing a PR to fix it.

The move into a <style> element was not a necessary part of #14816.

See: #14816 (comment)

fionawhim added a commit to fionawhim/gatsby that referenced this issue Nov 30, 2019
Fixes gatsbyjs#17593

This PR reverts a part of gatsbyjs#14816 that moved the image styles into a <style>
tag in the head. Per this comment from @JoshuaWalsh, putting the styles
in the <head> was just a cleanliness improvement, and did not affect the
functionality that gatsbyjs#14816 was addressing:

gatsbyjs#14816 (comment)

Reverting this PR allows the responsive images to display correctly when
the Remark HTML is displayed outside of the Gatsby layout, such as in
an RSS feed.
@github-actions github-actions bot removed the stale? Issue that may be closed soon due to the original author not responding any more. label Dec 1, 2019
gatsbybot pushed a commit that referenced this issue Dec 9, 2019
* Moves responsive image CSS back into attribute

Fixes #17593

This PR reverts a part of #14816 that moved the image styles into a <style>
tag in the head. Per this comment from @JoshuaWalsh, putting the styles
in the <head> was just a cleanliness improvement, and did not affect the
functionality that #14816 was addressing:

#14816 (comment)

Reverting this PR allows the responsive images to display correctly when
the Remark HTML is displayed outside of the Gatsby layout, such as in
an RSS feed.

* Updates Jest snapshots for image style changes
@sslotsky
Copy link
Contributor

sslotsky commented Jan 9, 2020

Sorry to chime in on a closed issue but I think I'm also having this problem. When I view my feed I only see the blurred image. The URL to the high-res image is correct. I can open the image in a new tab and see the image. The problem appears to be that the img tag itself is taking up zero height. Any insight here? Help is appreciated.

https://saxyfool.dev/rss.xml

@sslotsky
Copy link
Contributor

sslotsky commented Jan 9, 2020

Update on the above ☝️

My conclusion that the image takes up zero height was hasty. It does take up zero height when I delete the sibling span node that contains the blurry image data. I did this to see if my image would show up. If I leave the span there, the image takes up the same dimensions and position, but isn't visible. This is on feedreader.com.

On the other hand, if I try to view my feed on feeder.io, they are using a relative URL for my image. When I inspect my rss.xml, I can see that the image paths are indeed relative, so feedreader.com must be doing some transformation that feeder.io is skipping. So I guess I have two questions:

  1. Is there a way for the rss generation to transform image URLs so that they use the full image URL?
  2. Any idea why my image isn't visible on feedreader.com despite the fact that they are using the full image URL?

@fionawhim
Copy link
Contributor Author

@sslotsky Different readers are just gonna do different things I guess. I looked at your feed in NetNewsWire and the image at the top (of the street) looked as expected. No blank spaces or blurs anywhere.

@sslotsky
Copy link
Contributor

sslotsky commented Jan 9, 2020

That's Mac only, yeah? Sadly I can't verify. I'll take your word for that but so far the ratio isn't very good 😄

Even so. If we assume that some readers won't style these images well, I still think that using the absolute URL to the image file would be ideal so that readers don't have to transform. Is there a way to do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants