updated workkflow and implemented sanity

This commit is contained in:
christian 2024-04-27 19:17:49 +02:00
parent 91ad452247
commit 7ccd7e5b8c
3 changed files with 41 additions and 2 deletions

View File

@ -1,5 +1,8 @@
name: Node.js CI
on: [push]
on:
push:
branches:
- 'main'
jobs:
build_app:

View File

@ -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>

View 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,
})