mirror of
https://github.com/jxnblk/mdx-deck.git
synced 2024-09-11 06:35:24 +03:00
Edit gatsby theme
This commit is contained in:
parent
b839e11b3b
commit
dc7760e5fe
@ -8,3 +8,4 @@
|
||||
---
|
||||
|
||||
HMR *should* work now
|
||||
|
||||
|
@ -43,6 +43,12 @@ const mdxResolverPassthrough = fieldName => async (
|
||||
return result
|
||||
}
|
||||
|
||||
const resolveTitle = async (...args) => {
|
||||
const headings = await mdxResolverPassthrough('headings')(...args)
|
||||
const [first = {}] = headings
|
||||
return first.value || ''
|
||||
}
|
||||
|
||||
exports.createSchemaCustomization = ({ actions, schema }) => {
|
||||
actions.createTypes(
|
||||
schema.buildObjectType({
|
||||
@ -52,6 +58,10 @@ exports.createSchemaCustomization = ({ actions, schema }) => {
|
||||
slug: {
|
||||
type: `String!`,
|
||||
},
|
||||
title: {
|
||||
type: 'String!',
|
||||
resolve: resolveTitle,
|
||||
},
|
||||
body: {
|
||||
type: `String!`,
|
||||
resolve: mdxResolverPassthrough(`body`),
|
||||
@ -72,6 +82,7 @@ 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: { slug },
|
||||
pageContext: { title, slug },
|
||||
theme = {},
|
||||
themes = [],
|
||||
...props
|
||||
@ -112,6 +112,7 @@ export default ({
|
||||
return (
|
||||
<>
|
||||
<Helmet>
|
||||
{title && <title>{title}</title>}
|
||||
{head}
|
||||
</Helmet>
|
||||
<GoogleFont theme={mergedTheme} />
|
||||
|
@ -9,6 +9,7 @@ export const pageQuery = graphql`
|
||||
deck: deck(id: { eq: $id }) {
|
||||
id
|
||||
body
|
||||
title
|
||||
}
|
||||
}
|
||||
`
|
||||
|
Loading…
Reference in New Issue
Block a user