Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

strapi-plugin-permalinks

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

strapi-plugin-permalinks

A plugin for Strapi to enable permalinks for content types with nested relationships.

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
133
increased by20.91%
Maintainers
1
Weekly downloads
 
Created
Source

A plugin for Strapi to enable permalinks for content types with nested relationships.

Kinda like WordPress, but not 👍🏻

Get Started

  • Features
  • Installation
  • Configuration
  • User Guide
  • Roadmap

✨ Features

  • Manage a chain of slugs to build a unique URL path
  • Nested relationships for content types
  • Child relations automatically sync with changes to parents

💎 Installation

yarn add strapi-plugin-permalinks@latest

🔧 Configuration

propertytype (default)description
contentTypesarray ([])An array of objects describing which content types and fields should use permalink features.

contentTypes

An array of objects describing which content types and fields should use permalink features.

Each object in the array requires a uid, targetField, and targetRelation props. The field name "slug" is recommended for the targetField value because it represents the unique part of the URL path, but it is not required. Similarly, the relation name "parent" is recommended for the targetRelation, but is not required.

Example

Consider we have a Page content type which has a title field, a uid field named slug, and relation field named parent with a "has one" relationship to other Pages.

Let's configure the Page content type to use permalinks.

module.exports = {
  'permalinks': {
    enabled: true,
    config: {
      contentTypes: [
        {
          uid: 'api::page.page',
          targetField: 'slug',
          targetRelation: 'parent',
        },
      ],
    },
  },
};

📘 User Guide

Assign a parent relation to a page to automatically generate a URL path that includes the slugs of it's parent pages.

Updating the slug for a page with child pages

All child pages will automatically have their slug fields updated when the slug of their parent changes. This extends down to all descendant pages.

Deleting pages with children

Deleting a page that has children will orphan those child pages. The parent relation will be removed from the child pages but no other changes to their data will occur.

If orphaned pages exist, you will see their slug value in the content manger list view as a red label instead of plain text.

Editing the orphaned page will display a warning and an error message on the target field. From here you can assign a new parent or no parent at all. Upon saving, any children of the page will also update their target fields to reflect to new parent slugs.

Better conflict resolution regarding updated/deleted pages is on the roadmap.

🚧 Roadmap

  • Config option to limit nesting depth.
  • Better conflict resolution for orphaned pages when parent pages are updated or deleted.
  • Avoid cloning the core InputUID component (currently required to function).

Keywords

FAQs

Package last updated on 25 Mar 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc