typecho-theme/header.php
2022-11-18 10:56:51 +08:00

77 lines
3.9 KiB
PHP

<?php if (!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="<?php $this->options->charset(); ?>">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?php $this->archiveTitle([
'category' => _t('分类 %s 下的文章'),
'search' => _t('包含关键字 %s 的文章'),
'tag' => _t('标签 %s 下的文章'),
'author' => _t('%s 发布的文章')
], '', ' - '); ?><?php $this->options->title(); ?></title>
<!-- 使用url函数转换相关路径 -->
<!-- <link rel="stylesheet" href="<?php $this->options->themeUrl('normalize.css'); ?>"> -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>
<script src="<?php $this->options->themeUrl('prism.js'); ?>"></script>
<link rel="stylesheet" href="<?php $this->options->themeUrl('github-markdown.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('grid.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('style.css'); ?>">
<link rel="stylesheet" href="<?php $this->options->themeUrl('prism.css'); ?>">
<!-- 通过自有函数输出HTML头部信息 -->
<?php $this->header(); ?>
</head>
<body>
<header id="header" class="clearfix">
<nav class="navbar navbar-expand-lg">
<div class="container">
<a class="navbar-brand" href="<?php $this->options->siteUrl(); ?>"><?php $this->options->title() ?></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a<?php if ($this->is('index')): ?> class="nav-link active" <?php else: ?> class="nav-link" <?php endif; ?> aria-current="page" href="<?php $this->options->siteUrl(); ?>"><?php _e('首页'); ?></a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
分类
</a>
<ul class="dropdown-menu">
<?php $this->widget('Widget_Metas_Category_List')
->parse('<li><a class="dropdown-item" href="{permalink}">{name} ({count}篇)</a> </li>'); ?>
</ul>
</li>
<?php \Widget\Contents\Page\Rows::alloc()->to($pages); ?>
<?php while ($pages->next()): ?>
<li class="nav-item">
<a<?php if ($this->is('page', $pages->slug)): ?> class="nav-link active" <?php else: ?> class="nav-link" <?php endif; ?> aria-current="page" href="<?php $pages->permalink(); ?>"><?php $pages->title(); ?></a>
</li>
<?php endwhile; ?>
</ul>
<form class="d-flex" method="post" action="<?php $this->options->siteUrl(); ?>" role="search">
<input class="form-control me-2" name="s" type="search" placeholder="<?php _e('输入关键字搜索'); ?>" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
</header><!-- end #header -->
<div id="body">
<div class="container">
<div class="row">