Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

gatsby plugin image

npm install gatsby-plugin-image gatsby-plugin-sharp gatsby-source-filesystem gatsby-transformer-sharp
Comment

gatsby image

npm install --save gatsby-transformer-sharp gatsby-plugin-sharp
Comment

Gatsby Plugin Image

import { graphql } from "gatsby"
import { GatsbyImage, getImage } from "gatsby-plugin-image"

function BlogPost({ data }) {
  const image = getImage(data.blogPost.avatar)
  return (
    <section>
      <h2>{data.blogPost.title}</h2>
      <GatsbyImage image={image} alt={data.blogPost.author} />
      <p>{data.blogPost.body}</p>
    </section>
  )
}

export const pageQuery = graphql`
  query {
    blogPost(id: { eq: $Id }) {
      title
      body
      author
      avatar {
        childImageSharp {
          gatsbyImageData(
            width: 200
            placeholder: BLURRED
            formats: [AUTO, WEBP, AVIF]
          )
        }
      }
    }
  }
`
Comment

PREVIOUS NEXT
Code Example
Shell :: kazam recorder ubuntu 
Shell :: Could not find or parse valid build output file. 
Shell :: Authentication failed for tfs git 
Shell :: nginx dockerfile 
Shell :: Add Docker’s official GPG key: 
Shell :: access django admin 
Shell :: git change author of last 2 commits 
Shell :: babel json loader 
Shell :: how to connect your repo to your vscode 
Shell :: access wsl files from windows 
Shell :: gitignore a folder recursively 
Shell :: git how to add remote 
Shell :: oh my zsh 
Shell :: ubuntu cat last 10 lines 
Shell :: bash ifelse 
Shell :: upgrade package using pip 
Shell :: github clone to local folder 
Shell :: Winbox for linux 
Shell :: how to install docker compose on windows 
Shell :: emporary failure resolving 
Shell :: copy files from local to host ssh 
Shell :: speedtest linux console 
Shell :: Move folder content up a level using bash/shell 
Shell :: NGINX systemd service file 
Shell :: vscode publish to github organisation 
Shell :: centos monitor network traffic 
Shell :: How to install cookies react 
Shell :: git config log 
Shell :: ssh permissions are too open 
Shell :: delete a folder then git push 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =