updated workkflow and implemented sanity
This commit is contained in:
parent
91ad452247
commit
7ccd7e5b8c
@ -1,5 +1,8 @@
|
|||||||
name: Node.js CI
|
name: Node.js CI
|
||||||
on: [push]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
jobs:
|
jobs:
|
||||||
build_app:
|
build_app:
|
||||||
|
|
||||||
|
@ -1 +1,28 @@
|
|||||||
<h1>Blog style learnings description.</h1>
|
<script>
|
||||||
|
import { client } from '/src/utils/sanity/client.js'
|
||||||
|
|
||||||
|
// Fetch content with GROQ
|
||||||
|
async function getContent() {
|
||||||
|
const CONTENT_QUERY = `*[_type == "project"] {
|
||||||
|
...,
|
||||||
|
coverImage {
|
||||||
|
...,
|
||||||
|
asset->
|
||||||
|
},
|
||||||
|
duration {
|
||||||
|
...
|
||||||
|
},
|
||||||
|
tags[],
|
||||||
|
body
|
||||||
|
}
|
||||||
|
`
|
||||||
|
const content = await client.fetch(CONTENT_QUERY)
|
||||||
|
return content
|
||||||
|
}
|
||||||
|
const posts = getContent();
|
||||||
|
// Log content to console
|
||||||
|
getContent().then(content => console.log(content))
|
||||||
|
|
||||||
|
// Insert the return component calling `getContent()` below
|
||||||
|
</script>
|
||||||
|
<p>{posts.title}</p>
|
9
src/utils/sanity/client.js
Normal file
9
src/utils/sanity/client.js
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
import { createClient } from "@sanity/client"
|
||||||
|
|
||||||
|
export const client = createClient({
|
||||||
|
projectId: "f4465sc9",
|
||||||
|
dataset: "production",
|
||||||
|
apiVersion: "2024-03-11",
|
||||||
|
// Set to `true` for production environments
|
||||||
|
useCdn: false,
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user