diff --git a/.changeset/collection-display-date-fields.md b/.changeset/collection-display-date-fields.md new file mode 100644 index 0000000000..6b5e0cfa60 --- /dev/null +++ b/.changeset/collection-display-date-fields.md @@ -0,0 +1,6 @@ +--- +"emdash": minor +"@emdash-cms/admin": minor +--- + +Adds `displayField` and `dateField` optional collection options to choose which field is used as an entry's title and which date the content list shows and sorts by. diff --git a/packages/admin/src/components/ContentEditor.tsx b/packages/admin/src/components/ContentEditor.tsx index 806aca20a6..8d0d63ed16 100644 --- a/packages/admin/src/components/ContentEditor.tsx +++ b/packages/admin/src/components/ContentEditor.tsx @@ -33,6 +33,7 @@ import type { } from "../lib/api"; import { getPreviewUrl, getDraftStatus } from "../lib/api"; import { fromDatetimeLocalInputValue, toDatetimeLocalInputValue } from "../lib/datetime-local.js"; +import { getEntryTitle } from "../lib/entryTitle.js"; import { formatFileSize, getFileIcon } from "../lib/media-utils"; import { usePluginAdmins } from "../lib/plugin-context.js"; import { contentUrl, isSafeUrl } from "../lib/url.js"; @@ -512,6 +513,12 @@ export function ContentEditor({ const urlPattern = manifest?.collections[collection]?.urlPattern; + // When the collection configures a displayField (#1133), the editor header + // shows the entry's title for existing entries; otherwise it keeps the + // generic "Edit