Created
March 29, 2022 14:04
-
-
Save AndrewKepson/6ad8fd73623ad8ab022db6ad2436b5f4 to your computer and use it in GitHub Desktop.
Gatsby Home Page Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { graphql } from 'gatsby' | |
import { Layout, Seo, HomePageContent } from '../components/components' | |
const IndexPage = ({ | |
data: { | |
wpPage: { | |
featuredImage: { | |
altText, | |
node: { | |
localFile: { | |
childImageSharp: { ogImg, twitterImg }, | |
}, | |
}, | |
}, | |
seo, | |
schemaMarkup: { schemaMarkup }, | |
}, | |
}, | |
}) => ( | |
<Layout> | |
<Seo | |
title={seo.title} | |
description={seo.metaDesc} | |
canonical={seo.canonical} | |
ogImg={ogImg.src} | |
ogImgAltText={altText} | |
twitterImg={twitterImg.src} | |
/> | |
<HomePageContent /> | |
<div dangerouslySetInnerHTML={{ __html: schemaMarkup }} /> | |
</Layout> | |
) | |
export default IndexPage | |
export const query = graphql` | |
query HomePageQuery { | |
wpPage(title: { eq: "Home" }) { | |
id | |
featuredImage { | |
node { | |
localFile { | |
childImageSharp { | |
ogImg: resize( | |
cropFocus: ATTENTION | |
height: 630 | |
width: 1200 | |
quality: 90 | |
) { | |
src | |
} | |
twitterImg: resize( | |
cropFocus: ATTENTION | |
height: 120 | |
width: 120 | |
quality: 90 | |
) { | |
src | |
} | |
} | |
} | |
} | |
} | |
seo { | |
title | |
metaDesc | |
canonical | |
} | |
schemaMarkup { | |
schemaMarkup | |
} | |
} | |
} | |
` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment