Remi Sture
Frontend lead @ Eviny.no
Remi is located at Kleppestø, Norway
Ever wondered where and if your content types are used?
*[_type in $documentTypes && language in $languages && count(sections[_type in $objectTypes]) > 0]{
_type,
"lang": language,
"slug": language + "/" + slug.current,
"sections": sections[_type in $objectTypes]{
_type,
"name": coalesce(title, name, heading),
"content": coalesce(pt::text(content), pt::text(lead)),
},
"hits": count(sections[_type in $objectTypes])
} | order(hits desc, slug asc)[$limitStart...$limitEnd]
{
documentTypes: ['page', 'article'],
languages: ['nb', 'en'],
objectTypes: ['map', 'accordion'],
limitStart: 0,
limitEnd: 10,
}
[
{
"_type": "page",
"hits": 4,
"lang": "nb",
"sections": [
{
"_type": "accordion",
"content": "Content 1",
"name": "Name 1"
},
{
"_type": "accordion",
"content": "Content 2",
"name": "Name 2"
},
{
"_type": "map",
"content": "Content 3",
"name": "Name 3"
},
{
"_type": "accordion",
"content": "Content 4",
"name": "Name 4"
},
],
"slug": "nb/my-slug-1"
},
{
"_type": "article",
"hits": 2,
"lang": "en",
"sections": [
{
"_type": "map",
"content": "Content 5",
"name": "Name 5"
},
{
"_type": "accordion",
"content": "Content 6",
"name": "Name 6"
},
],
"slug": "en/my-slug-2"
}
]
Frontend lead @ Eviny.no
This snippet can be used to fetch current, previous and next articles based on publication date and related tags.
Go to Get current, previous and next post, filtered by tags