fixed queries?

This commit is contained in:
ChrQR 2024-04-27 21:24:58 +02:00
parent dc8baf8d18
commit ec0e91fcfa
3 changed files with 25 additions and 17 deletions

View File

@ -3,17 +3,25 @@
* As your schema evolves, this pattern will be useful to keep your data in sync across all surfaces. * As your schema evolves, this pattern will be useful to keep your data in sync across all surfaces.
*/ */
export function getPostsQuery(extraFilter) { export function getPostsQuery(extraFilter) {
return /* groq */ `*[ return `*[_type == "project"] {
_type == "post" && _id,
publishedAt < now() _type,
${extraFilter ? `&& ${extraFilter}` : ''} _createdAt,
] | order(publishedAt desc) { _updatedAt,
title, title,
slug, slug,
coverImage, coverImage {
_createdAt, ...,
_updatedAt, asset->
body, },
duration {
start,
end
},
client,
site,
tags[],
body
}` }`
} }
@ -24,10 +32,11 @@ export function getPostsQuery(extraFilter) {
* In this case, we're defining that, to render an author card, we need their name, slug & image. * In this case, we're defining that, to render an author card, we need their name, slug & image.
*/ */
export const POST_CARD_FRAGMENT = ` export const POST_CARD_FRAGMENT = `
title, _id,
slug, _type,
coverImage,
_createdAt, _createdAt,
_updatedAt, _updatedAt,
body, title,
slug,
coverImage
` `

View File

@ -10,7 +10,7 @@
<p class="">I live in Copenhagen with my partner and children near the water. We love going on expeditions around the city in our cargo bike, or on my electrical skateboard. <p class="">I live in Copenhagen with my partner and children near the water. We love going on expeditions around the city in our cargo bike, or on my electrical skateboard.
When we're not outside I spend a lot of time fiddling around with my homelab, and development projects. You can read more about my projects and homelab under the homelab and portfolio nav. When we're not outside I spend a lot of time fiddling around with my homelab, and development projects. You can read more about my projects and homelab under the homelab and portfolio nav.
</p> </p>
<img class="rounded-2xl xl:ml-4 md:w-auto md:h-52 md:ml-0 md:mt-4 sm:ml-0 sm:mt-4 sm:w-full" src={migImg} alt="crazy man"/> <img class="rounded-2xl xl:ml-4 md:w-auto md:h-52 md:ml-4 md:mt-4 sm:ml-0 sm:mt-4 sm:w-full" src={migImg} alt="crazy man"/>
</div> </div>
<p class="mb-4 ">I work in recruitment, and I specialise in building product teams for start ups and scale ups for a small recruitment agency called <a class="underline font-semibold" href="https://www.adveniopeople.com">Advenio People</a></p> <p class="mb-4 ">I work in recruitment, and I specialise in building product teams for start ups and scale ups for a small recruitment agency called <a class="underline font-semibold" href="https://www.adveniopeople.com">Advenio People</a></p>
<img src={osImg} alt="A happy man and a beautiful woman both wearing facemasks." class="rounded-full w-1/2 h-auto m-auto"> <img src={osImg} alt="A happy man and a beautiful woman both wearing facemasks." class="rounded-full w-1/2 h-auto m-auto">

View File

@ -1,5 +1,4 @@
<script> <script>
export let data; export let data;
</script> </script>
<p>{data.posts}</p> <p>{data.posts}</p>