mirror of
https://github.com/UiO-Gaming/uiogaming.no.git
synced 2026-11-05 13:56:47 +01:00
add event placeholder pages
This commit is contained in:
2 files changed
+33
No files matched your search
@@ -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,
|
||||
},
|
||||
})
|
||||
})
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import * as React from "react"
|
||||
|
||||
const Event = () => {
|
||||
return (
|
||||
<div>
|
||||
<p>Ingenting å se her... enda</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default Event
|
||||
Reference in new issue
Block a user