feat(branding): default both site logos to assets/img/logo.png
- Point 站点 Logo / 暗色模式 Logo schema defaults (PHP + VUE) and the Settings::logo_url() fallback at assets/img/logo.png. - Point the footer night image default at the same file. - Remove logo_dark.png and the now-unreferenced assets/icons/default-logo.svg along with the private default_asset_url() helper that was its only reader. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
1dfcc38a83
commit
6bcfbfb252
7 files changed
+11
-24
No files matched your search
@@ -1,6 +1,7 @@
|
||||
const themeRoot = typeof window !== 'undefined' && window.jioAdminData?.themeUri
|
||||
? String(window.jioAdminData.themeUri).replace(/\/$/, '')
|
||||
: ''
|
||||
const defaultLogo = themeRoot ? `${themeRoot}/assets/img/logo.png` : ''
|
||||
const defaultFavicon = themeRoot ? `${themeRoot}/assets/img/favicon.png` : ''
|
||||
|
||||
export const logoSchema = {
|
||||
@@ -9,8 +10,8 @@ export const logoSchema = {
|
||||
icon: 'fa fas fa-image',
|
||||
description: '管理站点 Logo、站点图标和品牌标识。',
|
||||
defaults: {
|
||||
site_logo: '',
|
||||
site_logo_dark: '',
|
||||
site_logo: defaultLogo,
|
||||
site_logo_dark: defaultLogo,
|
||||
site_favicon: defaultFavicon,
|
||||
site_icon: defaultFavicon,
|
||||
logo_text: '',
|
||||
@@ -21,8 +22,8 @@ export const logoSchema = {
|
||||
title: 'Logo 设置',
|
||||
icon: 'fa fas fa-image',
|
||||
fields: [
|
||||
{ key: 'site_logo', label: '站点 Logo', type: 'media', help: '建议尺寸 300x80,支持 PNG/SVG 透明背景' },
|
||||
{ key: 'site_logo_dark', label: '暗色模式 Logo', type: 'media', help: '暗色模式下显示的 Logo,留空则使用默认 Logo' },
|
||||
{ key: 'site_logo', label: '站点 Logo', type: 'media', default: defaultLogo, help: '建议尺寸 300x80,支持 PNG/SVG 透明背景' },
|
||||
{ key: 'site_logo_dark', label: '暗色模式 Logo', type: 'media', default: defaultLogo, help: '暗色模式下显示的 Logo,留空则使用默认 Logo' },
|
||||
{ key: 'logo_text', label: 'Logo 文字', type: 'input', placeholder: '当无 Logo 图片时显示的文字', help: '同时作为首页标题和 alt 文本使用' },
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 60" width="200" height="60">
|
||||
<defs>
|
||||
<linearGradient id="g" x1="0%" y1="0%" x2="100%" y2="100%">
|
||||
<stop offset="0%" style="stop-color:#f04494"/>
|
||||
<stop offset="100%" style="stop-color:#ae53f3"/>
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<text x="10" y="42" font-family="system-ui,-apple-system,sans-serif" font-size="32" font-weight="700" fill="url(#g)">Jio</text>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 436 B |
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB |
@@ -156,8 +156,8 @@ class GlobalSchema {
|
||||
'option_key' => 'jio_settings',
|
||||
'groups' => [
|
||||
['key' => 'logo', 'title' => 'Logo 设置', 'fields' => [
|
||||
['key' => 'site_logo', 'label' => '站点 Logo', 'type' => 'media', 'default' => ''],
|
||||
['key' => 'site_logo_dark', 'label' => '暗色模式 Logo', 'type' => 'media', 'default' => ''],
|
||||
['key' => 'site_logo', 'label' => '站点 Logo', 'type' => 'media', 'default' => get_template_directory_uri() . '/assets/img/logo.png'],
|
||||
['key' => 'site_logo_dark', 'label' => '暗色模式 Logo', 'type' => 'media', 'default' => get_template_directory_uri() . '/assets/img/logo.png'],
|
||||
['key' => 'logo_text', 'label' => 'Logo 文字', 'type' => 'input', 'default' => ''],
|
||||
]],
|
||||
['key' => 'favicon', 'title' => '站点图标', 'fields' => [
|
||||
|
||||
@@ -83,7 +83,7 @@ class SchemaPageDisplay {
|
||||
self::field('fcode_template', '页脚布局模板选择', 'image_select', 'template_1', ['previewWidth' => 240, 'options' => [['label' => '模板一', 'value' => 'template_1', 'image' => self::asset('assets/images/footer/fcode_template_1.png')]]]),
|
||||
self::field('footer_t1_m_s', '版块一移动端显示', 'switcher', false),
|
||||
self::field('footer_t1_img', '日间模式图片', 'upload', $img . 'logo.png'),
|
||||
self::field('footer_t1_img_dark', '夜间模式图片', 'upload', $img . 'logo_dark.png'),
|
||||
self::field('footer_t1_img_dark', '夜间模式图片', 'upload', $img . 'logo.png'),
|
||||
self::field('footer_t1_t', '首行文字', 'text', ''),
|
||||
self::field('fcode_t1_code', '更多内容', 'textarea', 'Jio 主题专为博客、自媒体、资讯类的网站设计开发,简约优雅的设计风格,全面的前端用户功能,简单的模块化配置,欢迎您的体验', ['sanitize_type' => 'html', 'rows' => 3]),
|
||||
self::field('fcode_t2_code_1', '版块二第一行', 'textarea', '<a href="#">友链申请</a>' . "\n" . '<a href="#">免责声明</a>' . "\n" . '<a href="#">广告合作</a>' . "\n" . '<a href="#">关于我们</a>', ['sanitize_type' => 'html', 'rows' => 4]),
|
||||
|
||||
@@ -20,15 +20,10 @@ trait AuthReader {
|
||||
return !self::close_signup();
|
||||
}
|
||||
|
||||
/** 主题内置默认图片 URL */
|
||||
private static function default_asset_url(string $filename): string {
|
||||
return get_template_directory_uri() . '/assets/icons/' . $filename;
|
||||
}
|
||||
|
||||
/** 获取 Logo URL(留空时使用内置默认) */
|
||||
public static function logo_url(): string {
|
||||
$url = trim((string) self::get_value('site_logo', ''));
|
||||
return $url !== '' ? $url : self::default_asset_url('default-logo.svg');
|
||||
return $url !== '' ? $url : get_template_directory_uri() . '/assets/img/logo.png';
|
||||
}
|
||||
|
||||
/** 获取暗色模式 Logo URL(留空时跟随浅色模式) */
|
||||
|
||||
@@ -164,10 +164,10 @@ test('brand icons render despite the legacy fa-fab double prefix', () => {
|
||||
});
|
||||
|
||||
test('icon assets are consolidated and dead icon assets are gone', () => {
|
||||
for (const file of ['assets/icons/upload-add.svg', 'assets/icons/default-favicon.svg', 'assets/icons/default-logo.svg', 'assets/icons/playing.svg', 'assets/icons/user-certification.svg']) {
|
||||
for (const file of ['assets/icons/upload-add.svg', 'assets/icons/default-favicon.svg', 'assets/icons/playing.svg', 'assets/icons/user-certification.svg']) {
|
||||
assert.ok(fs.existsSync(path.join(root, file)), `${file} exists`);
|
||||
}
|
||||
for (const file of ['assets/img/upload-add.svg', 'assets/img/vip-1.svg', 'assets/img/vip-2.svg', 'assets/img/404.svg', 'assets/img/msg-system.svg', 'assets/fonts/img-code.ttf', 'assets/js/runtime/gutenberg-extend.js', 'assets/fontawesome5/webfonts/fa-solid-900.ttf']) {
|
||||
for (const file of ['assets/img/upload-add.svg', 'assets/img/logo_dark.png', 'assets/icons/default-logo.svg', 'assets/img/vip-1.svg', 'assets/img/vip-2.svg', 'assets/img/404.svg', 'assets/img/msg-system.svg', 'assets/fonts/img-code.ttf', 'assets/js/runtime/gutenberg-extend.js', 'assets/fontawesome5/webfonts/fa-solid-900.ttf']) {
|
||||
assert.ok(!fs.existsSync(path.join(root, file)), `${file} removed`);
|
||||
}
|
||||
const mainCss = read('assets/css/main.css');
|
||||
|
||||
Reference in new issue
Block a user