Add published_date token

Created on 18 October 2023, about 1 year ago

Problem/Motivation

In static yml files where it would be impossible to get the published date, it would be useful to have a published_date (and corrected_date) token. A great example is the metatag yml files where one would want to have a metatag to show a node's published or corrected date (like one would want to show a created or changed timestamp in the page's metadata.)

Steps to reproduce

n/a

Proposed resolution

Expose a published_date token.

Remaining tasks

Create the published_date token.

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Feature request
Status

Active

Version

2.0

Component

Code

Created by

🇨🇦Canada monochromatic

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @monochromatic
  • @monochromatic opened merge request.
  • @monochromatic opened merge request.
  • 🇨🇦Canada spotzero

    Hey @monochromatic,

    I love this feature. There are a couple of features missing from your implementation that I'd like to see for it to be fully included.

    First, token support for all three fields, published date, corrected date, and the corrected number.

    Second, support for the configured date formats, so that these date tokens work like all the other date tokens.

    Looking at `field_token_info_alter` in the token module's token.tokens.inc file, it looks like if you define the date tokens in hook_token_info() in the right way, all of the date options should show up and you might not need your own hook_tokens implementation for the dates.

Production build 0.71.5 2024