diff --git a/src/collections/Audios/Audios.ts b/src/collections/Audios/Audios.ts index f7c62fe..9e6a5e8 100644 --- a/src/collections/Audios/Audios.ts +++ b/src/collections/Audios/Audios.ts @@ -25,7 +25,7 @@ const fields = { export const Audios = buildCollectionConfig({ slug: Collections.Audios, labels: { singular: "Audio", plural: "Audios" }, - defaultSort: fields.updatedAt, + defaultSort: fields.filename, admin: { group: CollectionGroups.Media, preview: ({ id }) => `${process.env.PAYLOAD_PUBLIC_FRONTEND_BASE_URL}/en/audios/${id}`, diff --git a/src/collections/Videos/Videos.ts b/src/collections/Videos/Videos.ts index 76cf779..53c8c4e 100644 --- a/src/collections/Videos/Videos.ts +++ b/src/collections/Videos/Videos.ts @@ -34,7 +34,7 @@ const fields = { export const Videos = buildCollectionConfig({ slug: Collections.Videos, labels: { singular: "Video", plural: "Videos" }, - defaultSort: fields.updatedAt, + defaultSort: fields.filename, admin: { group: CollectionGroups.Media, preview: ({ id }) => `${process.env.PAYLOAD_PUBLIC_FRONTEND_BASE_URL}/en/videos/${id}`, diff --git a/src/utils/imageCollectionConfig.ts b/src/utils/imageCollectionConfig.ts index dec4e99..8137bd8 100644 --- a/src/utils/imageCollectionConfig.ts +++ b/src/utils/imageCollectionConfig.ts @@ -4,6 +4,10 @@ import { publicAccess } from "../accesses/publicAccess"; import { CollectionGroups } from "../constants"; import { BuildCollectionConfig, buildCollectionConfig } from "./collectionConfig"; +const fields = { + filename: "filename", +}; + type BuildImageCollectionConfig = Omit & { upload: { imageSizes: ImageSize[] }; }; @@ -15,10 +19,10 @@ export const buildImageCollectionConfig = ({ }: BuildImageCollectionConfig): CollectionConfig => buildCollectionConfig({ ...otherConfig, - defaultSort: "-updatedAt", + defaultSort: fields.filename, admin: { disableDuplicate: true, - useAsTitle: "filename", + useAsTitle: fields.filename, group: CollectionGroups.Media, ...admin, },