I am a newbie with Gatsby. So, I would like to get my website logo defined in the WordPress administration. Here is how I did it:
`import React from 'react';
import {graphql, StaticQuery} from 'gatsby';
import styled from 'styled-components';
import Img from 'gatsby-image';
const SiteInfo = () => (
<StaticQuery query={graphql`
{
file(name: {eq: "logo"}) {
relativePath
childImageSharp {
fluid {
originalImg
}
}
}
site {
siteMetadata {
title
}
}
allFile(filter: {name: {eq: "logo"}}) {
edges {
node {
name
url
relativePath
}
}
}
allWordpressWpMedia(filter: {title: {eq: "logo"}}) {
edges {
node {
title
source_url
}
}
}
}
`
} render = {data => (
<BasicInfoWrapper>
<Sitelogo>
<Img src={data.allWordpressWpMedia.edges.node.source_url} alt="Logo" />
</Sitelogo>
<SiteTitle>
{/*data.site.siteMetadata?.title || `Title`*/}
</SiteTitle>
</BasicInfoWrapper>
)}/>
);
export default SiteInfo;
`
unfortunately it doesn't work and I get the following error: TypeError:
`can't access property "source_url", data.allWordpressWpMedia.edges.node is undefined`
So I turn to you so that I can succeed in doing it
Thank you !