Skip to content

Use content date field instead of built-in template tags #6801

@nick-mon1

Description

@nick-mon1

Is your feature request related to a problem? Please describe.

Hello, I have content that is future-dated for upcoming events. Our current config uses the built template date tags path: "{{year}}/{{month}}/{{slug}}" as part of the path for where the file should be saved.

It would be great to use something like {{fields.date.year}} to get the date components from the collection field instead of the built-in date template tags. This would allow us to the path to match to the date in the front matter.

Is is possible to get the year, month, day from by doing {{fields.date.year}}, {{fields.date.month}}, {{fields.date.day}}.

Top level path setting for file location:

path: "{{year}}/{{month}}/{{slug}}" // would be great to reference {{fields.date.year}}, etc...
slug: "{{year}}-{{month}}-{{day}}-{{slug}}"

Collection field to reference in path for content type:

- label: "Start Date/Time"
name: "date"
widget: "datetime"
dateFormat: "YYYY-MM-DD" # e.g. 2021-11.23
timeFormat: "HH:mm" # e.g. 21:00
format: "YYYY-MM-DD HH:mm:00 -0500"
hint: "The start date and time of the event (Note: uses a 24hr clock, e.g. 13:00)"

Describe the solution you'd like

Is is possible to get the year, month, day from by doing {{fields.date.year}}, {{fields.date.month}}, {{fields.date.day}}?

Describe alternatives you've considered
N/A

Additional context
N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configurationtype: featurecode contributing to the implementation of a feature and/or user facing functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions