diff --git a/.github/scripts/build_git_over_cdn_eo_esa.mjs b/.github/scripts/build_git_over_cdn_eo_esa.mjs index 7b4055adf..584ed8636 100644 --- a/.github/scripts/build_git_over_cdn_eo_esa.mjs +++ b/.github/scripts/build_git_over_cdn_eo_esa.mjs @@ -6,6 +6,10 @@ import { spawn, spawnSync } from "node:child_process"; import yazl from "yazl"; const env = process.env; +const MAIN_SITE_URL = "https://alas.nanoda.work/"; +const MAIN_SITE_HOST = "alas.nanoda.work"; +const SEO_TITLE = "AzurPilot 更新 CDN - 碧蓝航线自动化更新镜像"; +const SEO_DESCRIPTION = "AzurPilot 更新 CDN 提供 Git over CDN 静态更新文件、latest.json、更新包状态与最近提交信息,主站为 https://alas.nanoda.work/。"; function printHelp() { console.log(`构建 EO/ESA/Pages 可用的 git-over-cdn 静态更新文件。 @@ -301,6 +305,10 @@ function escapeHtml(value) { .replaceAll("'", "'"); } +function escapeScriptJson(value) { + return String(value).replaceAll("<", "\\u003c"); +} + function shortCommit(commit) { return commit.slice(0, 8); } @@ -348,6 +356,20 @@ function writeIndexHtml(outputDir, options, latest, oldCommits, commitInfos) { const generatedAtTimestamp = Date.now(); const generatedAt = new Date(generatedAtTimestamp).toISOString(); const commitAge = formatDuration(generatedAtTimestamp - latestCommitInfo.committedAtTimestamp); + const structuredData = escapeScriptJson(JSON.stringify({ + "@context": "https://schema.org", + "@type": "WebPage", + name: SEO_TITLE, + description: SEO_DESCRIPTION, + isPartOf: { + "@type": "WebSite", + name: "AzurPilot", + url: MAIN_SITE_URL, + }, + about: "AzurPilot Git over CDN 更新镜像", + relatedLink: MAIN_SITE_URL, + dateModified: generatedAt, + }, null, 2)); const packRows = oldCommits.map((commit) => { const filename = `${latest}/${commit}.zip`; return ` @@ -373,7 +395,21 @@ function writeIndexHtml(outputDir, options, latest, oldCommits, commitInfos) { - AzurPilot 更新 CDN + ${escapeHtml(SEO_TITLE)} + + + + + + + + + + + + + +