uniswap-interface-uncensored/functions/[[index]].ts
Brendan Wong b98e62cac8
fix: remove description from custom rich link previews (#7142)
* fix: remove description from custom rich link previews

* add static assets to prepare for prep

* remove added assets
2023-08-11 18:53:48 -04:00

19 lines
598 B
TypeScript

/* eslint-disable import/no-unused-modules */
import { MetaTagInjector } from './components/metaTagInjector'
export const onRequest: PagesFunction = async ({ request, next }) => {
const imageUri = new URL(request.url).origin + '/images/1200x630_Rich_Link_Preview_Image.png'
const data = {
title: 'Uniswap Interface',
image: imageUri,
url: request.url,
description: 'Swap or provide liquidity on the Uniswap Protocol',
}
const res = next()
try {
return new HTMLRewriter().on('head', new MetaTagInjector(data)).transform(await res)
} catch (e) {
return res
}
}