Skip to main content
1 of 4

Entity reference field has no title in json

I have a site https://www.huytonweb.com/ the front end is in Next.js and the back end is Drupal 10 CMS. The front end will access the data from the back end using ?_format=json (like https://cms.huytonweb.com/knowledge-base/ecommerce?_format=json) and views and blocks are accessed using the jsonapi mod.

I'm writing the content and think it would be useful for content to reference other content in an <aside>. So, I edit my content type (locally) and add a reference field, I edit my content and add some references and all is great, until I see the json, no title, just ID, UUID and URL! No matter what I do I cannot get a title to appear in the json data for referenced content.

My fallback was to just go through the DOM and get all the links and automatically create an <aside>, but the URL inerHTML may not be the title, so I need a Drupal way to do this.

So, my question is; how do I get a title into the reference field for content?

Any ideas or thoughts would be appreciated