diff --git a/site/gdocs/components/HomepageIntro.tsx b/site/gdocs/components/HomepageIntro.tsx index f5abb1ab2a..e2bf662ba9 100644 --- a/site/gdocs/components/HomepageIntro.tsx +++ b/site/gdocs/components/HomepageIntro.tsx @@ -35,7 +35,7 @@ function FeaturedWorkTile({ const { isPreviewing } = useContext(DocumentContext) const linkedDocumentFeaturedImage = linkedDocument?.["featured-image"] const thumbnailFilename = filename ?? linkedDocumentFeaturedImage - const href = linkedDocument ? `/${linkedDocument.slug}` : url + const href = linkedDocument?.url ?? url if (isPreviewing) { if (errorMessage) { diff --git a/site/gdocs/components/LinkedA.tsx b/site/gdocs/components/LinkedA.tsx index 0be30484f0..fb4ae4d8b3 100644 --- a/site/gdocs/components/LinkedA.tsx +++ b/site/gdocs/components/LinkedA.tsx @@ -26,9 +26,9 @@ export default function LinkedA({ span }: { span: SpanLink }) { ) } - if (linkedDocument && linkedDocument.published && linkedDocument.slug) { + if (linkedDocument && linkedDocument.published && linkedDocument.url) { return ( - + ) diff --git a/site/gdocs/components/Person.tsx b/site/gdocs/components/Person.tsx index 6979ab1059..88ee161e25 100644 --- a/site/gdocs/components/Person.tsx +++ b/site/gdocs/components/Person.tsx @@ -1,7 +1,6 @@ import { useMediaQuery } from "usehooks-ts" -import { getCanonicalUrl } from "@ourworldindata/components" -import { EnrichedBlockPerson, OwidGdocType } from "@ourworldindata/types" +import { EnrichedBlockPerson } from "@ourworldindata/types" import { SMALL_BREAKPOINT_MEDIA_QUERY } from "../../SiteConstants.js" import { useLinkedDocument } from "../utils.js" import { ArticleBlocks } from "./ArticleBlocks.js" @@ -11,14 +10,7 @@ import { Socials } from "./Socials.js" export default function Person({ person }: { person: EnrichedBlockPerson }) { const { linkedDocument } = useLinkedDocument(person.url ?? "") const isSmallScreen = useMediaQuery(SMALL_BREAKPOINT_MEDIA_QUERY) - - const slug = linkedDocument?.slug - const url = slug - ? getCanonicalUrl("", { - slug, - content: { type: OwidGdocType.Author }, - }) - : undefined + const url = linkedDocument?.url const heading =

{person.name}

diff --git a/site/gdocs/components/PillRow.tsx b/site/gdocs/components/PillRow.tsx index ee39333e3f..b40b80acf6 100644 --- a/site/gdocs/components/PillRow.tsx +++ b/site/gdocs/components/PillRow.tsx @@ -6,7 +6,7 @@ import { DocumentContext } from "../DocumentContext.js" function Pill(props: { text?: string; url: string }) { const { linkedDocument, errorMessage } = useLinkedDocument(props.url) const { isPreviewing } = useContext(DocumentContext) - const url = linkedDocument ? `/${linkedDocument.slug}` : props.url + const url = linkedDocument?.url ?? props.url const text = props.text ?? linkedDocument?.title if (isPreviewing) { diff --git a/site/gdocs/components/ProminentLink.tsx b/site/gdocs/components/ProminentLink.tsx index ff949f2b11..14ba67f846 100644 --- a/site/gdocs/components/ProminentLink.tsx +++ b/site/gdocs/components/ProminentLink.tsx @@ -12,6 +12,7 @@ import { GRAPHER_DYNAMIC_THUMBNAIL_URL } from "../../../settings/clientSettings. import { ARCHVED_THUMBNAIL_FILENAME, DEFAULT_THUMBNAIL_FILENAME, + OwidGdocLinkType, } from "@ourworldindata/types" const Thumbnail = ({ thumbnail }: { thumbnail: string }) => { @@ -63,17 +64,17 @@ export const ProminentLink = (props: { let title: string | undefined = props.title let description: string | undefined = props.description let thumbnail: string | undefined = props.thumbnail - if (linkType === "gdoc") { - href = `/${linkedDocument?.slug}` - title ??= linkedDocument?.title - description ??= linkedDocument?.excerpt - thumbnail ??= linkedDocument?.["featured-image"] - } else if (linkType === "grapher") { + if (linkedDocument) { + href = linkedDocument.url + title ??= linkedDocument.title + description ??= linkedDocument.excerpt + thumbnail ??= linkedDocument["featured-image"] + } else if (linkType === OwidGdocLinkType.Grapher) { href = `${linkedChart?.resolvedUrl}` title ??= linkedChart?.title thumbnail ??= linkedChart?.thumbnail description ??= "See the data in our interactive visualization" - } else if (linkType === "explorer") { + } else if (linkType === OwidGdocLinkType.Explorer) { href = `${linkedChart?.resolvedUrl}` title ??= `${linkedChart?.title} Data Explorer` thumbnail ??= linkedChart?.thumbnail diff --git a/site/gdocs/components/Recirc.tsx b/site/gdocs/components/Recirc.tsx index 2657c141dc..40471ff9dc 100644 --- a/site/gdocs/components/Recirc.tsx +++ b/site/gdocs/components/Recirc.tsx @@ -10,7 +10,7 @@ function RecircItem({ url }: { url: string }) { return (