summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorJui-Ch'i Lau <21096362+KurococLiu@users.noreply.github.com>2023-03-18 11:32:25 +0800
committerGitHub <noreply@github.com>2023-03-18 11:32:25 +0800
commit6be33d93e3c66364a808372c2d4d34cd745d1beb (patch)
tree7d19c513dba3168a6b59a754fd614306387104db /libs
parentce75d531299ea0f2a500d61586d2837bda0b31b5 (diff)
parenta9c3180ecdf84add5d6084a19c9c79eedc14af9b (diff)
Merge branch 'BigCoke233:main' into main
Diffstat (limited to 'libs')
-rw-r--r--libs/Matcha.php25
-rw-r--r--libs/Options.php12
2 files changed, 33 insertions, 4 deletions
diff --git a/libs/Matcha.php b/libs/Matcha.php
index 4783998..047150a 100644
--- a/libs/Matcha.php
+++ b/libs/Matcha.php
@@ -264,10 +264,6 @@ class Matcha
if(Helper::options()->customNav=='' || $data['type']=='addition'){
$archive->widget('Widget_Contents_Page_List')->to($pages);
- //首页链接
- echo '<'.$tag.'><a href="';
- Utils::indexHome();
- echo '">首页</a></'.$tag.'>';
//页面列表
while($pages->next()) {
echo '<'.$tag.'><a href="';
@@ -288,6 +284,27 @@ class Matcha
}
/**
+ * 统一输出分类导航
+ * html 结构
+ */
+ public static function categoryNav(Widget_Archive $archive, $tag)
+ {
+ // 如果开启了分类导航,则输出分类
+ if(Helper::options()->categoryNav=='able') {
+ $archive->widget('Widget_Metas_Category_List')->to($categories);
+ while($categories->next()) {
+ echo '<'.$tag.'><a href="';
+ $categories->permalink();
+ echo '" title="';
+ $categories->name();
+ echo '">';
+ $categories->name();
+ echo '</a></'.$tag.'>';
+ }
+ }
+ }
+
+ /**
* 统一输出站点标题及副标题
* html 结构
*/
diff --git a/libs/Options.php b/libs/Options.php
index 935a7be..bacfe6c 100644
--- a/libs/Options.php
+++ b/libs/Options.php
@@ -72,6 +72,18 @@ function themeConfig($form) {
$relatedLinks = new Typecho_Widget_Helper_Form_Element_Textarea('relatedLinks', NULL, NULL, _t('首页「相关链接」内容'), _t('
<p class="description">使用特定的 JSON 格式书写,可以在首页文章目录之前展示一个相关链接版块,详情请查看说明文档</p>'));
$form->addInput($relatedLinks);
+ // 分类导航
+ $categoryNav = new Typecho_Widget_Helper_Form_Element_Radio('categoryNav', array(
+ 'able' => _t('启用'),
+ 'disable' => _t('停用'),
+ ),
+ 'disable',
+ _t('是否启用侧边栏分类导航'),
+ _t('
+ 启用后,将在侧边栏首页和独立页面中间加入所有分类页面。
+ ')
+ );
+ $form->addInput($categoryNav->addRule('required', _t('此处必须设置')));
/**
* 附加功能