diff --git a/db/model/Gdoc/enrichedToMarkdown.ts b/db/model/Gdoc/enrichedToMarkdown.ts index e9ef6cb4f57..eb63609954a 100644 --- a/db/model/Gdoc/enrichedToMarkdown.ts +++ b/db/model/Gdoc/enrichedToMarkdown.ts @@ -277,6 +277,7 @@ ${links}` { datapageUrl: b.datapageUrl, title: b.title, + source: b.source, // blurb ignored }, exportComponents diff --git a/db/model/Gdoc/enrichedToRaw.ts b/db/model/Gdoc/enrichedToRaw.ts index 871ec8a136f..a8dcf6376a1 100644 --- a/db/model/Gdoc/enrichedToRaw.ts +++ b/db/model/Gdoc/enrichedToRaw.ts @@ -446,6 +446,7 @@ export function enrichedBlockToRawBlock( value: spansToHtmlText(enriched.value), })) : undefined, + source: b.source, }, } }) diff --git a/db/model/Gdoc/rawToArchie.ts b/db/model/Gdoc/rawToArchie.ts index cbec65b58cf..6f802b98071 100644 --- a/db/model/Gdoc/rawToArchie.ts +++ b/db/model/Gdoc/rawToArchie.ts @@ -628,6 +628,7 @@ function* rawBlockKeyIndicatorToArchieMLString( if (typeof block.value !== "string") { yield* propertyToArchieMLString("datapageUrl", block.value) yield* propertyToArchieMLString("title", block.value) + yield* propertyToArchieMLString("source", block.value) if (block.value.blurb) { yield "[.+blurb]" for (const textBlock of block.value.blurb) { diff --git a/db/model/Gdoc/rawToEnriched.ts b/db/model/Gdoc/rawToEnriched.ts index ca948c5bfe5..f352ae6b701 100644 --- a/db/model/Gdoc/rawToEnriched.ts +++ b/db/model/Gdoc/rawToEnriched.ts @@ -1933,6 +1933,7 @@ const parseKeyIndicator = ( datapageUrl: url, blurb: parsedBlurb.length > 0 ? parsedBlurb : undefined, title: val.title, + source: val.source, parseErrors: parsedBlurbErrors, }) as EnrichedBlockKeyIndicator } diff --git a/packages/@ourworldindata/types/src/gdocTypes/ArchieMlComponents.ts b/packages/@ourworldindata/types/src/gdocTypes/ArchieMlComponents.ts index 3402ec0db86..c70216271cf 100644 --- a/packages/@ourworldindata/types/src/gdocTypes/ArchieMlComponents.ts +++ b/packages/@ourworldindata/types/src/gdocTypes/ArchieMlComponents.ts @@ -90,6 +90,7 @@ export type RawBlockKeyIndicatorValue = { datapageUrl?: string title?: string blurb?: RawBlockText[] + source?: string } export type RawBlockKeyIndicator = { @@ -102,6 +103,7 @@ export type EnrichedBlockKeyIndicator = { datapageUrl: string title?: string blurb?: EnrichedBlockText[] + source?: string } & EnrichedBlockWithParseErrors export type RawBlockScroller = { diff --git a/site/gdocs/components/KeyIndicator.tsx b/site/gdocs/components/KeyIndicator.tsx index 678d95098ae..a552bd3bb70 100644 --- a/site/gdocs/components/KeyIndicator.tsx +++ b/site/gdocs/components/KeyIndicator.tsx @@ -33,12 +33,14 @@ export default function KeyIndicator({ if (!linkedChart) return null if (!linkedIndicator) return null - const source = capitalize( - joinTitleFragments( - linkedIndicator.attributionShort, - linkedIndicator.titleVariant + const source = + d.source || + capitalize( + joinTitleFragments( + linkedIndicator.attributionShort, + linkedIndicator.titleVariant + ) ) - ) const dateRange = makeDateRange({ dateRange: linkedIndicator.dateRange, })