👀 See Sanity in action: Watch product demo now →

I’m trying to create textual documents which can have inline references to other such textual documents.

5 replies
Last updated: Sep 10, 2020
Hi! I’m new here, new to Sanity and would like to get some help.I’m trying to create textual documents which can have inline references to other such textual documents. What I managed to do so far is to insert a reference, but as a separate block, not inline.

Would it be possible to insert a reference to another document inline?
Sep 10, 2020, 8:35 AM
If i understand correctly, instead of making a reference, you need to add the field as
type: 'your-other-document'
this will load the document fields inside your document.
Sep 10, 2020, 8:49 AM
user H
Thank you for the quick response.Unfortunately, I’m not sure I understand what you mean.
I am happy with references, I don’t want to load the whole content of the other document, its name is enough. I would like to be able to insert such a reference in the editor as an inline element, part of the text block.
Like:
The sun is a mid sized star in our
SOLAR_SYSTEM
. It has 8 planets, including
EARTH
.In this example, the highlights are references, inserted from a given collection.
Sep 10, 2020, 9:00 AM
I was thinking about using annotations as well, but it requires to select some text first, which is against the use case. So, inserting would be much better.
Sep 10, 2020, 9:00 AM
https://www.sanity.io/docs/block-type#example-schema-block-array-with-custom-types-OFzEUqst you should add it under the
of
key in the block type object to make it inline
Sep 10, 2020, 9:17 AM
That’s it! thank you!
Sep 10, 2020, 9:19 AM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in