fix: 重命名 favicon helper 避免与 sites.faviconUrl 同名冲突

将 Handlebars helper `faviconUrl(url)` 更名为 `faviconV2Url(url)`,解决自定义字段 `sites[].faviconUrl`
在模板中被误解析为 helper(无参调用)导致的渲染崩溃。

- helper:faviconUrl -> faviconV2Url
- 模板:site-card 中调用同步更新

BREAKING CHANGE:
自定义模板如使用 `{{faviconUrl url}}` 生成 faviconV2 地址,需要改为 `{{faviconV2Url url}}`。

Fixes: #32
This commit is contained in:
rbetree
2026-01-04 19:15:39 +08:00
parent 9929f60170
commit 3d9363a550
6 changed files with 99 additions and 12 deletions

View File

@@ -199,9 +199,9 @@ function add(a, b) {
* @param {string} url 站点 URL
* @param {Object} options Handlebars options 对象
* @returns {string} favicon URL
* @example {{faviconUrl url}}
* @example {{faviconV2Url url}}
*/
function faviconUrl(url, options) {
function faviconV2Url(url, options) {
if (!url) return '';
const region = options.data.root.icons?.region || 'com';
@@ -304,7 +304,7 @@ module.exports = {
keys,
encodeURIComponent: encodeURIComponentHelper,
add,
faviconUrl,
faviconV2Url,
faviconFallbackUrl,
safeUrl
};