Skip to content

Commit

Permalink
fix local image paths
Browse files Browse the repository at this point in the history
  • Loading branch information
sterlingwes committed Jan 30, 2024
1 parent bb9a3bd commit 56fd583
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions site/src/content/enabler/tal-broda.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"date": "2023-10-09T07:30:00.000Z",
"quote": {
"text": "To the citizens of Gaza. Listen to the IDF.\nHamas wants you to stay because they need you as human shields.\nYou do not want to be in the building when this happens. And it will.",
"image": "/post_assets/themossadil-20231009.png",
"image": "themossadil-20231009.png",
"author": "The Mossad: Satirical, Yet Aweso..."
},
"type": "twitter",
Expand All @@ -68,7 +68,7 @@
"date": "2023-10-10T10:57:14.000Z",
"quote": {
"text": "This is the Beverly Hills of Gaza. This is where all the leaders of Hamas have their palaces. Or should I say, had their palaces.\nAnd let there be no doubt, the IDF is just getting started.",
"image": "post_assets/hilzfuld-20231010.png",
"image": "hilzfuld-20231010.png",
"author": "Hillel Fuld"
},
"type": "twitter",
Expand Down
9 changes: 9 additions & 0 deletions site/src/lib/server/posts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@ export const getEnhancedPosts = (posts: EnablerPost[]) => {
structuredQuoteText: post.quote?.text
? parsePostText(post.quote.text)
: [],
// prefix locally-hosted images with correct path if not absolute
...(post.image && !post.image.startsWith("http")
? { image: `/post_assets/${post.image}` }
: {}),
...(post.quote?.image && !post.quote.image.startsWith("http")
? {
quote: { ...post.quote, image: `/post_assets/${post.quote.image}` },
}
: {}),
readTime: readingTime(post.text + (post.quote ? post.quote.text : ""), {
wordsPerMinute: 300,
}),
Expand Down

0 comments on commit 56fd583

Please sign in to comment.