Added source urls to page
This commit is contained in:
parent
5c059d0410
commit
0806c74f8c
|
@ -109,8 +109,10 @@ const handleSources = (
|
||||||
case "urlBlock":
|
case "urlBlock":
|
||||||
return {
|
return {
|
||||||
type: "url",
|
type: "url",
|
||||||
url: source.url,
|
value: {
|
||||||
label: getDomainFromUrl(source.url),
|
url: source.url,
|
||||||
|
label: getDomainFromUrl(source.url),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}) ?? []
|
}) ?? []
|
||||||
|
|
|
@ -29,8 +29,7 @@ const fields = {
|
||||||
summary: "summary",
|
summary: "summary",
|
||||||
content: "content",
|
content: "content",
|
||||||
credits: "credits",
|
credits: "credits",
|
||||||
collectibles: "collectibles",
|
sourceUrls: "sourceUrls",
|
||||||
folders: "folders",
|
|
||||||
} as const satisfies Record<string, string>;
|
} as const satisfies Record<string, string>;
|
||||||
|
|
||||||
export const Pages = buildVersionedCollectionConfig({
|
export const Pages = buildVersionedCollectionConfig({
|
||||||
|
@ -42,13 +41,7 @@ export const Pages = buildVersionedCollectionConfig({
|
||||||
defaultSort: fields.slug,
|
defaultSort: fields.slug,
|
||||||
admin: {
|
admin: {
|
||||||
useAsTitle: fields.slug,
|
useAsTitle: fields.slug,
|
||||||
defaultColumns: [
|
defaultColumns: [fields.slug, fields.thumbnail, fields.backgroundImage, fields.translations],
|
||||||
fields.slug,
|
|
||||||
fields.thumbnail,
|
|
||||||
fields.backgroundImage,
|
|
||||||
fields.translations,
|
|
||||||
fields.folders,
|
|
||||||
],
|
|
||||||
group: CollectionGroups.Collections,
|
group: CollectionGroups.Collections,
|
||||||
preview: ({ slug }) => `${process.env.PAYLOAD_PUBLIC_FRONTEND_BASE_URL}/en/pages/${slug}`,
|
preview: ({ slug }) => `${process.env.PAYLOAD_PUBLIC_FRONTEND_BASE_URL}/en/pages/${slug}`,
|
||||||
components: {
|
components: {
|
||||||
|
@ -121,6 +114,17 @@ export const Pages = buildVersionedCollectionConfig({
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
creditsField({ name: fields.credits }),
|
creditsField({ name: fields.credits }),
|
||||||
|
{
|
||||||
|
name: fields.sourceUrls,
|
||||||
|
label: "Source URLs",
|
||||||
|
type: "text",
|
||||||
|
hasMany: true,
|
||||||
|
admin: {
|
||||||
|
description:
|
||||||
|
"If the content originates from an external source (e.g: fandom.com, an online interview...) you can add a link to the original page(s) here",
|
||||||
|
width: "50%",
|
||||||
|
},
|
||||||
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|
|
@ -20,6 +20,7 @@ import {
|
||||||
convertImageToEndpointPayloadImage,
|
convertImageToEndpointPayloadImage,
|
||||||
convertRTCToEndpointRTC,
|
convertRTCToEndpointRTC,
|
||||||
convertRelationshipsToEndpointRelations,
|
convertRelationshipsToEndpointRelations,
|
||||||
|
getDomainFromUrl,
|
||||||
} from "../../../utils/endpoints";
|
} from "../../../utils/endpoints";
|
||||||
import { convertRecorderToEndpointRecorderPreview } from "../../Recorders/endpoints/getByID";
|
import { convertRecorderToEndpointRecorderPreview } from "../../Recorders/endpoints/getByID";
|
||||||
|
|
||||||
|
@ -59,7 +60,17 @@ const convertPageToEndpointPage = async (page: Page): Promise<EndpointPage> => {
|
||||||
? { backgroundImage: convertImageToEndpointPayloadImage(backgroundImage) }
|
? { backgroundImage: convertImageToEndpointPayloadImage(backgroundImage) }
|
||||||
: {}),
|
: {}),
|
||||||
translations: translations.map(
|
translations: translations.map(
|
||||||
({ content, language, sourceLanguage, title, pretitle, subtitle, summary, credits }) => ({
|
({
|
||||||
|
content,
|
||||||
|
language,
|
||||||
|
sourceLanguage,
|
||||||
|
title,
|
||||||
|
pretitle,
|
||||||
|
subtitle,
|
||||||
|
summary,
|
||||||
|
credits,
|
||||||
|
sourceUrls,
|
||||||
|
}) => ({
|
||||||
language: isPayloadType(language) ? language.id : language,
|
language: isPayloadType(language) ? language.id : language,
|
||||||
sourceLanguage: isPayloadType(sourceLanguage) ? sourceLanguage.id : sourceLanguage,
|
sourceLanguage: isPayloadType(sourceLanguage) ? sourceLanguage.id : sourceLanguage,
|
||||||
...(isNotEmpty(pretitle) ? { pretitle } : {}),
|
...(isNotEmpty(pretitle) ? { pretitle } : {}),
|
||||||
|
@ -69,6 +80,11 @@ const convertPageToEndpointPage = async (page: Page): Promise<EndpointPage> => {
|
||||||
content: convertRTCToEndpointRTC(content),
|
content: convertRTCToEndpointRTC(content),
|
||||||
toc: handleToc(content),
|
toc: handleToc(content),
|
||||||
credits: convertCreditsToEndpointCredits(credits),
|
credits: convertCreditsToEndpointCredits(credits),
|
||||||
|
sourceUrls:
|
||||||
|
sourceUrls?.map((url) => ({
|
||||||
|
url,
|
||||||
|
label: getDomainFromUrl(url),
|
||||||
|
})) ?? [],
|
||||||
})
|
})
|
||||||
),
|
),
|
||||||
createdAt,
|
createdAt,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 63d17331a17a5ab7874599d1df4ecf6b45ac89f3
|
Subproject commit c2702ea508dde59264ee66100054bacc0834c029
|
|
@ -95,6 +95,7 @@ export interface Page {
|
||||||
[k: string]: unknown;
|
[k: string]: unknown;
|
||||||
};
|
};
|
||||||
credits?: Credits;
|
credits?: Credits;
|
||||||
|
sourceUrls?: string[] | null;
|
||||||
id?: string | null;
|
id?: string | null;
|
||||||
}[];
|
}[];
|
||||||
updatedBy: string | Recorder;
|
updatedBy: string | Recorder;
|
||||||
|
|
Loading…
Reference in New Issue