Query for indexing posts on landing page
This commit is contained in:
@@ -11,7 +11,7 @@ import '../styles/custom.css'
|
|||||||
const Layout = ({ children, data }) => (
|
const Layout = ({ children, data }) => (
|
||||||
<div className="font-sans mx-auto">
|
<div className="font-sans mx-auto">
|
||||||
<Helmet
|
<Helmet
|
||||||
title={data.site.siteMetadata.title}
|
title="Saburly"
|
||||||
meta={[
|
meta={[
|
||||||
{ name: 'description', content: 'We code & design great software' },
|
{ name: 'description', content: 'We code & design great software' },
|
||||||
{
|
{
|
||||||
@@ -34,13 +34,3 @@ Layout.propTypes = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default Layout
|
export default Layout
|
||||||
|
|
||||||
export const query = graphql`
|
|
||||||
query SiteTitleQuery {
|
|
||||||
site {
|
|
||||||
siteMetadata {
|
|
||||||
title
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import LogoRicoh from '../images/logo-ricoh-color.svg'
|
|||||||
import LogoKinnarps from '../images/logo-kinnarps-color.svg'
|
import LogoKinnarps from '../images/logo-kinnarps-color.svg'
|
||||||
import LogoCoor from '../images/logo-coor-color.svg'
|
import LogoCoor from '../images/logo-coor-color.svg'
|
||||||
|
|
||||||
const IndexPage = () => (
|
const IndexPage = ({ ...props }) => (
|
||||||
<main>
|
<main>
|
||||||
<section className="bg-saburly-indigo relative">
|
<section className="bg-saburly-indigo relative">
|
||||||
<div className="container mx-auto flex lg:flex-row flex-col flex-col-reverse p-4">
|
<div className="container mx-auto flex lg:flex-row flex-col flex-col-reverse p-4">
|
||||||
@@ -148,8 +148,22 @@ const IndexPage = () => (
|
|||||||
headline="But occasionally we find the time to have fun and publish stuff"
|
headline="But occasionally we find the time to have fun and publish stuff"
|
||||||
/>
|
/>
|
||||||
<div className="lg:flex justify-center mt-8">
|
<div className="lg:flex justify-center mt-8">
|
||||||
<Card />
|
{props.data.allWordpressPost.edges.map(({ node }) => (
|
||||||
<Card />
|
<div className="md:w-1/2 p-2">
|
||||||
|
<Card
|
||||||
|
key={node.id}
|
||||||
|
url={`blog/${node.slug}`}
|
||||||
|
title={node.title}
|
||||||
|
date={node.date}
|
||||||
|
excerpt={node.excerpt}
|
||||||
|
image={
|
||||||
|
node.featured_media
|
||||||
|
? node.featured_media.localFile.childImageSharp.resolutions
|
||||||
|
: undefined
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
))}
|
||||||
</div>
|
</div>
|
||||||
<Button
|
<Button
|
||||||
standard
|
standard
|
||||||
@@ -161,4 +175,32 @@ const IndexPage = () => (
|
|||||||
</main>
|
</main>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
export const query = graphql`
|
||||||
|
query indexPostsQuery {
|
||||||
|
allWordpressPost {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
id
|
||||||
|
title
|
||||||
|
excerpt
|
||||||
|
status
|
||||||
|
slug
|
||||||
|
date(formatString: "MMMM DD, YYYY")
|
||||||
|
featured_media {
|
||||||
|
localFile {
|
||||||
|
childImageSharp {
|
||||||
|
resolutions(width: 600, height: 300) {
|
||||||
|
src
|
||||||
|
width
|
||||||
|
height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
export default IndexPage
|
export default IndexPage
|
||||||
|
|||||||
Reference in New Issue
Block a user