Skip to content

Commit

Permalink
Add featured-image
Browse files Browse the repository at this point in the history
  • Loading branch information
smetzdev committed May 6, 2021
1 parent 1bc0490 commit 82ddc5c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/templates/post.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import * as React from "react"
import { Link, graphql } from "gatsby"
import { StaticImage } from "gatsby-plugin-image"
import { graphql } from "gatsby"
import { GatsbyImage } from "gatsby-plugin-image"

import Layout from "../components/layout"
import Seo from "../components/seo"

const IndexPage = ({ data }) => {
const featuredImage = data.wpPost.featuredImage?.node?.localFile
return (
<Layout>
<Seo title="Home" />
<GatsbyImage image={featuredImage.childImageSharp.gatsbyImageData} />
<h1>{data.wpPost.title}</h1>
<section dangerouslySetInnerHTML={{ __html: data.wpPost.content }} />
</Layout>
Expand All @@ -20,6 +22,15 @@ export const query = graphql`
wpPost(id: { eq: $id }) {
title
content
featuredImage {
node {
localFile {
childImageSharp {
gatsbyImageData(layout: FULL_WIDTH)
}
}
}
}
}
}
`
Expand Down

0 comments on commit 82ddc5c

Please sign in to comment.