silverwolf-x/project / packages /next /src /server /app-render /metadata-insertion /create-server-inserted-metadata.tsx
silverwolf-x's picture
download
raw
634 Bytes
/**
* For chromium based browsers (Chrome, Edge, etc.) and Safari,
* icons need to stay under <head> to be picked up by the browser.
*
*/
const REINSERT_ICON_SCRIPT = `\
document.querySelectorAll('body link[rel="icon"], body link[rel="apple-touch-icon"]').forEach(el => document.head.appendChild(el))`
export function createServerInsertedMetadata(nonce: string | undefined) {
let inserted = false
return async function getServerInsertedMetadata(): Promise<string> {
if (inserted) {
return ''
}
inserted = true
return `<script ${nonce ? `nonce="${nonce}"` : ''}>${REINSERT_ICON_SCRIPT}</script>`
}
}

Xet Storage Details

Size:
634 Bytes
·
Xet hash:
2187e030ed6fe7856afef14e4214c226c12207e0868817fc3ff97d0e26c1d8b6

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.