@@ -5,15 +5,25 @@ export interface Props {
55 title: string
66 description? : string
77 image? : string
8+ type? : ' website' | ' article'
89}
910
1011const {
1112 title,
1213 description = ' 前端程序员闲聊的中文播客节目' ,
1314 image = ' /logo500.webp' ,
15+ type = ' website' ,
1416} = Astro .props
1517
16- const allowIndexing = import .meta .env .PUBLIC_ALLOW_INDEXING === ' true'
18+ const allowIndexing = process .env .PUBLIC_ALLOW_INDEXING === ' true'
19+ const siteOrigin = (
20+ Astro .site ?.toString () ||
21+ import .meta .env .PUBLIC_SITE_URL ||
22+ ' https://webworker.tech'
23+ ).replace (/ \/ $ / , ' ' )
24+ const canonicalUrl = new URL (Astro .url .pathname , siteOrigin ).toString ()
25+ const imageUrl = new URL (image , siteOrigin ).toString ()
26+ const rssUrl = process .env .RSS_URL || ' https://feed.xyzfm.space/rv449dl9kqka'
1727---
1828
1929<!doctype html >
@@ -28,26 +38,30 @@ const allowIndexing = import.meta.env.PUBLIC_ALLOW_INDEXING === 'true'
2838 }
2939 <meta name =" viewport" content =" width=device-width, initial-scale=1.0" />
3040 <link rel =" icon" type =" image/webp" href =" /logo500.webp" />
41+ <link rel =" canonical" href ={ canonicalUrl } />
3142 <meta name =" generator" content ={ Astro .generator } />
3243
3344 <link
34- href =" https://www.xiaoyuzhoufm.com/podcast/613753ef23c82a9a1ccfdf35 "
45+ href ={ rssUrl }
3546 rel =" alternate"
36- title =" Web Worker 播客 小宇宙 "
47+ title =" Web Worker 播客 RSS "
3748 type =" application/rss+xml"
3849 />
3950
4051 <!-- Open Graph -->
4152 <meta property =" og:title" content ={ title } />
4253 <meta property =" og:description" content ={ description } />
43- <meta property =" og:image" content ={ image } />
44- <meta property =" og:type" content =" website" />
54+ <meta property =" og:image" content ={ imageUrl } />
55+ <meta property =" og:type" content ={ type } />
56+ <meta property =" og:url" content ={ canonicalUrl } />
57+ <meta property =" og:site_name" content =" Web Worker" />
58+ <meta property =" og:locale" content =" zh_CN" />
4559
4660 <!-- Twitter Card -->
4761 <meta name =" twitter:card" content =" summary_large_image" />
4862 <meta name =" twitter:title" content ={ title } />
4963 <meta name =" twitter:description" content ={ description } />
50- <meta name =" twitter:image" content ={ image } />
64+ <meta name =" twitter:image" content ={ imageUrl } />
5165
5266 <title >{ title } </title >
5367 </head >
0 commit comments