dutchheight / craft-navie

Navigation plugin for Craft CMS 3
Other
2 stars 1 forks source link

Graphql: uri and slug are null #6

Closed magicspon closed 4 years ago

magicspon commented 4 years ago

Heyo..

With the following:

query MyQuery {
  craft {
    listItems(list: "main", level: 1) {
      ... on Craft_mainMenu_List {
        title
        url
        uri
        slug
        children {
          ... on Craft_mainMenu_List {
            title
            url
            uri
            slug
          }
        }
      }
    }
  }
}

I get:

{
  "data": {
    "craft": {
      "listItems": [
        {
          "title": "Page 1",
          "url": "http://gatsby.craft/page1",
          "uri": null,
          "slug": null,
          "children": [
            {
              "title": "Child 1",
              "url": "http://gatsby.craft/page1/child1",
              "uri": null,
              "slug": null
            },
            {
              "title": "Child 2",
              "url": "http://gatsby.craft/page1/child2",
              "uri": null,
              "slug": null
            }
          ]
        }
      ]
    }
  }
}

note, the result is the same, minus "craft" in the craft graphql explorer

I'm using craft in headless mode so ideally i'd just use the uri

any thoughts?

freimutt commented 4 years ago

Hey, could you try out the new version (v.1.2.1). This version wel return the linked uri and slug when provided. If no linked element is present, then null is returned.

magicspon commented 4 years ago

Heyo..

I've updated "all the things".... It's now working as expected...

is there anyway to make uri to start with a /

freimutt commented 4 years ago

Sorry, but that is how Craft returns an uri. So you must do it on your side.