Use filename as title for media

This commit is contained in:
DrMint 2024-07-16 08:15:30 +02:00
parent b0416b61db
commit 1092c97f5d
5 changed files with 10 additions and 1 deletions

View File

@ -31,6 +31,7 @@ export const Audios = buildCollectionConfig({
admin: {
group: CollectionGroups.Media,
preview: ({ id }) => `${process.env.PAYLOAD_PUBLIC_FRONTEND_BASE_URL}/en/audios/${id}`,
useAsTitle: fields.filename,
defaultColumns: [
fields.filename,
fields.thumbnail,

View File

@ -36,6 +36,7 @@ export const Images = buildImageCollectionConfig({
admin: {
preview: ({ id }) => `${process.env.PAYLOAD_PUBLIC_FRONTEND_BASE_URL}/en/images/${id}`,
defaultColumns: [fields.filename, fields.posts, fields.updatedAt],
useAsTitle: fields.filename,
},
upload: {
imageSizes: [

View File

@ -17,6 +17,7 @@ export const Scans = buildImageCollectionConfig({
plural: "Scans",
},
admin: {
useAsTitle: fields.filename,
defaultColumns: [fields.filename, fields.updatedAt],
hidden: shownOnlyToAdmin,
},

View File

@ -40,6 +40,7 @@ export const Videos = buildCollectionConfig({
labels: { singular: "Video", plural: "Videos" },
defaultSort: fields.filename,
admin: {
useAsTitle: fields.filename,
group: CollectionGroups.Media,
preview: ({ id }) => `${process.env.PAYLOAD_PUBLIC_FRONTEND_BASE_URL}/en/videos/${id}`,
defaultColumns: [

View File

@ -5,7 +5,12 @@ import { buildCollectionConfig } from "../../utils/collectionConfig";
export const VideosSubtitles = buildCollectionConfig({
slug: Collections.VideosSubtitles,
labels: { singular: "Video Subtitle", plural: "Videos Subtitles" },
admin: { group: CollectionGroups.Media, disableDuplicate: true, hidden: shownOnlyToAdmin },
admin: {
useAsTitle: "filename",
group: CollectionGroups.Media,
disableDuplicate: true,
hidden: shownOnlyToAdmin,
},
upload: {
mimeTypes: ["text/*"],
disableLocalStorage: true,