CURRENT BEHAVIOR
Hi. I am using Gatsby and my layout component (containing both header and footer) is placed inside gatsby-browser.js & gatsby-ssr.js' wrapPageElement. However, in doing so, the layout is rendered on every page. I had placed my layout component inside both gatsby-browser and gatsby-ssr because I have dynamic content in my header - it shows the user's email and navigation links if the user is authenticated
DESIRED BEHAVIOR
I would prefer my index page not to be wrapped with a layout since it's will just be a static page for designs only and will not have any dynamic content
Henceforth, is there any way, I can do without Layout in my index.js? Thanks
gatsby-ssr.js & gatsby-browser.js
export const wrapPageElement = ({ element, props }) => {
return <Layout {...props}>{element}</Layout>
}
index.js
// a layout comprising both header and footer is still being rendered since layout component is in gatsby-ssr and gatsby-browser.js
import React from "react"
import { Link } from "gatsby"
import { Container } from "../components/common"
import SEO from "../components/seo"
const IndexPage = props => {
return (
<Container>
<SEO title="Home" />
<div>
<Link to="/account">Go to your account</Link>
</div>
</Container>
)
}
export default IndexPage