add event placeholder pages

This commit is contained in:
LBlend committed 2021-07-21 02:16:15 +02:00
1 parent 52cc2498cb
commit 48a1e4a844
2 files changed
+33

No files matched your search

+22
View File
@@ -3,6 +3,7 @@ const path = require("path")
module.exports.createPages = async ({ graphql, actions }) => {
const { createPage } = actions
const blogTemplate = path.resolve("./src/components/blogPost.js")
const eventTemplate = path.resolve("./src/components/event.js")
const result = await graphql(`
query {
allSanityPost {
@@ -13,6 +14,14 @@ module.exports.createPages = async ({ graphql, actions }) => {
}
}
}
allSanityEvent {
nodes {
_id
slug {
current
}
}
}
}
`)
@@ -28,4 +37,17 @@ module.exports.createPages = async ({ graphql, actions }) => {
},
})
})
const events = result.data.allSanityEvent.nodes
events.forEach(event => {
const path = `/event/${event.slug.current}`
createPage({
path,
component: eventTemplate,
context: {
id: event._id,
},
})
})
}
+11
View File
@@ -0,0 +1,11 @@
import * as React from "react"
const Event = () => {
return (
<div>
<p>Ingenting å se her... enda</p>
</div>
)
}
export default Event