ow
This commit is contained in:
1 parent
4adae1bd7d
commit
adcf94df4a
17 files changed
+274
-97
No files matched your search
@@ -35,9 +35,23 @@ async function setupApp() {
|
||||
// 初始化 i18n
|
||||
await setupI18n(app);
|
||||
|
||||
setupShareImage();
|
||||
|
||||
app.mount("#app");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分享卡片(微信收藏/转发等)的缩略图要求绝对地址,相对路径会被忽略,
|
||||
* 这里按当前域名把 index.html 里的 og:image 补全。
|
||||
*/
|
||||
function setupShareImage() {
|
||||
const meta = document.querySelector('meta[property="og:image"]');
|
||||
const content = meta?.getAttribute("content");
|
||||
if (meta && content && !/^https?:\/\//i.test(content)) {
|
||||
meta.setAttribute("content", new URL(content, location.origin).href);
|
||||
}
|
||||
}
|
||||
|
||||
setupPlugins();
|
||||
|
||||
setupApp();
|
||||
Reference in new issue
Block a user