🐛 (settings) Allow meta tags in head element
This commit is contained in:
@ -47,7 +47,12 @@ export const getServerSideProps: GetServerSideProps = async (
|
|||||||
url: `https://${forwardedHost ?? host}${pathname}`,
|
url: `https://${forwardedHost ?? host}${pathname}`,
|
||||||
customHeadCode:
|
customHeadCode:
|
||||||
isDefined(headCode) && headCode !== ''
|
isDefined(headCode) && headCode !== ''
|
||||||
? sanitizeHtml(headCode, { allowedTags: ['script', 'meta'] })
|
? sanitizeHtml(headCode, {
|
||||||
|
allowedTags: ['script', 'meta'],
|
||||||
|
allowedAttributes: {
|
||||||
|
meta: ['name', 'content'],
|
||||||
|
},
|
||||||
|
})
|
||||||
: null,
|
: null,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ test('Should correctly parse metadata', async ({ page }) => {
|
|||||||
title: 'Custom title',
|
title: 'Custom title',
|
||||||
favIconUrl: 'https://www.baptistearno.com/favicon.png',
|
favIconUrl: 'https://www.baptistearno.com/favicon.png',
|
||||||
imageUrl: 'https://www.baptistearno.com/images/site-preview.png',
|
imageUrl: 'https://www.baptistearno.com/images/site-preview.png',
|
||||||
|
customHeadCode: '<meta name="author" content="John Doe">',
|
||||||
}
|
}
|
||||||
await createTypebots([
|
await createTypebots([
|
||||||
{
|
{
|
||||||
@ -50,6 +51,11 @@ test('Should correctly parse metadata', async ({ page }) => {
|
|||||||
(document.querySelector('link[rel="icon"]') as any).getAttribute('href')
|
(document.querySelector('link[rel="icon"]') as any).getAttribute('href')
|
||||||
)
|
)
|
||||||
).toBe(customMetadata.favIconUrl)
|
).toBe(customMetadata.favIconUrl)
|
||||||
|
expect(
|
||||||
|
await page.evaluate(
|
||||||
|
() => (document.querySelector('meta[name="author"]') as any).content
|
||||||
|
)
|
||||||
|
).toBe('John Doe')
|
||||||
await expect(
|
await expect(
|
||||||
typebotViewer(page).locator(
|
typebotViewer(page).locator(
|
||||||
`input[placeholder="${defaultTextInputOptions.labels.placeholder}"]`
|
`input[placeholder="${defaultTextInputOptions.labels.placeholder}"]`
|
||||||
|
Reference in New Issue
Block a user