added script to redirect to main site if embedded

This commit is contained in:
zk2f 2024-11-30 07:32:36 +00:00 committed by nbats
parent fde68e9eed
commit 3445594ccd

View file

@ -63,6 +63,18 @@ export default defineConfig({
name: 'google-site-verification',
content: 'XCq-ZTw6VJPQ7gVNEOl8u0JRqfadK7WcsJ0H598Wv9E'
}
],
// Redirect to main site if embedded in iframe
[
'script',
{},
`
(function() {
if (window.self !== window.top) {
window.top.location = window.location.href;
}
})();
`
]
],
transformHead: async (context) => generateMeta(context, meta.hostname),