(blog) support og:image from different domain

This commit is contained in:
Andrea Vos 2024-03-22 00:12:43 +01:00
parent 614773630e
commit d76a657d2d

View File

@ -81,7 +81,10 @@ export const head = ({ title, description, banner, noindex = false, keywords }:
}
if (banner) {
banner = `${process.env.BASE_URL}/${banner.replace(/^\//, '')}`;
banner = banner.replace(/^\//, '');
if (!banner.startsWith('https://')) {
banner = `${process.env.BASE_URL}/${banner}`;
}
meta.meta.push({ hid: 'og:image', property: 'og:image', content: banner });
meta.meta.push({ hid: 'twitter:image', property: 'twitter:image', content: banner });
}