diff --git a/website/README.md b/website/README.md index 6068ef5..ca0588a 100644 --- a/website/README.md +++ b/website/README.md @@ -14,7 +14,7 @@ python3 -m http.server 8000 --bind 127.0.0.1 --directory dist/website ## 搜索入口 -首页围绕 Mac 本机批量转换、JPG/PNG/GIF 转 WebP 与视频转动图。两篇三语教程分别介绍 GIF 转无损 WebP 和按目标体积压缩 WebP,操作步骤和适用边界由 `guides.mjs` 维护。首页、教程和语言切换均用静态链接。 +首页围绕 Mac 本机批量转换、JPG/PNG/GIF 转 WebP 与视频转动图。四篇三语教程涵盖 GIF 转无损 WebP、按目标体积压缩 WebP、视频片段转动图和系列图片合成动图。操作步骤和适用边界由 `guides.mjs` 维护。首页、教程和语言切换均用静态链接。 搜索页有独立标题、描述和 canonical,语言版本互相声明 `hreflang`,英文为默认。首页以 `SoftwareApplication` 描述免费应用、兼容性、截图和下载入口。Sitemap 收录首页与教程,下载跳转页标记为 `noindex`。域名根目录的 robots.txt 由 [个人主页仓库](https://github.com/ixiehao/ixiehao.github.io) 指向项目 Sitemap。构建后运行 `website/verify.mjs` 核对上述入口。 diff --git a/website/build.mjs b/website/build.mjs index 15195ad..aacddab 100644 --- a/website/build.mjs +++ b/website/build.mjs @@ -206,7 +206,8 @@ function guidePage(key, t, slug, guide) { const leaf = slug + "/"; const prefix = pathPrefix(t, leaf); const steps = guide.steps.map(step => '
  • ' + escape(step) + '
  • ').join("\n"); - const related = guideEntries.find(([other]) => other !== slug); + const relatedSlug = guides[slug].related; + const related = guides[relatedSlug][key]; return publicHead(key, t, { ...guide, title: guide.title + " | Any2WebP" }, leaf) + "\n" + [ "", '', @@ -220,7 +221,7 @@ function guidePage(key, t, slug, guide) { '

    ' + escape(t.stepsHeading) + '

      ' + steps + '
    ', '

    ' + escape(guide.detailHeading) + '

    ' + escape(guide.detail) + '

    ', ' ', + '
  • ' + escape(related.title) + '
  • ', ' ', '', footer(t), diff --git a/website/guides.mjs b/website/guides.mjs index 8d527c5..6b9b916 100644 --- a/website/guides.mjs +++ b/website/guides.mjs @@ -1,5 +1,6 @@ export const guides = { "gif-to-webp": { + related: "compress-webp", en: { title: "How to Convert Animated GIF to WebP on Mac", description: "Convert animated GIF to lossless WebP locally on Mac. Compare the output frame by frame and check transparency, delays, and loop count before sharing.", @@ -35,6 +36,7 @@ export const guides = { }, }, "compress-webp": { + related: "gif-to-webp", en: { title: "How to Compress WebP to a Target File Size on Mac", description: "Batch compress WebP images and animations to a target in KB. Check the actual file size and compare the result with the original on your Mac.", @@ -69,4 +71,76 @@ export const guides = { detail: "さらに容量を減らすには、フレーム編集で不要なフレームを削除します。動画から作る場合は、範囲を短くするか、フレームレートや出力寸法を下げてから書き出します。GIF にも目標サイズを指定でき、必要に応じて色数が減ります。", }, }, + "video-to-webp-gif": { + related: "images-to-webp-gif", + en: { + title: "How to Turn a Video Clip into a WebP or GIF on Mac", + description: "Trim an MP4, MOV, or WebM on your Mac, set the frame rate and output dimensions, then export the clip as animated WebP or GIF in Any2WebP.", + steps: [ + "Open Any2WebP. Choose Help → Check Dependencies and follow the prompts if FFmpeg or ffprobe is missing. Click Animate Video and select an MP4, MOV, or WebM file.", + "Click Trim Clip. Drag the start and end handles on the timeline or enter the times, then select Apply Trim. In the main window, set the frame rate and long edge for the animation.", + "Choose WebP or GIF in Export settings. Set a target size in KB if you have an upload limit. Export, then compare the selected clip and the output in the synchronized preview. The animation has no audio.", + ], + detailHeading: "What settings should I start with?", + detail: "Try a short clip, such as 00:08 to 00:12, at 12 FPS and a 640 px long edge. If the clip exceeds the duration shown in the trim window, shorten the selection or lower the frame rate or long edge. Choose GIF for destinations that require it. WebP supports more colors and partial transparency.", + }, + zh: { + title: "如何在 Mac 上将视频片段制作成 WebP 或 GIF 动图", + description: "在 Mac 上截取 MP4、MOV 或 WebM 的一段,设置帧率和长边尺寸,用 Any2WebP 导出 WebP 或 GIF 动图。", + steps: [ + "打开 Any2WebP,在「帮助 → 检查依赖」确认 FFmpeg 和 ffprobe 已就绪。点击「视频转动图」,选择 MP4、MOV 或 WebM 文件。", + "点击「剪切片段」,在时间轴上拖动起止点,也可以直接输入时间。点击「确认剪切」后回到主窗口,设置导出帧率和长边尺寸。", + "在「导出设置」里选 WebP 或 GIF。有上传限制时,可用「按目标体积」填写 KB 上限。导出后同步播放原片段和成品,检查截取范围与播放速度。导出的动图没有声音。", + ], + detailHeading: "帧率、尺寸和时长怎么选?", + detail: "可以先截取 00:08 到 00:12 的 4 秒片段,以 12 FPS、长边 640 px 导出。剪切窗口会显示当前设置允许的最长时长。超过上限时,可缩短片段、降低帧率或减小长边。有的平台只接收 GIF,遇到这种情况就选 GIF。WebP 适合需要保留更多颜色和半透明的画面。", + }, + ja: { + title: "Mac で動画の一部を WebP・GIF アニメーションにする方法", + description: "Any2WebP で MP4・MOV・WebM を切り出し、フレームレートと長辺を指定して、Mac 上で WebP または GIF に書き出します。", + steps: [ + "Any2WebP を開き、「ヘルプ → 依存ツールを確認」で FFmpeg と ffprobe を確認します。「動画をアニメ化」を選び、MP4、MOV、WebM のいずれかを開きます。", + "「動画をトリミング」でタイムラインの開始・終了ハンドルを動かすか、時刻を直接入力します。「トリミングを確定」で戻り、フレームレートと長辺を設定します。", + "「書き出し設定」で WebP か GIF を選びます。容量制限がある場合は「目標サイズ」を KB で指定します。書き出したら元の範囲と同期再生して確認します。出力に音声は含まれません。", + ], + detailHeading: "フレームレート、寸法、長さの目安は?", + detail: "まず 00:08 から 00:12 までの 4 秒間を、12 FPS、長辺 640 px で試せます。トリミング画面に表示される上限を超えた場合は、範囲を短くするか、フレームレートや長辺を下げます。GIF のみ受け付けるサービスには GIF を選びます。WebP はより多くの色や半透明に対応しています。", + }, + }, + "images-to-webp-gif": { + related: "video-to-webp-gif", + en: { + title: "How to Make a WebP or GIF from a Series of Images on Mac", + description: "Combine a JPG or PNG sequence into an animated WebP or GIF on Mac. Arrange frames, set their timing, and preview the result in Any2WebP.", + steps: [ + "Open Any2WebP, click Combine Images, and select at least two still images, such as JPGs or PNGs. The frame editor sorts filenames naturally, so 1, 2, and 10 appear in that order.", + "Drag the thumbnails to change the order. Set a Uniform frame rate and click Apply to All Frames. You can then select a frame and enter its duration in milliseconds. Check the total duration before clicking Apply Edits.", + "Choose WebP or GIF in Export settings and export the animation. Use the preview and Output details to check the canvas, frame delays, plays, and transparency.", + ], + detailHeading: "How can I control the timing and canvas?", + detail: "At 10 FPS each frame lasts 100 ms, so 20 frames play for two seconds. Set the last frame to 500 ms if you want a longer pause at the end. Images with different aspect ratios are fitted proportionally to one canvas. WebP can keep the transparent margins and partial transparency. GIF pixels are either fully transparent or opaque.", + }, + zh: { + title: "如何在 Mac 上用系列图片合成 WebP 或 GIF 动图", + description: "用 Any2WebP 在 Mac 本机将一组 JPG、PNG 图片做成 WebP 或 GIF 动图,可拖动调整顺序、设置帧率和单帧停留时间。", + steps: [ + "打开 Any2WebP,点击「多图合成动图」,选入至少两张 JPG、PNG 等静态图片。帧编辑器会按文件名自然排序,例如 1、2、10。", + "拖动缩略图调整顺序。设置「统一帧率」后点击「应用到所有帧」。还可以选中一帧,用毫秒设置「单帧停留时间」。检查总时长后点击「应用编辑」。", + "在「导出设置」里选 WebP 或 GIF 并导出。在「成品信息」查看画布尺寸、帧延时、播放次数和透明度,也可以逐帧预览。", + ], + detailHeading: "怎么控制播放速度和画布?", + detail: "例如,20 张图片设为 10 FPS,每帧停留 100 ms,总时长是 2 秒。若想让结尾多停一会儿,可把最后一帧改为 500 ms。比例不同的图片会等比放入同一画布。WebP 可以保留透明留白和半透明,GIF 的像素只能全透明或不透明。", + }, + ja: { + title: "Mac で複数の画像から WebP・GIF アニメーションを作る方法", + description: "JPG や PNG の連番画像を Mac で WebP・GIF に合成。Any2WebP でフレームの順序や表示時間を調整し、書き出す方法を紹介します。", + steps: [ + "Any2WebP で「画像を合成」を選び、JPG や PNG などの静止画を 2 枚以上選びます。ファイル名は 1、2、10 のような数字順に並びます。", + "サムネイルをドラッグして順序を変えます。「一定のフレームレート」を選んで「全フレームに適用」を押します。個別のフレームを選び、表示時間をミリ秒で指定することもできます。合計時間を確認して「編集を適用」を押します。", + "「書き出し設定」で WebP か GIF を選び、書き出します。出力情報でキャンバスの寸法、フレームの表示時間、再生回数、透過を確認できます。", + ], + detailHeading: "再生速度とキャンバスを調整するには?", + detail: "20 枚を 10 FPS にすると、1 枚の表示時間は 100 ms で、全体は 2 秒です。最後の画像を長く見せるなら、そのフレームを 500 ms にします。縦横比の異なる画像は、比率を保ったまま同じキャンバスに収まります。WebP は透明な余白と半透明を保持でき、GIF では完全透明か不透明になります。", + }, + }, }; diff --git a/website/verify.mjs b/website/verify.mjs index 47c0618..0726dcd 100644 --- a/website/verify.mjs +++ b/website/verify.mjs @@ -6,7 +6,13 @@ const output = resolve(process.argv[2] || "dist/website"); const read = file => readFile(resolve(output, file), "utf8"); const site = "https://ixiehao.github.io/Any2WebP/"; const languages = [["en", ""], ["zh-CN", "zh/"], ["ja", "ja/"]]; -const pages = ["", "gif-to-webp/", "compress-webp/"]; +const guides = { + "gif-to-webp/": "compress-webp/", + "compress-webp/": "gif-to-webp/", + "video-to-webp-gif/": "images-to-webp-gif/", + "images-to-webp-gif/": "video-to-webp-gif/", +}; +const pages = ["", ...Object.keys(guides)]; const expectedUrls = languages.flatMap(([, route]) => pages.map(page => site + route + page)); const titles = new Set(); const descriptions = new Set(); @@ -49,6 +55,7 @@ for (const [lang, route] of languages) { if (page) { assert.equal([...html.matchAll(/
      [\s\S]*?<\/ol>/g)].length, 1); assert.ok(html.includes('href="../#formats"')); + assert.ok(html.includes('href="../' + guides[page] + '"')); assert.doesNotMatch(html, /]*>([\s\S]*?)<\/section>/)?.[1]; @@ -71,4 +78,4 @@ for (const [lang, route] of languages) { } } } -console.log("Verified nine indexable pages, reciprocal language links, and non-indexed download redirects."); +console.log("Verified " + expectedUrls.length + " indexable pages, reciprocal language links, and non-indexed download redirects.");