What accessible properties are available on the route resolver

I'm referencing this page for the link resolver: Template Content with Vue.js - Prismic

And also this page for the route resolver: Developer Documentation - Prismic

On the link resolver, there are options to define rules using id, uid, type, etc.

What properties can be used on the route resolver? Is it just type?

There's a table of available properties, if that's what you mean?

  • doc.id
  • doc.uid
  • doc.type
  • doc.tags
  • doc.lang
  • doc.isBroken

Yep, that's exactly what I mean. But when I use for example id in a route resolver I just get an error

Could you share some examples of your code?

Sure.

In my nuxt.config.js This works:

modules: [
    '@nuxtjs/style-resources',
    [
      "@nuxtjs/prismic", {
        "endpoint": "https://ventur.cdn.prismic.io/api/v2",
        "apiOptions": {
          "routes": [
            {
              "type": "page",
              "path": "/:uid"
            },
            {
              "type": "case_study",
              "path": "/experience/:uid"
            },
            {
              "type": "blog_post",
              "path": "/insights/:uid"
            }
          ]
        }
      }
    ],
    ["nuxt-sm"]
  ],

But if I add the following lines, this doesn't work:

modules: [
    '@nuxtjs/style-resources',
    [
      "@nuxtjs/prismic", {
        "endpoint": "https://ventur.cdn.prismic.io/api/v2",
        "apiOptions": {
          "routes": [
            {
              "type": "page",
              "path": "/:uid"
            },
            {
              "uid": "meet-the-team",
              "path": "/:uid"
            },
            {
              "type": "case_study",
              "path": "/experience/:uid"
            },
            {
              "type": "blog_post",
              "path": "/insights/:uid"
            }
          ]
        }
      }
    ],
    ["nuxt-sm"]
  ],

I get the error:

Error
Unexpected status code [400] on URL https://ventur.cdn.prismic.io/api/v2/documents/search?routes=%5B%7B%22type%22%3A%22page%22%2C%22path%22%3A%22%2F%3Auid%22%7D%2C%7B%22uid%22%3A%22meet-the-team%22%2C%22path%22%3A%22%2F%3Auid%22%7D%2C%7B%22type%22%3A%22case_study%22%2C%22path%22%3A%22%2Fexperience%2F%3Auid%22%7D%2C%7B%22type%22%3A%22blog_post%22%2C%22path%22%3A%22%2Finsights%2F%3Auid%22%7D%5D&page=1&pageSize=1&ref=X7JN2xIAACEAndh_&q=%5B%5Bat(document.type%2C%20%22header_menu%22)%5D%5D

Hi Sel,

For the moment the route resolver only has access to the type property, as this is our first implementation of the route resolver we are open to suggestions as to which properties you would like to see. I will then pass these on a feature requests to the Slicemachine team.

For now the best thing to do if you want use the properties listed above is to also use a link resolver in your project.

The documentation explains which resolver takes priority and it's fall back:

It also seem you weren't a Slicemachine group for the route resolver. Priyanka is moving you there now.

For any future users: You must be using Slicemachine to use the Route Resolver.

1 Like

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.