I have a field with a ContentList / Treelist of pages, each one of which I want the URL for.

Using JSS with Next.js.

If I inspect the field in the browser I can see the URL listed for each item as part of its data:

    "id": [etc],
    "url": "/[etc]/Content-Page",
    "name": "Content Page",
    "displayName": "Content Page",
    "fields": {

However, if I use the Item / Item[] type within my code, the Typescript definition for these only has properties for name, display name, and fields.

The code still works fine though if I ignore this error - the URL is there.

Should I be accessing the URL for Content List items in a different way?

I have read this similar question here Getting the URL from items in a ContentList field which gives some options.

I guess my main point is do I need to try something like that or just cast to a different typescript type?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.