Skip to content
Advertisement

Tag: gatsby

Can’t import React theme

I am working with Gatsby and have some code in my gatsby-browswer.js file which is importing a theme, but the changes don’t reflect on my webpage. My gatsby-browser file: My theme file: The page is a very simple “Hello World”, but when I check the font and everything else on the webpage, they seem to be the default ones. Answer

Why can’t Gatsby / Facebook find my og:image

I have a Gatsby app setup. src/ —images/foo.jpg // <— the img i want on my facebook shareable URL (og:image). —images/ // <– note, there are loads of PNG files i’m using that seem to trip/default onto the FB image/share. —assets/ // <— loads of SVGs i’m using that —components/seo.js // component embedded at top of each page —pages/index.js //

WebpackError: ReferenceError: window is not defined – npm run build

I get the following error when i do “npm run build” : WebpackError: ReferenceError: window is not defined this is a part of code that causes an error: Answer During your development, you can access to window in client. When you run build, gatsby renders these components on the server where window is not defined. Solution is the use window

How to get pathname in the layout file in gatsby

I am working with gasby and here the main file is always layout.js which is the parent of them all. Since it is a parent file then how can I get a location props this.props.location.pathname inside it? Here is my layout component Answer As stated in the Gatsby docs: In v1, the layout component had access to history, location, and

Advertisement