Knut Melvær
Knut runs developer relations at Sanity.io
Knut is located at Oslo, Norway
This can be used for blogs or articles where you want to possibly display next and previous article buttons
*[_type == "post" && slug.current == $slug]{
"currentPost": {
title
},
"previousPost": *[_type == "post" && ^.publishedAt > publishedAt]|order(publishedAt desc)[0]{title,"slug": slug.current},
"nextPost": *[_type == "post" && ^.publishedAt < publishedAt]|order(publishedAt asc)[0]{title,"slug": slug.current},
"morePosts": *[_type == "post" && slug.current != $slug] | order(publishedAt desc, _updatedAt desc)[0...3] {
${postFields}
}
}|order(publishedAt)[0]
Knut runs developer relations at Sanity.io
How to automatically generate linked headings with a custom serializer
Go to Anchored Headings for Portable TextMigration script to convert plain text to block content across your content lake
Go to Migrate plain text field to Portable TextSimple content type for a question and answer pattern
Go to Frequently asked questionsSchemas for adding richer quotes within Portable Text
Go to Rich quotations in Portable Text