百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
S

strapi-plugin-navigation

> 数据库
开源

一个用于 Strapi Headless CMS 的插件,提供导航/菜单构建功能,并允许用户控制受众和不同的输出结构。

364 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个用于 Strapi Headless CMS 的插件,提供导航/菜单构建功能,并允许用户控制受众和不同的输出结构。


Strapi Navigation Plugin provides a website navigation / menu builder feature for Strapi Headless CMS admin panel. Navigation has the possibility to control the audience and can be consumed by the website with different output structure renderers:

  • Flat
  • Tree (nested)
  • RFR (ready for handling by Redux First Router)

Table of Contents

  1. Versions
  2. ✨ Features
  3. ⏳ Installation
  4. Requirements
  5. Basic Configuration
    • Settings page
    • Plugin file
  6. GraphQL Configuration
  7. RBAC
  8. Authorization strategy
  9. ️ Public API specification
    • REST API
    • GraphQL API
  10. Extensions
  11. Model lifecycle hooks
  12. REST Cache
  13. Examples
  14. FAQ
  15. Contributing
  16. ‍ Community support

Versions

  • Strapi v5 - (current) v3.x
  • Strapi v4 - v2.x
  • Strapi v3 - v1.x

✨ Features

  • Navigation Public API: Simple and ready for use API endpoint for consuming the navigation structure you've created
  • Visual builder: Elegant and easy to use visual builder
  • Any Content Type relation: Navigation can by linked to any of your Content Types by default. Simply, you're controlling it and also limiting available content types by configuration props
  • Different types of navigation items: Create navigation with items linked to internal types, to external links or wrapper elements to keep structure clean
  • Multiple navigations: Create as many Navigation containers as you want, setup them and use in the consumer application
  • Light / Dark mode compatible: By design we're supporting Strapi ☀️ Light / Dark modes
  • Webhooks integration: Changes to navigation will trigger 'entry.update' or 'entry.create' webhook events.
  • Customizable: Possibility to customize the options like: available Content Types, Maximum level for "attach to menu", Additional fields (audience)

⏳ Installation

Via Strapi Marketplace

As a ✅ verified plugin by Strapi team we're available on the Strapi Marketplace as well as In-App Marketplace where you can follow the installation instructions.

Via command line

It's recommended to use yarn to install this plugin within your Strapi project. You can install yarn with these docs.

bash
yarn add strapi-plugin-navigation@latest

After successful installation you've to re-build your Strapi instance. To archive that simply use:

bash
yarn build
yarn develop

The UI Navigation plugin should appear in the Plugins section of Strapi sidebar after you run app again.

You can manage your multiple navigation containers by going to the Navigation manage view by clicking "Manage" button.

As a next step you must configure your the plugin by the way you want to. See Configuration section.

All done. Enjoy

Requirements

Complete installation requirements are exact same as for Strapi itself and can be found in the documentation under Installation Requirements.

Supported Strapi versions:

  • Strapi v5.10.3 (recently tested)
  • Strapi v5.x

This plugin is designed for Strapi v5 and is not working with v4.x. To get version for Strapi v4 install version v4.x.

We recommend always using the latest version of Strapi to start your new projects.

Configuration

To start your journey with Navigation plugin you must first setup it using the dedicated Settings page or for any version, put your configuration in config/plugins.{js|ts}. Anyway we're recommending the click-through option where your configuration is going to be properly validated.

Settings page

On the dedicated page, you will be able to set up all crucial properties which drive the plugin and customize each individual collection for which Navigation plugin should be enabled.

Note The default configuration for your plugin is fetched from config/plugins.js or, if the file is not there, directly from the plugin itself. If you would like to customize the default state to which you might revert, please follow the next section.

File

Config for this plugin is stored as a part of the config/plugins.{js|ts} or config//plugins.{js|ts} file. You can use the following snippet to make sure that the config structure is correct. If you've got already configurations for other plugins stores by this way, you can use the navigation along with them.

…

Properties

  • additionalFields - Additional fields for navigation items. More here
  • allowedLevels - Maximum level for which you're able to mark item as "Menu attached"
  • contentTypes - UIDs of related content types
  • defaultContentTypes - UID of content type that will be selected by default while creating a new navigation item
  • contentTypesNameFields - Definition of content type title fields like 'api::.': ['field_name_1', 'field_name_2'], if not set titles are pulled from fields like ['title', 'subject', 'name']. TIP - Proper content type uid you can find in the URL of Content Manager where you're managing relevant entities like: admin/content-manager/collectionType/?page=1&pageSize=10&sort=Title:ASC&plugins[i18n][locale]=en
  • pathDefaultFields - The attribute to copy the default path from per content type. Syntax: 'api::.': ['url_slug', 'path']. If you leave it empty, the default path is generated based on the ID.
  • gql - If you're using GraphQL that's the right place to put all necessary settings. More here
  • cascadeMenuAttached - If you don't want "Menu attached" to cascade on child items set this value Disabled.

Properties

Additional Fields

It is advised to configure additional fields through the plugin's Settings Page. There you can find the table of custom fields and toggle input for the audience field. When enabled, the audience field can be customized through the content manager. Custom fields can be added, edited, toggled, and removed with the use of the table provided on the Settings Page. When removing custom fields be advised that their values in navigation items will be lost. Disabling the custom fields will not affect the data and can be done with no consequence of loosing information.

Creating configuration for additional fields with the config.(js|ts) file should be done with caution. Config object contains the additionalFields property of type Array, where CustomField is of type

typescript
type CustomField =
  | {
      type: 'string' | 'boolean' | 'media';
      name: string;
      label: string;
      description?: string;
      placeholder?: string;
      required?: boolean;
      enabled?: boolean;
    }
  | {
      type: 'select';
      name: string;
      label: string;
      description?: string;
      placeholder?: string;
      multi: boolean;
      options: string[];
      required?: boolean;
      enabled?: boolean;
    };

When creating custom fields be advised that the name property has to be unique. When editing a custom field it is advised not to edit its name and type properties. After config has been restored the custom fields that are not present in config.js file will be deleted and their values in navigation items will be lost.

GQL Configuration

Using navigation with GraphQL requires both plugins to be installed and working. You can find installation guide for GraphQL plugin here. To properly configure GQL to work with navigation you should provide gql prop. This should contain union types that will be used to define GQL response format for your data while fetching:

Important! If you're using config/plugins.js to configure your plugins , please put navigation property before graphql. Otherwise types are not going to be properly added to GraphQL Schema. That's because of dynamic types which base on plugin configuration which are added on bootstrap stage, not register. This is not valid if you're using graphql plugin without any custom configuration, so most of cases in real.

gql
master: Int
items: [NavigationItem]
related: NavigationRelated

This prop should look as follows:

typescript
gql: {
    navigationItemRelated: [''],
},

for example:

typescript
gql: {
    navigationItemRelated: ['Page', 'UploadFile'],
},

where Page and UploadFile are your type names for the Content Types you're referring by navigation items relations.

RBAC

Plugin provides granular permissions based on Strapi RBAC functionality within the editorial interface & Admin API. Those settings are editable via the Setings -> Administration Panel -> Roles.

For any role different than Super Admin, to access the Navigation panel you must set following permissions:

Mandatory permissions

  • Plugins -> Navigation -> Read - gives you the access to Navigation Panel

Other permissions

  • Plugins -> Navigation -> Update - with this permission user is able to change Navigation structure
  • Plugins -> Navigation -> Settings - special permission for users that should be able to change plugin settings

Authorization strategy

Is applied for Public API both for REST and GraphQL. You can manage is by two different ways. Those settings are editable via the Setings -> Users & Permissions Plugin -> Roles.

User based

  • Public - as per description it's default role for any not authenticated user. By enabling Public API of the plugin here you're making it fully public, without any permissions check.
  • Authenticated - as per description this is default role for Strapi Users. If you enable Public API here, for any call made you must use the User authentication token as Bearer .

Token based

  • Full Access - gives full access to every Strapi Content API including our plugin endpoints as well.
  • Custom - granural access management to every Strapi Content API endpoints as well as plugin Public API - (recomended approach)

Note: Token usage &amp Read-Only tokens If you're aiming to use token based approach, for every call you must provide proper token in headers as Bearer .

Important: As the Read-Only tokens are dedicated to support just find and findAll endpoints from Strapi Content API, they are not covering access to plugin Public API render and renderChild endpoints. We recommend to use the Custom token type for fully granural and secured approach instead of Full Access ones.

Reference: Strapi - API Tokens

Base Navigation Item model

Flat

json
{
  "id": 1,
  "documentId": "njx99iv4p4txuqp307ye8625",
  "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'
  "createdAt": "2020-09-29T13:29:19.086Z",
  "updatedAt": "2020-09-29T13:29:19.128Z",
  "relat

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptapicustomizableinformation-structuresmenu

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类数据库
定价开源

> 相关工具

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库