mirror of
https://github.com/jxnblk/mdx-deck.git
synced 2024-09-11 06:35:24 +03:00
Remove title resolver from gatsby theme
This commit is contained in:
parent
bc890e6fcd
commit
961fd03e53
@ -4,3 +4,12 @@
|
||||
---
|
||||
|
||||
## Boop bop
|
||||
|
||||
---
|
||||
|
||||
Does HMR break with this change?
|
||||
|
||||
---
|
||||
|
||||
Adding another slide...
|
||||
|
||||
|
@ -1,6 +0,0 @@
|
||||
|
||||
This deck does not have any headings
|
||||
|
||||
---
|
||||
|
||||
Which means the resolver won't get a title
|
@ -43,12 +43,6 @@ const mdxResolverPassthrough = fieldName => async (
|
||||
return result
|
||||
}
|
||||
|
||||
const resolveTitle = async (...args) => {
|
||||
const headings = await mdxResolverPassthrough('headings')(...args)
|
||||
const [first = {}] = headings
|
||||
return first.value || ''
|
||||
}
|
||||
|
||||
exports.sourceNodes = ({ actions, schema }) => {
|
||||
const { createTypes } = actions
|
||||
createTypes(
|
||||
@ -59,10 +53,6 @@ exports.sourceNodes = ({ actions, schema }) => {
|
||||
slug: {
|
||||
type: `String!`,
|
||||
},
|
||||
title: {
|
||||
type: `String!`,
|
||||
resolve: resolveTitle,
|
||||
},
|
||||
body: {
|
||||
type: `String!`,
|
||||
resolve: mdxResolverPassthrough(`body`),
|
||||
@ -83,7 +73,6 @@ exports.createPages = async ({ graphql, actions, reporter, pathPrefix }) => {
|
||||
node {
|
||||
id
|
||||
slug
|
||||
title
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ const DefaultMode = ({ children }) => <React.Fragment children={children} />
|
||||
|
||||
export default ({
|
||||
slides = [],
|
||||
pageContext: { title, slug },
|
||||
pageContext: { slug },
|
||||
theme = {},
|
||||
themes = [],
|
||||
...props
|
||||
@ -112,7 +112,6 @@ export default ({
|
||||
return (
|
||||
<>
|
||||
<Helmet>
|
||||
<title>{title}</title>
|
||||
{head}
|
||||
</Helmet>
|
||||
<GoogleFont theme={mergedTheme} />
|
||||
|
@ -31,7 +31,7 @@ export default ({ decks }) => {
|
||||
textDecoration: 'underline',
|
||||
},
|
||||
}}>
|
||||
{d.title || d.slug}
|
||||
{d.slug}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
|
Loading…
Reference in New Issue
Block a user