David Witt
Developer advocate, front-end engineer, dubious philosopher
Get all content that references the current document
*[_type == "post" && slug.current == $slug][0] {
...,
"backlinks": *[references(^._id) && isVisible == true]{
title,
_type,
slug,
description,
}
}
Backlinks are a way to show a document that links to the current document. All links in Sanity are bidirectional in nature, but surfacing these links through GROQ is not super duper obvious.
GROQ has a valuable ^ operator that refers to the enclosing document.
This allows you to use the current document's values in a child query. In this example, documents can link to each other via an Internal Link. These links are queryable with the references() function.
Check out the Space Madness docs to see backlinks in action.
Developer advocate, front-end engineer, dubious philosopher
Search documents that are tagged with at least one of these tag slugs
Go to Filter Content by Multiple TagsContent operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store