站点logo与标题设置

This commit is contained in:
xieYj 2022-02-14 17:15:20 +08:00
parent 2416dffb33
commit fe5954e0a5
3 changed files with 67 additions and 4 deletions

View File

@ -50,9 +50,23 @@ if (!defined('__TYPECHO_ROOT_DIR__')) exit;
<header class="navbar-fixed">
<nav id="headNav" class="bg-color nav-transparent">
<div id="navContainer" class="nav-wrapper container">
<div class="brand-logo"><a href="/" class="waves-effect waves-light"><img src="/medias/logo.png"
class="logo-img" alt="LOGO">
<span class="logo-span"><?php $this->options->title(); ?></span></a></div>
<div class="brand-logo">
<a href="/" class="waves-effect waves-light">
<?php if ($this->options->defaultBanner): ?>
<img src="<?php $this->options->defaultBanner() ?>"
class="logo-img" alt="LOGO">
<?php else: ?>
<img src="<?php $this->options->themeUrl('static/medias/logo.png'); ?>"
class="logo-img" alt="LOGO">
<?php endif; ?>
<?php if ($this->options->indexBannerTitle): ?>
<span class="logo-span"> <?php $this->options->indexBannerTitle() ?> </span>
<?php else: ?>
<span class="logo-span"> <?php $this->options->title(); ?></span>
<?php endif; ?>
</a>
</div>
<a href="#"
data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">

View File

@ -1,5 +1,48 @@
<?php
if (!defined('__TYPECHO_ROOT_DIR__')) exit;
/**
* 主题设置
*/
function themeConfig($form)
{
echo '<style>
p.notice {
line-height: 1.75;
padding: .5rem;
padding-left: .75rem;
border-left: solid 4px #fbbc05;
background: rgba(0,0,25,.025);
}</style>';
$defaultBanner = new Typecho_Widget_Helper_Form_Element_Text('defaultBanner', null, '', '首页顶部大图', '可以填写随机图 API。');
$form->addInput($defaultBanner);
$indexBannerTitle = new Typecho_Widget_Helper_Form_Element_Text('indexBannerTitle', null, '', '首页顶部大标题', '不要太长');
$form->addInput($indexBannerTitle);
$indexBannerSubtitle = new Typecho_Widget_Helper_Form_Element_Text('indexBannerSubtitle', null, '', '首页顶部小标题', '');
$form->addInput($indexBannerSubtitle);
$colorScheme = new Typecho_Widget_Helper_Form_Element_Radio('colorScheme', array('0' => '自动切换', '1' => '日间模式', '2' => '夜间模式'), '0', '主题颜色模式', '选择主题颜色模式。自动模式下每天 22:00 到次日 06:59 会显示为夜间模式。');
$form->addInput($colorScheme);
$indexStyle = new Typecho_Widget_Helper_Form_Element_Radio('indexStyle', array(
'0' => '双栏',
'1' => '单栏'), '0', '首页版式', '选择单栏或者双栏瀑布流');
$form->addInput($indexStyle);
// 高级设置
$reward = new Typecho_Widget_Helper_Form_Element_Text('reward', null, '', '打赏二维码', '图片链接,只允许一张图片,更多请自行合成。');
$form->addInput($reward);
$serifincontent = new Typecho_Widget_Helper_Form_Element_Radio('serifincontent', array('0' => '不启用', '1' => '启用'), '0', '文章内容使用衬线体', '是否对文章内容启用衬线体(思源宋体)。此服务由 Google Fonts 提供,可能会有加载较慢的情况。');
$form->addInput($serifincontent);
$lazyload = new Typecho_Widget_Helper_Form_Element_Radio('lazyload', array('1' => '启用', '0' => '不启用'), '1', '图片懒加载', '是否启用图片懒加载。');
$form->addInput($lazyload);
$enableMath = new Typecho_Widget_Helper_Form_Element_Radio('enableMath', array('0' => '不启用', '1' => '启用'), '0', '启用数学公式解析', '是否启用数学公式解析。启用后会多加载 1~2M 的资源。');
$form->addInput($enableMath);
$head = new Typecho_Widget_Helper_Form_Element_Textarea('head', null, '', 'head 标签输出内容', '统计代码等。');
$form->addInput($head);
$footer = new Typecho_Widget_Helper_Form_Element_Textarea('footer', null, '', 'footer 标签输出内容', '备案号等。');
$form->addInput($footer);
}
/**
* 获取文章缩略图

View File

@ -18,7 +18,13 @@ $this->need('base/header.php');
<div class="row">
<div class="col s10 offset-s1 m8 offset-m2 l8 offset-l2">
<div class="brand">
<div class="title center-align">墨白</div>
<div class="title center-align">
<?php if ($this->options->indexBannerTitle): ?>
<?php $this->options->indexBannerTitle() ?>
<?php else: ?>
浅雨
<?php endif; ?>
</div>
<div class="description center-align"><span id="subtitle"></span>
<script src="<?php $this->options->themeUrl('static/dplayer/DPlayer.min.js'); ?>"></script>
<script>var typed = new Typed("#subtitle", {