mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 19:41:02 +08:00
fix: use default-og for twitter card
This commit is contained in:
@@ -19,10 +19,13 @@ const {
|
|||||||
} = Astro.props;
|
} = Astro.props;
|
||||||
|
|
||||||
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
|
const canonicalURL = new URL(Astro.url.pathname, Astro.site);
|
||||||
|
|
||||||
const socialImageURL = new URL(
|
const socialImageURL = new URL(
|
||||||
ogImage ? ogImage : SITE.ogImage,
|
ogImage ? ogImage : SITE.ogImage,
|
||||||
Astro.url.origin
|
Astro.url.origin
|
||||||
);
|
).href;
|
||||||
|
|
||||||
|
const fallbackImageURL = new URL(SITE.ogImage, Astro.url.origin).href;
|
||||||
---
|
---
|
||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
@@ -51,7 +54,12 @@ const socialImageURL = new URL(
|
|||||||
<meta property="twitter:url" content={canonicalURL} />
|
<meta property="twitter:url" content={canonicalURL} />
|
||||||
<meta property="twitter:title" content={title} />
|
<meta property="twitter:title" content={title} />
|
||||||
<meta property="twitter:description" content={description} />
|
<meta property="twitter:description" content={description} />
|
||||||
<meta property="twitter:image" content={socialImageURL} />
|
<meta
|
||||||
|
property="twitter:image"
|
||||||
|
content={socialImageURL.endsWith(".svg")
|
||||||
|
? fallbackImageURL
|
||||||
|
: socialImageURL}
|
||||||
|
/>
|
||||||
|
|
||||||
<!-- Google Font -->
|
<!-- Google Font -->
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||||
|
|||||||
Reference in New Issue
Block a user