-
Notifications
You must be signed in to change notification settings - Fork 39
/
sanity.query.ts
102 lines (93 loc) · 1.8 KB
/
sanity.query.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { groq } from "next-sanity";
// Reusable post fields
const postField = groq`
_id,
_createdAt,
title,
"slug": slug.current,
description,
coverImage {
"image": asset->url,
"lqip": asset->metadata.lqip,
alt,
},
featured,
isPublished
`;
export const profileQuery = groq`*[_type == "profile"]{
_id,
fullName,
headline,
profileImage {
"image": asset->url,
"lqip": asset->metadata.lqip,
alt,
},
shortBio,
location,
fullBio,
email,
"resumeURL": resumeURL.asset->url,
socialLinks,
usage
}`;
export const jobQuery = groq`*[_type == "job"] | order(_createdAt desc){
_id,
name,
jobTitle,
"logo": logo.asset->url,
url,
description,
startDate,
endDate,
}`;
export const projectsQuery = groq`*[_type == "project"] | order(_createdAt desc){
_id,
name,
"slug": slug.current,
tagline,
"logo": logo.asset->url,
}`;
export const singleProjectQuery = groq`*[_type == "project" && slug.current == $slug][0]{
_id,
name,
projectUrl,
repository,
coverImage {
"image": asset->url,
"lqip": asset->metadata.lqip,
alt,
},
tagline,
description
}`;
export const postsQuery = groq`*[_type == "Post"] | order(_createdAt desc){
${postField},
date,
"author": author-> {
name,
photo,
twitterUrl
},
body,
}`;
export const featuredPostsQuery = groq`*[_type == "Post" && featured == true] | order(_createdAt desc) {
${postField}
}`;
export const singlePostQuery = groq`*[_type == "Post" && slug.current == $slug][0]{
${postField},
_updatedAt,
canonicalLink,
date,
tags,
"author": author-> {
name,
photo {
"image": asset->url,
alt
},
twitterUrl
},
body,
}`;
export const heroesQuery = groq`*[_type == "heroe"] | order(_createdAt asc) { _id, _createdAt, name, url, met }`;