Skip to content

Add support for querying SVGs as images #3277

@kripod

Description

@kripod

I think it would be great if public URLs for SVGs could be generated through ImageSharp. Currently, if I want to use vector and raster graphics interchangeably, I need to use some extra code similar to below:

let thumbnailSrc;
if (video.frontmatter.thumbnail != null) {
  thumbnailSrc =
    video.frontmatter.thumbnail.childImageSharp != null
      ? video.frontmatter.thumbnail.childImageSharp.sizes.src
      : `/${video.frontmatter.thumbnail.relativePath}`;
}

Also, I have to put all the related images to the /static folder and make them discoverable by gatsby-source-filesystem. Querying SVGs just like raster images would simplify this workflow by a lot.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions