Skip to content

Commit

Permalink
✨ use thumbnails for wp posts
Browse files Browse the repository at this point in the history
  • Loading branch information
danyx23 committed Oct 31, 2023
1 parent 16717f8 commit 43a47c2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion db/wpdb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ export const getRelatedResearchAndWritingForVariable = async (
p.slug as postSlug,
coalesce(csr.chart_id, c.id) as chartId,
p.authors as authors,
'' as thumbnail, -- TODO: add thumbnail once we have it
p.featured_image as thumbnail,
coalesce(pv.views_365d, 0) as pageviews,
'wordpress' as post_source
from
Expand Down
13 changes: 10 additions & 3 deletions site/DataPageV2Content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,16 @@ export const DataPageV2Content = ({
</figure> */}
{/* // TODO: switch this to use the Image component and put the required information for the thumbnails into hte attachment context or similar */}
<img
src={encodeURI(
`${IMAGE_HOSTING_CDN_URL}/production/${research.imageUrl}`
)}
src={
research.imageUrl &&
research.imageUrl.startsWith(
"http"
)
? research.imageUrl
: encodeURI(
`${IMAGE_HOSTING_CDN_URL}/production/${research.imageUrl}`
)
}
alt=""
className="span-lg-cols-2 span-sm-cols-3"
/>
Expand Down

0 comments on commit 43a47c2

Please sign in to comment.