feat(BOOK-609): Using embedded url for assets instead of href since that is not updated when the asset is updated)
* feat(BOOK-609): Updated refs handling for assets inside content pages Approved-by: Linus Flood
This commit is contained in:
@@ -84,8 +84,7 @@ export function generatePageTags(
|
||||
validatedData: CollectionPageRefs,
|
||||
lang: Lang
|
||||
): string[] {
|
||||
const connections = getConnections(validatedData)
|
||||
const assetConnections = getConnectionsFromAssets(validatedData)
|
||||
const { connections, assetConnections } = getConnections(validatedData)
|
||||
return [
|
||||
generateTagsFromSystem(lang, connections),
|
||||
generateTagsFromAssetSystem(assetConnections),
|
||||
@@ -93,38 +92,16 @@ export function generatePageTags(
|
||||
].flat()
|
||||
}
|
||||
|
||||
export function getConnectionsFromAssets({
|
||||
collection_page,
|
||||
}: CollectionPageRefs) {
|
||||
const connections: AssetSystem["system"][] = []
|
||||
export function getConnections({ collection_page }: CollectionPageRefs) {
|
||||
const connections: System["system"][] = [collection_page.system]
|
||||
const assetConnections: AssetSystem[] = []
|
||||
|
||||
if (collection_page.hero_video?.sourceConnection.edges[0]) {
|
||||
connections.push(
|
||||
collection_page.hero_video.sourceConnection.edges[0].node.system
|
||||
assetConnections.push(
|
||||
collection_page.hero_video.sourceConnection.edges[0].node
|
||||
)
|
||||
}
|
||||
|
||||
if (collection_page.blocks) {
|
||||
collection_page.blocks.forEach((block) => {
|
||||
switch (block.__typename) {
|
||||
case CollectionPageEnum.ContentStack.blocks.VideoCard:
|
||||
if (block.video_card?.video.sourceConnection.edges[0]) {
|
||||
connections.push(
|
||||
block.video_card.video.sourceConnection.edges[0].node.system
|
||||
)
|
||||
}
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return connections
|
||||
}
|
||||
|
||||
export function getConnections({ collection_page }: CollectionPageRefs) {
|
||||
const connections: System["system"][] = [collection_page.system]
|
||||
if (collection_page.blocks) {
|
||||
collection_page.blocks.forEach((block) => {
|
||||
const typeName = block.__typename
|
||||
@@ -148,6 +125,11 @@ export function getConnections({ collection_page }: CollectionPageRefs) {
|
||||
if (block.video_card?.system) {
|
||||
connections.push(block.video_card.system)
|
||||
}
|
||||
if (block.video_card?.video.sourceConnection.edges[0]) {
|
||||
assetConnections.push(
|
||||
block.video_card.video.sourceConnection.edges[0].node
|
||||
)
|
||||
}
|
||||
break
|
||||
case CollectionPageEnum.ContentStack.blocks.DynamicContent:
|
||||
break
|
||||
@@ -158,5 +140,5 @@ export function getConnections({ collection_page }: CollectionPageRefs) {
|
||||
})
|
||||
}
|
||||
|
||||
return connections
|
||||
return { connections, assetConnections }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user