Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
strapi-plugin-navigation
Advanced tools
A plugin for Strapi Headless CMS that provides navigation / menu builder feature with their possibility to control the audience and different output structure renderers:
(Use yarn to install this plugin within your Strapi project (recommended). Install yarn with these docs.)
yarn add strapi-plugin-navigation@latest
Enjoy 🎉
Complete installation requirements are exact same as for Strapi itself and can be found in the documentation under Installation Requirements.
Supported Strapi versions:
(This plugin may work with the older Strapi versions, but these are not tested nor officially supported at this time.)
We recommend always using the latest version of Strapi to start your new projects.
To enable Content Type to work with Navigation Item, you've to add following field to your model *.settings.json
:
"navigation": {
"model": "navigationitem",
"plugin": "navigation",
"via": "related",
"configurable": false,
"hidden": true
}
inside the attributes
section like in example below:
"attributes": {
...,
"navigation": {
"plugin": "navigation",
"collection": "comment",
"via": "related"
},
...
},
To setup the plugin properly we recommend to put following snippet as part of config/custom.js
or config/<env>/custom.js
file. If you've got already configurations for other plugins stores by this way, use just the navigation
part within exising plugins
item.
...
plugins: {
navigation: {
additionalFields: ['audience'], // Additional fields: 'audience', more in the future
excludedContentTypes: ["plugins::", "strapi"], // excluded content types patterns (by default built-in and plugin specific content types)
allowedLevels: 2, // Maximum level for which your're able to mark item as "Menu attached"
},
},
...
{
"id": 1,
"title": "News",
"type": "INTERNAL",
"path": "news",
"externalPath": null,
"uiRouterKey": "News",
"menuAttached": false,
"parent": 8, // Parent Navigation Item 'id', null in case of root level
"master": 1, // Navigation 'id'
"created_at": "2020-09-29T13:29:19.086Z",
"updated_at": "2020-09-29T13:29:19.128Z",
"related": [ <Content Type model > ],
"audience": []
}
{
"title": "News",
"menuAttached": true,
"path": "/news",
"type": "INTERNAL",
"uiRouterKey": "news",
"slug": "benefits",
"external": false,
"related": {
<Content Type model >
},
"items": [
{
"title": "External url",
"menuAttached": true,
"path": "http://example.com",
"type": "EXTERNAL",
"uiRouterKey": "generic",
"external": true
},
< Tree Navigation Item models >
]
}
{
"id": "News",
"title": "News",
"templateName": "pages:1",
"related": {
"contentType": "page",
"collectionName": "pages",
"id": 1
},
"path": "/news",
"slug": "news",
"parent": null, // Parent Navigation Item 'id', null in case of root level
"menuAttached": true
}
GET <host>/navigation/render/<idOrSlug>?type=<type>
Return a rendered navigation structure depends on passed type (tree
, rfr
or nothing to render as flat/raw
).
Note: The ID of navigation by default is 1
, that's for future extensions and multi-navigation feature.
Example URL: https://localhost:1337/navigation/render/1
Example response body
[
{
"id": 1,
"title": "News",
"type": "INTERNAL",
"path": "news",
"externalPath": null,
"uiRouterKey": "News",
"menuAttached": false,
"parent": null,
"master": 1,
"created_at": "2020-09-29T13:29:19.086Z",
"updated_at": "2020-09-29T13:29:19.128Z",
"related": [{
"__contentType": "Page",
"id": 1,
"title": "News",
...
}]
},
...
]
Example URL: https://localhost:1337/navigation/render/1?type=tree
Example response body
[
{
"title": "News",
"menuAttached": true,
"path": "/news",
"type": "INTERNAL",
"uiRouterKey": "news",
"slug": "benefits",
"external": false,
"related": {
"__contentType": "Page",
"id": 1,
"title": "News",
...
},
"items": [
{
"title": "External url",
"menuAttached": true,
"path": "http://example.com",
"type": "EXTERNAL",
"uiRouterKey": "generic",
"external": true
},
...
]
},
...
]
Example URL: https://localhost:1337/navigation/render/1?type=rfr
Example response body
{
"pages": {
"News": {
"id": "News",
"title": "News",
"templateName": "pages:1",
"related": {
"contentType": "page",
"collectionName": "pages",
"id": 1
},
"path": "/news",
"slug": "news",
"parent": null,
"menuAttached": true
},
"Community": {
"id": "Community",
"title": "Community",
"templateName": "pages:2",
"related": {
"contentType": "page",
"collectionName": "pages",
"id": 2
},
"path": "/community",
"slug": "community",
"parent": null,
"menuAttached": true
},
"Highlights": {
"id": "Highlights",
"title": "Highlights",
"templateName": "pages:3",
"related": {
"contentType": "page",
"collectionName": "pages",
"id": 3
},
"path": "/community/highlights",
"slug": "community-highlights",
"parent": "Community",
"menuAttached": false
},
...
},
"nav": {
"root": [
{
"label": "News",
"type": "internal",
"page": "News"
},
{
"label": "Community",
"type": "internal",
"page": "Community"
},
{
"label": "External url",
"type": "external",
"url": "http://example.com"
},
...
],
"Community": [
{
"label": "Highlights",
"type": "internal",
"page": "Highlights"
},
...
],
...
}
}
Feel free to fork and make a Pull Request to this plugin project. All the input is warmly welcome!
For general help using Strapi, please refer to the official Strapi documentation. For additional help, you can use one of these channels to ask a question:
MIT License Copyright (c) 2020 VirtusLab Sp. z o.o. & Strapi Solutions.
FAQs
Strapi - Navigation plugin
The npm package strapi-plugin-navigation receives a total of 2,887 weekly downloads. As such, strapi-plugin-navigation popularity was classified as popular.
We found that strapi-plugin-navigation demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.