添加 SEO 结构化数据

This commit is contained in:
Han
2025-02-20 19:04:58 +08:00
parent 126751ca79
commit 925b144426
4 changed files with 26 additions and 15 deletions
+2 -1
View File
@@ -2,6 +2,7 @@ import path from 'path';
import _fs from 'fs';
const fs = _fs.promises;
import { fileURLToPath } from 'url';
import SITE_INFO from '../config';
// 获取当前模块的目录路径
const __filename = fileURLToPath(import.meta.url); // 当前文件的绝对路径
const __dirname = path.dirname(__filename); // 当前文件所在的目录
@@ -61,7 +62,7 @@ const fileIter = createImageIterator(targetDir);
const getCover = async (filename: string | null | undefined) => {
if (filename) return filename;
const { value } = await fileIter.next();
return `/assets/images/banner/${value}`
return SITE_INFO.Site + `/assets/images/banner/${value}`
}
export default getCover;