fix: images in RSS feed
Signed-off-by: Filipe Medeiros <hello@filipesm.eu>
This commit is contained in:
parent
fead4dccea
commit
af92c1f19a
|
@ -209,6 +209,7 @@ export const rssBlockRenderMap: typeof blockRenderMap = {
|
|||
src={getProxiedAssetUrl({
|
||||
blockId: block.id,
|
||||
lastEditedTime: block.last_edited_time,
|
||||
withBaseUrl: true,
|
||||
})}
|
||||
/>
|
||||
{block.image.caption.length > 0 && (
|
||||
|
|
|
@ -1,15 +1,24 @@
|
|||
// NOTE: this assumes that we are deploying on Vercel
|
||||
const getProxiedAssetUrl = (
|
||||
params:
|
||||
| { blockId: string; lastEditedTime: string }
|
||||
| { pageId: string; propertyId?: string; lastEditedTime: string },
|
||||
| { blockId: string; lastEditedTime: string; withBaseUrl?: boolean }
|
||||
| {
|
||||
pageId: string
|
||||
propertyId?: string
|
||||
lastEditedTime: string
|
||||
withBaseUrl?: boolean
|
||||
},
|
||||
) => {
|
||||
let path: string
|
||||
if ('blockId' in params)
|
||||
return `/api/notion-asset/block/${params.blockId}?lastEditedTime=${params.lastEditedTime}`
|
||||
path = `/api/notion-asset/block/${params.blockId}?lastEditedTime=${params.lastEditedTime}`
|
||||
else if (!params.propertyId)
|
||||
return `/api/notion-asset/page/${params.pageId}?lastEditedTime=${params.lastEditedTime}`
|
||||
path = `/api/notion-asset/page/${params.pageId}?lastEditedTime=${params.lastEditedTime}`
|
||||
else
|
||||
return `/api/notion-asset/page/${params.pageId}/${params.propertyId}?lastEditedTime=${params.lastEditedTime}`
|
||||
path = `/api/notion-asset/page/${params.pageId}/${params.propertyId}?lastEditedTime=${params.lastEditedTime}`
|
||||
|
||||
if (params.withBaseUrl) return `${process.env.NEXT_PUBLIC_SITE_URL}${path}`
|
||||
else return path
|
||||
}
|
||||
|
||||
export default getProxiedAssetUrl
|
||||
|
|
Loading…
Reference in a new issue