Name of content logic?

Hello!

Where does the ‘name’ of the content come from in the content grid?

It seems to be sourced from the Title content field, but if there is no title then it will look for the first heading field in the Rich Text field.

This logic makes sense, however the logic seems to ignore the Key Text field.

e.g. I’m using the key text field for my article titles, since it is searchable, and I have this field as the first field in my custom type. However this field is not being used for the article name in the content grid. It overlooks this and tries to grab something from the rich text block, which makes locating the article very difficult : )

I’ve had to temporarily resort to adding another title field (the normal title field) above the key text field, just so it appears on the content grid correctly. Even though this title field wont be used, since I’m only using the key text.

What would you recommend we do here, to be able to not use the large title field.

Hello Tim,

When naming a document Prismic first looks for a heading somewhere in your document, if there is no heading then it uses the first text string it can find, for example in a UID, Rich Text, and Key Text fields, but also uses the Date, Timestamp, Color, Number, Select, and Embed and fields. So because you have a heading in your page it takes priority.

What you can do, as you do have some control of which field these it chooses, is set the default document name field in the JSON. This article shows you how.

Let me know if you have any more questions about this or anything else.

Thanks.

1 Like

Hey Phil,

Thats awesome!

Exactly what I was looking for : )

I just implemented it into all of my custom types, and it works perfectly.
Now I can keep using Key Text :stuck_out_tongue:

Have a great day!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.