Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Commit

Permalink
build(gatsby): rm 'overview' resolver + update queries to new resolvers
Browse files Browse the repository at this point in the history
  • Loading branch information
CanRau committed Apr 22, 2019
1 parent e13ed54 commit 87c00e5
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 76 deletions.
14 changes: 0 additions & 14 deletions gatsby/createResolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,6 @@ module.exports = store =>
return newer && newer.id ? newer : null
},
},
overview: {
type: `JavascriptFrontmatter`,
resolve(source, _, { nodeModel }) {
const result = nodeModel.getAllNodes({
type: `JavascriptFrontmatter`,
})
const overview = result.find(
n =>
n.frontmatter.layout === `BlogPage` &&
n.fields.lang === source.frontmatter.lang
)
return overview && overview.id ? overview : null
},
},
},
})
}
134 changes: 72 additions & 62 deletions src/templates/BlogPost.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@ import PodcastPlayer from '@components/PodcastPlayer'
import { colors, fontFamilies, gradients, media } from '@src/theme'

const BlogPost = props => {
const { page: post, BlogPost, NewsTicker, PodcastPlayerMeta } = props.data

const {
page: post,
BlogPost,
BlogPage,
NewsTicker,
PodcastPlayerMeta,
} = props.data
const { newer, older } = post
return (
<MainLayout {...props}>
<Head
Expand Down Expand Up @@ -158,7 +164,7 @@ const BlogPost = props => {
background: #fff;
`}
>
{[`older`, `all`, `newer`].map(
{[older, BlogPage, newer].map(
x =>
post.fields[x]?.url && (
<div
Expand Down Expand Up @@ -232,26 +238,43 @@ export const query = graphql`
}
}
BlogPage: javascriptFrontmatter(
frontmatter: { layout: { eq: "BlogPage" } }
fields: { lang: { eq: $lang } }
) {
frontmatter {
title
}
fields {
url
}
}
page: mdx(fields: { type: { eq: "post" }, url: { eq: $url } }) {
suggested(count: 3) {
excerpt(pruneLength: 135)
fields {
url
code {
body
}
frontmatter {
title
#subtitle
#id
#oldId
#slug
lang
summary
#tweet_id
cover {
publicURL
}
frontmatter {
id
title
lang
slug
summary
cover {
podcast {
audio
video
}
video {
url
thumbnail {
image: childImageSharp {
fluid(
maxWidth: 400
maxHeight: 230
quality: 75
cropFocus: ENTROPY
) {
fluid(maxWidth: 760, quality: 75, cropFocus: ENTROPY) {
...GatsbyImageSharpFluid
}
}
Expand All @@ -274,55 +297,42 @@ export const query = graphql`
slug
}
}
newer {
frontmatter {
title
}
fields {
url
}
}
all {
frontmatter {
title
}
fields {
url
}
}
newer {
frontmatter {
title
}
older {
frontmatter {
title
}
fields {
url
}
fields {
url
}
}
code {
body
}
frontmatter {
title
#subtitle
#id
#oldId
#slug
lang
summary
#tweet_id
cover {
publicURL
older {
frontmatter {
title
}
podcast {
audio
video
fields {
url
}
video {
}
suggested(count: 3) {
excerpt(pruneLength: 135)
fields {
url
thumbnail {
}
frontmatter {
id
title
lang
slug
summary
cover {
image: childImageSharp {
fluid(maxWidth: 760, quality: 75, cropFocus: ENTROPY) {
fluid(
maxWidth: 400
maxHeight: 230
quality: 75
cropFocus: ENTROPY
) {
...GatsbyImageSharpFluid
}
}
Expand Down

0 comments on commit 87c00e5

Please sign in to comment.