feat: 完善 SEO 元标签与性能缓存策略

- 扩展 title 至 55 字符,添加 canonical 和 robots meta
- 添加 Open Graph / Twitter Card 社交分享元标签
- 添加 JSON-LD WebApplication 结构化数据
- netlify.toml 增加静态资源长期缓存(immutable)与 HTML stale-while-revalidate
- 新增源码级 robots.txt,屏蔽 API 和内部路径
This commit is contained in:
Abner
2026-05-11 21:39:01 +08:00
parent 9941f66ee7
commit a187c85b06
3 changed files with 83 additions and 1 deletions

View File

@@ -15,10 +15,57 @@
<script src="/src/js/sentry-loader.js"></script>
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://browser.sentry-cdn.com https://www.googletagmanager.com https://challenges.cloudflare.com https://www.google.com https://www.gstatic.com; style-src 'self' 'unsafe-inline' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com; font-src 'self' data:; connect-src 'self' https://cdn.jsdelivr.net https://cdnjs.cloudflare.com https://www.google-analytics.com https://www.googletagmanager.com https://qrcode.show https://api.qrserver.com https://appapi.simyo.nl https://api.giffgaff.com https://id.giffgaff.com https://publicapi.giffgaff.com https://challenges.cloudflare.com https://www.google.com https://www.gstatic.com https://*.sentry.io; img-src 'self' data: https:; frame-src 'self' https://challenges.cloudflare.com https://www.google.com;">
<title>eSIM Tools - Giffgaff & Simyo</title>
<title>eSIM Tools - Giffgaff &amp; Simyo eSIM 在线管理工具 | 申请、激活与二维码生成</title>
<link rel="canonical" href="https://esim.cosr.eu.org/">
<meta name="robots" content="index, follow">
<link rel="manifest" href="/manifest.webmanifest">
<meta name="theme-color" content="#6366f1">
<!-- Open Graph / Facebook -->
<meta property="og:type" content="website">
<meta property="og:url" content="https://esim.cosr.eu.org/">
<meta property="og:title" content="eSIM Tools - Giffgaff & Simyo eSIM 在线管理工具">
<meta property="og:description" content="免费在线 eSIM 管理工具,支持 Giffgaff 与 Simyo 的 eSIM 申请、OAuth 认证、设备更换、QR 码生成及激活,浏览器端操作无需安装 App。">
<meta property="og:image" content="https://esim.cosr.eu.org/src/assets/og-image.png">
<meta property="og:locale" content="zh_CN">
<meta property="og:site_name" content="eSIM Tools">
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="eSIM Tools - Giffgaff & Simyo eSIM 在线管理工具">
<meta name="twitter:description" content="免费在线 eSIM 管理工具,支持 Giffgaff 与 Simyo 的 eSIM 申请、设备更换、QR 码生成及激活。">
<meta name="twitter:image" content="https://esim.cosr.eu.org/src/assets/og-image.png">
<!-- JSON-LD 结构化数据 -->
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "eSIM Tools",
"url": "https://esim.cosr.eu.org",
"description": "免费在线 eSIM 管理工具,支持 Giffgaff 与 Simyo 的 eSIM 申请、OAuth 认证、设备更换、QR 码生成及激活。",
"applicationCategory": "UtilitiesApplication",
"operatingSystem": "Web Browser",
"offers": {
"@type": "Offer",
"price": "0",
"priceCurrency": "GBP"
},
"featureList": [
"Giffgaff eSIM OAuth 认证与激活",
"Simyo eSIM 设备更换与管理",
"自动生成 eSIM QR 码",
"支持 MFA 多因素认证",
"浏览器端本地处理,保护隐私"
],
"inLanguage": ["zh", "en"],
"softwareHelp": {
"@type": "CreativeWork",
"url": "https://github.com/Silentely/eSIM-Tools"
}
}
</script>
<!-- 性能优化:预连接与预加载关键资源 -->
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
<link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin>

View File

@@ -137,6 +137,33 @@
to = "/index.html"
status = 404
# 静态资源长期缓存CSS/JS/字体/图片)
[[headers]]
for = "/src/styles/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
[[headers]]
for = "/src/js/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
[[headers]]
for = "/src/assets/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
[[headers]]
for = "/dist/*"
[headers.values]
Cache-Control = "public, max-age=31536000, immutable"
# HTML 页面:短缓存 + stale-while-revalidate
[[headers]]
for = "/*.html"
[headers.values]
Cache-Control = "public, max-age=300, stale-while-revalidate=86400"
# 安全头部
[[headers]]
for = "/*"

8
robots.txt Normal file
View File

@@ -0,0 +1,8 @@
# eSIM-Tools - 搜索引擎爬虫指令
User-agent: *
Allow: /
Disallow: /api/
Disallow: /.netlify/
Disallow: /src/
Sitemap: https://esim.cosr.eu.org/sitemap.xml