Allow "Unavailable after date" to accept a token

Created on 16 June 2024, 5 months ago

Problem/Motivation

I have a content type that has a date field for "expired". I would prefer the page not to be indexed after that date. I would like for the metatag "unavailable after date" field to accept a token pointing to this field, rather than maintaining that data twice on the same node.

Steps to reproduce

Install the metatag module. Edit the settings globally or on a field. Observe the the "unavailable after date" field is a date widget and thus cannot accept a token.

Proposed resolution

Allow the "unavailable after date" field to accept a token or a date.

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

2.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States miwayha

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

Comments & Activities

  • Issue created by @miwayha
  • πŸ‡ΊπŸ‡ΈUnited States miwayha

    I chatted with @ultimike about this yesterday, and this might not be a huge lift.

    The input is simply <input type="date">. Changing it to type="text" and placing a token in the field magically works, since all the data from that field is just stored in a text column. We tried substituting a token, and it worked out of the box.

    Mike thinks (and I agree) that the hardest part here is designing the UI correctly. I made a very quick and dirty prototype for what it could look like, attached as a screenshot here.

    So we could:

    1. Add button and some javascript to toggle the "type" attribute on the input
    2. Add some logic in the form to render the correct type initially (if the saved data doesn't look like a date, use text. Otherwise, use a date.)
    3. Does there need to be anything else?

    Happy to discuss this further, but I think this would make sense.

  • Assigned to jmaxant
Production build 0.71.5 2024