decaporg / decaporg/decap-cms

Be able to reference a specific month or day in date field

Open
#3,750 1 comment 3 reactions 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

I have a section for “Events” in this site where I would like the filename to reflect the date of the event (e.g. `2020-05-14-slug.md`), not the date that event page was created.

[In our config](https://github.com/brooklynrail/brooklynrail-platform/blob/master/themes/brooklynrail/static/workflow/config.yml), I have `.date` entered as a field in our events collection.
I also have the path set to
```
path: "{{year}}/{{year}}-{{month}}-{{day}}-{{slug}}"
```
which is adding the current date (today's date) to the filename.

It would be great to be able to add in the specific month or day of the event date to the path with something like `{{fields.date.month}}`.

The relevant code for implementation is located here:
https://github.com/netlify/netlify-cms/blob/21cd3656cfce1d5fcbacd8e6416a9565dae06c5f/packages/netlify-cms-lib-widgets/src/stringTemplate.ts#L94

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.