更改「首页」的显示逻辑

This commit is contained in:
Skywt2003 2022-02-04 16:38:45 +08:00
parent 1a8e32c1dc
commit ac146e9676
2 changed files with 17 additions and 1 deletions

View File

@ -9,6 +9,9 @@ function themeConfig($form) {
$logoUrl = new Typecho_Widget_Helper_Form_Element_Text('logoUrl', NULL, Helper::options()->themeUrl.'/assets/avatar.png', '站点 LOGO 地址', '在这里填入一个图片 URL 地址, 以在网站标题前加上一个 LOGO');
$form->addInput($logoUrl);
$realHomepage = new Typecho_Widget_Helper_Form_Element_Text('realHomepage', NULL, NULL, '全站首页', '填入的链接会在导航栏首位显示为「首页」');
$form->addInput($realHomepage);
$icpInfo = new Typecho_Widget_Helper_Form_Element_Text('icpInfo', NULL, NULL, 'ICP 备案号', '显示在底部,留空则不显示');
$form->addInput($icpInfo->addRule('xssCheck', '请不要使用特殊字符'));

View File

@ -128,17 +128,30 @@
</div>
</div>
<ul class="col navbar-nav justify-content-center pr-0">
<?php if ($this->options->realHomepage){ ?>
<li class="nav-item">
<a class="nav-link nav-link-icon text-gray" href="<?php $this->options->realHomepage();?>">
<i class="fa fa-home"></i> 首页
</a>
</li>
<?php } ?>
<?php if (strpos($this->options->frontPage, 'file') !== FALSE) {?>
<li class="nav-item">
<a class="nav-link nav-link-icon <?php if ($this->is('index')){echo 'text-default';}else{echo 'text-gray';}?>" href="<?php $this->options->siteUrl();?>">
<i class="fa fa-home"></i> 首页
</a>
</li>
<?php if (strpos($this->options->frontPage, 'file') !== FALSE) {?>
<li class="nav-item">
<a class="nav-link nav-link-icon <?php if ($this->is('archive')){echo 'text-default';}else{echo 'text-gray';}?>" href="<?php echo $this->options->siteUrl.$this->options->routingTable['archive']['url'] ?>">
<i class="fa fa-book"></i> 文章
</a>
</li>
<?php } else {?>
<li class="nav-item">
<a class="nav-link nav-link-icon <?php if ($this->is('index')){echo 'text-default';}else{echo 'text-gray';}?>" href="<?php $this->options->siteUrl();?>">
<i class="fa fa-book"></i> 博客
</a>
</li>
<?php } ?>
<?php $this->widget('Widget_Contents_Page_List')->to($pagelist);
while ($pagelist->next()): ?>