Skip to content

Commit

Permalink
🐛 filter fragments from related charts
Browse files Browse the repository at this point in the history
  • Loading branch information
ikesau committed Oct 10, 2023
1 parent 3a0e895 commit c41025f
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions db/wpdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import {
orderBy,
IMAGES_DIRECTORY,
uniqBy,
OwidGdocType,
} from "@ourworldindata/utils"
import { Topic } from "@ourworldindata/grapher"
import {
Expand Down Expand Up @@ -663,11 +664,15 @@ export const getRelatedArticles = async (
"grapher"
)
const publishedGdocPostsThatReferenceChart: PostReference[] =
publishedLinksToChart.map((link) => ({
id: link.source.id,
title: link.source.content.title!,
slug: link.source.slug,
}))
publishedLinksToChart
.filter(
(link) => link.source.content.type !== OwidGdocType.Fragment
)
.map((link) => ({
id: link.source.id,
title: link.source.content.title!,
slug: link.source.slug,
}))
const relatedArticles: PostReference[] = await Promise.all(
chart.embeddedIn.map(async (postId: any) => {
const postRecord = await graph.find(GraphType.Document, postId)
Expand Down

0 comments on commit c41025f

Please sign in to comment.