File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -36,14 +36,18 @@ const PageBlocks: React.FC<Props> = ({ page }) => {
3636 const { asset, _key : imageKey } = childElement ;
3737 const width = asset ?. metadata ?. dimensions ?. width ?? 800 ;
3838 const height = asset ?. metadata ?. dimensions ?. height ?? 600 ;
39+ const imageUrl = getImageUrl ( asset ) ;
40+ if ( ! imageUrl ) {
41+ return ;
42+ }
3943 elementBlocks . push (
4044 < div
4145 key = { `${ bodyElementKey } -${ childElementKey } -${ imageKey } ` }
4246 className = { styles . imageContainer }
4347 >
4448 < Image
4549 className = { styles . image }
46- src = { getImageUrl ( asset ) }
50+ src = { imageUrl }
4751 alt = ""
4852 width = { width }
4953 height = { height }
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ const Page: React.FC<Props> = ({ page, isIndividualPage = false }) => {
2727 year : 'numeric' ,
2828 } ) ;
2929 const pageTitle = < p className = { classNames ( styles . title , styles . bold ) } > { page . title } </ p > ;
30+ const imageUrl = page . mainPhoto ? getImageUrl ( page . mainPhoto ) : '' ;
3031 return (
3132 < div key = { page . id } className = { styles . pageContainer } >
3233 < div className = { styles . headerSection } >
@@ -56,11 +57,11 @@ const Page: React.FC<Props> = ({ page, isIndividualPage = false }) => {
5657 { pageTitle }
5758 </ Link >
5859 { page . summary }
59- { page . mainPhoto && (
60+ { page . mainPhoto && imageUrl && (
6061 < div className = { styles . imageContainer } >
6162 < Image
6263 className = { styles . image }
63- src = { getImageUrl ( page . mainPhoto ) }
64+ src = { imageUrl }
6465 alt = ""
6566 width = { page . mainPhoto ?. metadata ?. dimensions ?. width ?? 800 }
6667 height = { page . mainPhoto ?. metadata ?. dimensions ?. height ?? 600 }
You can’t perform that action at this time.
0 commit comments