Skip to content

Commit

Permalink
Hotfix image do not load on news article (#450)
Browse files Browse the repository at this point in the history
  • Loading branch information
viphan007 authored Nov 18, 2024
1 parent f51d4f2 commit d1872f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/RichText.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import Markdown from './Markdown'

function parseHTML(html) {
return html.replace(/<img.*?src="(.*?)"/g, (match, p1) => {
const src = p1?.split('?')[0]

return match.replace(
p1,
`${p1}?w=1280&q=80&fm=webp" width="1280" height="720"`
`${src}?w=1280&q=80&fm=webp" width="1280" height="720`
)
})
}
Expand Down
5 changes: 4 additions & 1 deletion src/templates/ContentfulDownloadLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,10 @@ const DownloadPage = props => {
/>
) : null}
</Container>
<UKApprovalNotice ukApproved={ukApproved} ukApprovalText={ukApprovalText} />
<UKApprovalNotice
ukApproved={ukApproved}
ukApprovalText={ukApprovalText}
/>
{contentfulModuleToComponent({ ...footer, previewMode })}
</Layout>
)
Expand Down
5 changes: 4 additions & 1 deletion src/templates/ContentfulLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ const ContentfulLayout = props => {
locale
)
)}
<UKApprovalNotice ukApproved={ukApproved} ukApprovalText={ukApprovalText} />
<UKApprovalNotice
ukApproved={ukApproved}
ukApprovalText={ukApprovalText}
/>
{contentfulModuleToComponent(
{ ...footer, isFaq: isFaqLayout, translation },
locale
Expand Down

0 comments on commit d1872f8

Please sign in to comment.