decaporg / decaporg/decap-cms

Folder collection path based on fields

Open
#7,192 1 comment 1 reaction 0 assignees View on GitHub
type: feature
Dominant language
JavaScript
Stars
19.4k
Forks
3.1k
Avg merge
1d 14h
Merged PRs (30d)
9

Description

We can specify `path` template for a folder collection - as described in docs [here](https://decapcms.org/docs/collection-folder/) :
Docs says, it supports template syntax similar to `slug` templates
Slug templates allows use of fields

We would like to organise content based on value of certain fields (including relation type fields)

Example : City collection, with a relation field for state
We would like to configure path for cities collection as `path: '{{fields.state.name}}/{{slug}}'`
So that the content would be saved as shown below

```
- state1
--- city1.md
--- city2.md
- state2
--- city3.md
--- city4.md

```

But looks like, folder collection path template doesnt allow use of fields

Contributor guide

Open the contributing guide

Research direction

Start with the collection-folder documentation linked in the issue and trace how folder collection paths currently apply slug templates. Investigate whether field and relation values are available when the path is generated; done means supporting a path such as `{{fields.state.name}}/{{slug}}` and producing the requested state-based folder structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
content
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.