Skip to content

Setting folder collections path overrides slug value #4092

@hursey013

Description

@hursey013

Describe the bug
When using the folder collections path option, the value of slug becomes that of path rather than just the slugified version of title or identifier_field.

To Reproduce

  1. Create a collection and set path to path: "{{slug}}/_index"
  2. Define a field for title
  3. Create a new record
  4. In a new collection create a relation widget and reference the original collection and set valueField: {{slug}}
  5. Save a record in the new collection

Expected behavior
The value of of the relation widget to be just the slugified version of title, instead it's the entire path as defined in path (my-title-slug/_index).

Screenshots

Applicable Versions:

  • Netlify CMS version: 2.10.55

CMS configuration

collections:
  - name: "topics"
    label: "Topics"
    folder: "content/topics"
    path: "{{slug}}/_index"
    create: true
    fields:
      - label: "Topic Title"
        name: "title"
        widget: "string"
        hint: "Short, topical, no acronyms."

  - name: "events"
    label: "Events"
    label_singular: "Event"
    folder: "content/events"
    fields:
      - label: "Topics"
        name: "topics"
        widget: "relation"
        collection: "topics"
        searchFields: ["title"]
        valueField: "{{slug}}"
        displayFields: ["title"]

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions