fix: truncate doc title

This commit is contained in:
Gabe
2025-11-07 00:25:25 +08:00
parent fd7c663282
commit e71acdaaa9

View File

@@ -361,7 +361,7 @@ export class Translator {
this.#eventName = genEventName(); this.#eventName = genEventName();
this.#docInfo = { this.#docInfo = {
title: document.title, title: truncateWords(document.title),
description: this.#getDocDescription(), description: this.#getDocDescription(),
}; };
this.#combinedSkipsRegex = new RegExp( this.#combinedSkipsRegex = new RegExp(
@@ -1699,7 +1699,7 @@ export class Translator {
// 翻译页面标题 // 翻译页面标题
async #translateTitle() { async #translateTitle() {
const title = document.title; const title = document.title;
this.#docInfo.title = title; this.#docInfo.title = truncateWords(title);
if (!title) return; if (!title) return;
try { try {