VirtusLab-Open-Source / strapi-plugin-navigation

A plugin for Strapi Headless CMS that provides navigation / menu builder feature with their possibility to control the audience and different output structure renderers like (flat, tree and RFR - ready for handling by Redux First Router)
MIT License
318 stars 58 forks source link

Adding relation to navigation items in another collection #340

Closed dmarkbreiter closed 1 year ago

dmarkbreiter commented 1 year ago

I'm trying to relate a page in a Pages collection to to a navigation item in crated from the navigation plugin. To do so, I added the following code to my Pages collection's schema.json:

    "navigation": {
      "type": "relation",
      "relation": "oneToOne",
      "target": "plugin::navigation.navigation-item"
    }

Which allows the user to select nodes from the navigation plugin (see photo) Screen Shot 2023-05-21 at 10 14 44 AM

The issue is when I query my pages collection, the navigation relation does not show up, even after giving Public users access to the navigation plugin and making sure to use populate=*

Ideally, I'd like to be able to relate to nodes in a navigation container and have the pages api return with at least the path of the navigation item. Is this possible?

cyp3rius commented 1 year ago

Hello @dmarkbreiter, its not the way how navigation plugin works. Please follow the manual and setup Collections which you want to use via the configuration page and create the structure using built-in editor.