1

I want to create a content model containing a list of dates of variable length. The only way I figured out how to do it is to create a new nested content model with one date field, and then include these single date entries as a reference list. The issue with this approach is that the date is not showing as the entry title. Instead, a list of dates is only displayed as a list of blocks all labeled "Untitled", which is very unintuitive, as shown in the following screenshot.

Screenshot of the current status

So the questions are: Is there a good way to display the date as Entry title, or is there another solution to include a list of dates into the content model?

I am investigating the use of UI Extensions to solve this, but maybe there is a simpler build-in solution to the problem, than a custom developed extension.

  • Welcome to SO! Please review the following post and update the question appropriately: https://stackoverflow.com/help/how-to-ask – garfbradaz Jul 06 '17 at 13:50
  • If you have a list of dates, which date do you want to be the title? Please explain what you are trying to do in more detail – CharlieC Jul 06 '17 at 14:16
  • Hi @CharlieC, the content model describes an artist show, that is performed several times, thus i want to provide several date inputs for each show entry. The amout of performances for each show varies. The rest of the content model contains other information like place, description, etc about one show... I wanted to use the date informations to render the artists calendar on their website – Thomas Gorny Jul 06 '17 at 14:35
  • So why do you want one (of possibly several dates) to be the entry title? And how will you know which of the dates should be the entry title? It might be better to use a short text list for the dates (e.g., `7/6/17, 7/7/17, 7/8/17` ) which will be an array in the API response. Granted I've not tried this specifically so YMMV – CharlieC Jul 06 '17 at 14:44
  • Thanks for your responses @CharlieC ! I tried to clear up the question and provide a screen shot. Currently a _single_ date is inside a _nested_ content model, included as a reference list. There, seeing the date as title would be nice. Giving up on the date/time picker in favor of a text field would mean possible parsing problems later on, since i am not the editor of the content, just the developer of the system. But it is a valid option to consider! – Thomas Gorny Jul 06 '17 at 15:02

1 Answers1

1

You can't specify the Entry title from date fields, but rather only from short or long text fields, so a UI extension would be the way to go. Add a short text field called title (and specify that this field represents the entry title) then create a UI extension which will put a string of the selected date from the date field into the title field. Check out https://github.com/contentful/extensions/tree/master/samples/slug for a good starting point.

CharlieC
  • 502
  • 3
  • 8
  • Thanks again! I did exactly that in the end and it was easier than I thought. Extensions are a surprising and powerful feature, and easy to implement. Make me like contentful even more. – Thomas Gorny Jul 07 '17 at 13:26