-
-
Notifications
You must be signed in to change notification settings - Fork 4
Sanity #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sanity #145
Changes from all commits
e1d2721
51141c0
4d94451
7c10419
ab490fc
edf62b2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,27 +30,27 @@ export default async function BlogPage({ | |
| *[_type == "post" && defined(slug.current)] | ||
| | order(publishedAt desc) { | ||
| _id, | ||
| "title": coalesce(title[$locale], title.en, title), | ||
| "title": coalesce(title[$locale], title[lower($locale)], title.uk, title.en, title.pl, title), | ||
| slug, | ||
| publishedAt, | ||
| tags, | ||
| resourceLink, | ||
|
|
||
| "categories": categories[]->title, | ||
|
|
||
| "body": coalesce(body[$locale], body.en, body)[]{ | ||
| "body": coalesce(body[$locale], body[lower($locale)], body.uk, body.en, body.pl, body)[]{ | ||
| ..., | ||
| children[]{ | ||
| text | ||
| } | ||
| }, | ||
| "mainImage": mainImage.asset->url, | ||
| "author": author->{ | ||
| "name": coalesce(name[$locale], name.en, name), | ||
| "company": coalesce(company[$locale], company.en, company), | ||
| "jobTitle": coalesce(jobTitle[$locale], jobTitle.en, jobTitle), | ||
| "city": coalesce(city[$locale], city.en, city), | ||
| "bio": coalesce(bio[$locale], bio.en, bio), | ||
| "name": coalesce(name[$locale], name[lower($locale)], name.uk, name.en, name.pl, name), | ||
| "company": coalesce(company[$locale], company[lower($locale)], company.uk, company.en, company.pl, company), | ||
| "jobTitle": coalesce(jobTitle[$locale], jobTitle[lower($locale)], jobTitle.uk, jobTitle.en, jobTitle.pl, jobTitle), | ||
| "city": coalesce(city[$locale], city[lower($locale)], city.uk, city.en, city.pl, city), | ||
| "bio": coalesce(bio[$locale], bio[lower($locale)], bio.uk, bio.en, bio.pl, bio), | ||
| "image": image.asset->url, | ||
| socialMedia[]{ | ||
| _key, | ||
|
|
@@ -62,11 +62,27 @@ export default async function BlogPage({ | |
| `, | ||
| { locale } | ||
| ); | ||
| const categories = await client.fetch( | ||
| groq` | ||
| *[_type == "category"] | order(orderRank asc) { | ||
| _id, | ||
| title | ||
| } | ||
| ` | ||
| ); | ||
|
Comment on lines
+65
to
+72
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Categories query lacks locale-aware title projection. The categories query fetches raw 🛠️ Suggested fix const categories = await client.fetch(
groq`
*[_type == "category"] | order(orderRank asc) {
_id,
- title
+ "title": coalesce(title[$locale], title[lower($locale)], title.uk, title.en, title.pl, title)
}
- `
+ `,
+ { locale }
);🤖 Prompt for AI Agents |
||
| const featuredPost = posts?.[0]; | ||
|
|
||
| return ( | ||
| <main className="max-w-6xl mx-auto px-6 py-12"> | ||
| <h1 className="text-4xl font-bold mb-10 text-center">{t('title')}</h1> | ||
| <BlogFilters posts={posts} /> | ||
| <h1 className="text-4xl font-bold mb-4 text-center">{t('title')}</h1> | ||
| <p className="mx-auto max-w-2xl text-center text-base text-gray-500 dark:text-gray-400"> | ||
| {t('subtitle')} | ||
| </p> | ||
| <BlogFilters | ||
| posts={posts} | ||
| categories={categories} | ||
| featuredPost={featuredPost} | ||
| /> | ||
| </main> | ||
| ); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the page locale when formatting dates.
toLocaleDateString()without a locale uses the server default and can mismatch the blog locale. Passlocalein both places.💡 Suggested fix
Also applies to: 257-260
🤖 Prompt for AI Agents