URL in repeatable zone not showing URL address if as Document

Hello,

we use Prismic with Nuxt.js.

We created a multi-level menu with a Link to a document option. The main link works fine, however, the sub-link doesn't seem to have a URL attached to it.

We have a slice. Inside the slice, we have a non-repeatable zone with a Link field and a repeatable zone with a Link field.

The problem is, we can not get URLs from repeatable items with Link to a document option. Link to a web works fine with any zone.

If the field is non-repeatable, it seems ok. We can get it with primary.url.url

  "primary": {
    "title": "Our Platform",
    "identify": "platform",
    "url": {
      "id": "YynWjhEAACIAciRx",
      "type": "ourplatform",
      "tags": [],
      "lang": "en-gb",
      "slug": "our-platform",
      "first_publication_date": "2022-09-20T15:04:50+0000",
      "last_publication_date": "2022-09-30T12:57:58+0000",
      "url": "/platform",
      "link_type": "Document",
      "isBroken": false
    }
  }

but in repeatable, the URL is missing

  "items": [
    {
      "subNavTitle": "Online Manufacturing Services",
      "subNavUrl": {
        "id": "YzchKxEAACIArdoT",
        "type": "onlinemanufacturingservices",
        "tags": [],
        "lang": "en-gb",
        "slug": "online-manufacturing-services",
        "first_publication_date": "2022-09-30T17:04:09+0000",
        "last_publication_date": "2022-10-18T21:10:16+0000",
        "link_type": "Document",
        "isBroken": false
      }
    },
]

How can we get the URL from a repeatable field if it's a Link to a document?

Thank you

Hey Stephen,

It sounds like you need to generate the link using link resolver or route resolver.

Prismic gives you the information for you to build your routes/document linking from within Nuxt.

What is the model for your custom type onlinemanufacturingservices ?

What is an example of the routes you want for these sub links?

// link-resolver
export default function (doc) {
    if (doc.type === 'onlinemanufacturingservices') {
        return `/${doc.slug}/`
    }
...
1 Like

Hello Jake,

I wasn't aware this was generated on our side. We solved the issue in our Nuxt config file.

Thank you for your help.

1 Like